erlangrebarcommon-test

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


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?


Solution

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

    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