[erlang-questions] eunit failure - "*** test module not found ***"

French, Mike Mike.French@REDACTED
Tue Mar 16 18:39:15 CET 2010


Graeme,

I think this occurs when you omit a leading underscore 
on an eunit macro in a test-generating function.

For example, say you write a simple test function using a basic macro:

  basic_test() -> ?assert( 1 + 1 =:= 2 ).

Then you decide to convert it to a test-generating function, you should 
append  an '_' to the function name, and 
prepend an '_' to the macro    name:

  fancy_test_() -> ?_assert( 1 + 1 =:= 2 ).

but if you forget to change the macro name:

  bad_test_() -> ?assert( 1 + 1 =:= 2 ).

then you get the error as you describe:

  undefined
  *** test module not found ***
  ::ok
  =======================================================
    Failed: 0.  Skipped: 0.  Passed: 0.
  One or more tests were cancelled.
  error

The 'ok' value in the error message is the result of 
evaluating the function returned by the macro,
so your mistake is on a macro that returns 'true'.

Mike





> -----Original Message-----
> From: erlang-questions@REDACTED 
> [mailto:erlang-questions@REDACTED]On
> Behalf Of Graeme Defty
> Sent: 16 March 2010 15:34
> To: erlang-questions@REDACTED
> Subject: [erlang-questions] eunit failure - "*** test module not found
> ***"
> 
> 
> Hi,
> 
> I have a problem executing eunit tests in my current environment
> (which i am sure used to work fine - I think - curse this 
> failing memory :-(  )
> 
> Anyway, I have included eunit in my source:
> 
>  -include_lib("eunit/include/eunit.hrl").
> 
> and it compiles without complaint, but when i try to run the 
> tests it fails:
> 
>  4> eunit:test(csv).
>  undefined
>  *** test module not found ***
>  ::true
> 
>  =======================================================
>    Failed: 0.  Skipped: 0.  Passed: 0.
>  One or more tests were canceled.
>  error
> 
> I can see the auto-generated test functions using module_info/0 and
> can even execute them manually.
> 
> I am clearly not accessing a library, and I am sure I have missed some
> simple step ( a parameter to the erl
> command perhaps?) or something equally dumb, but i have scoured the
> docs and cant find it.
> 
> Any ideas, anyone?
> 
> Thanks
> 
> graeme
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 

Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail
is confidential. It may also be legally privileged. It is intended only for
the stated addressee(s) and access to it by any other person is
unauthorised. If you are not an addressee, you must not disclose, copy,
circulate or in any other way use or rely on the information contained in
this e-mail. Such unauthorised use may be unlawful. We may monitor all
e-mail communications through our networks. If you have received this e-mail
in error, please inform us immediately on sender's telephone number above
and delete it and all copies from your system. We accept no responsibility
for changes to any e-mail which occur after it has been sent.  Attachments
to this e-mail may contain software viruses which could damage your system.
We therefore recommend you virus-check all attachments before opening.
Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business
Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No.
868273


More information about the erlang-questions mailing list