简体   繁体   English

如何让Rebar在发布目录中运行Common 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. 我有一个带有顶级版本目录的Rebar项目,该目录只包含组件应用程序作为依赖项,并包含reltool配置。

Some of my applications have Common Test suites in test subdirectories, and I can run those tests with rebar ct . 我的一些应用程序在test子目录中有通用测试套件,我可以使用rebar ct运行这些测试。

Now I want to create a Common Test suite for the entire release. 现在我想为整个版本创建一个Common Test套件。 However, when I run rebar ct skip_deps=true in the top-level directory, I just get: 但是,当我在顶级目录中运行rebar ct skip_deps=true时,我得到:

Command 'ct' not understood or not applicable

How can I make Rebar run my tests? 如何让Rebar运行我的测试?

Rebar has three sets of modules (see rebar.app ): Rebar有三组模块(参见rebar.app ):

  • any_dir_modules , which apply to any directory in your project; any_dir_modules ,适用于项目中的任何目录;
  • 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 ); app_dir模块,仅适用于包含与src/*.app.srcebin/*.app src/*.app.src匹配的文件的目录(请参阅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 ). rel_dir模块,仅适用于包含reltool.configreltool.config.script目录(请参阅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. rebar_ct模块,负责运行常见的测试,是在app_dir类别,以及您的顶级版本目录因此没有资格。

You can work around this by specifying that rebar_ct is a plugin, since plugins bypass the module category mechanism. 你可以通过指定rebar_ct是一个插件来解决这个问题,因为插件绕过了模块类别机制。 Put the following line in your rebar.config : rebar.config下行放在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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM