[erlang-questions] Common test with rebar3

Trent Hampton <>
Fri Jan 29 16:39:59 CET 2016


Thank you in advance for any help on this one.

Background:
I have a simple module in ./src/adb.erl
I have a simple common test suite in ./test/my_SUITE.erl
rebar.config has no added config for common test.

When I run the common test suite below with 'rebar3 ct --suite my_SUITE' i
get a badmatch error indicating that the module has not been loaded. Why?
Do I need to preload the modules in the same project as the common tests?

The error is below.

-module(my_SUITE).
-compile(export_all).

all() ->
  [mod_exists].

mod_exists(_) ->
%  {module,mnesia} = code:load_file(mnesia),
  {module,adb} = code:load_file(adb).

[ adb]# rebar3 ct --suite my_SUITE --config
/opt/codecloud/adb/test/test.config
===> Verifying dependencies...
===> Running Common Test suites...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
my_SUITE:mod_exists failed on line 9
Reason: {badmatch,{error,nofile}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

%%% my_SUITE ==> mod_exists: FAILED
%%% my_SUITE ==> {failed,{{badmatch,{error,nofile}},
         [{my_SUITE,mod_exists,1,

[{file,"/opt/codecloud/adb/_build/test/extras/test/my_SUITE.erl"},
                     {line,9}]},
          {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1408}]},
          {test_server,run_test_case_eval1,6,
                       [{file,"test_server.erl"},{line,984}]},
          {test_server,run_test_case_eval,9,
                       [{file,"test_server.erl"},{line,926}]}]}}
Failed 1 tests. Passed 0 tests.
Results written to "/opt/codecloud/adb/_build/test/logs/index.html".
===> Failures occured running tests: 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160129/763ee632/attachment.html>


More information about the erlang-questions mailing list