How can I make Rebar run Common Test in a release directory?
Asked Answered
K

1

9

I have a Rebar project with a top-level release directory that just includes the component applications as dependencies and contains the reltool configuration.

Some of my applications have Common Test suites in test subdirectories, and I can run those tests with rebar ct.

Now I want to create a Common Test suite for the entire release. However, when I run rebar ct skip_deps=true in the top-level directory, I just get:

Command 'ct' not understood or not applicable

How can I make Rebar run my tests?

Kaufmann answered 29/6, 2012 at 15:54 Comment(0)
K
10

Rebar has three sets of modules (see rebar.app):

  • any_dir_modules, which apply to any directory in your project;
  • app_dir modules, which apply only to directories containing files matching src/*.app.src or ebin/*.app (see rebar_app_utils:is_app_dir/1); and
  • rel_dir modules, which apply only to directories containing reltool.config or reltool.config.script (see rebar_rel_utils:is_rel_dir/1).

The rebar_ct module, which is responsible for running Common Test, is in the app_dir category, and your top-level release directory is thus not eligible.

You can work around this by specifying that rebar_ct is a plugin, since plugins bypass the module category mechanism. Put the following line in your rebar.config:

{plugins, [rebar_ct]}.

And you'll get:

$ rebar ct skip_deps=true
==> foo (ct)
==> bar (ct)
==> my_rel (ct)
DONE.
Testing src.my_rel: TEST COMPLETE, 0 ok, 0 failed of 0 test cases
Kaufmann answered 29/6, 2012 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.