简体   繁体   English

Boost.Test - 如何编写不自动运行的测试

[英]Boost.Test - How to write a test that doesn't run automatically

A project I am working on uses continuous integration (CI) system that automatically builds and runs all test suites.我正在从事的一个项目使用持续集成 (CI) 系统,该系统自动构建和运行所有测试套件。 Auto tests are run without any command line arguments.自动测试在没有任何命令行参数的情况下运行。 I would like to add long running tests into existing suites and I don't want those test to be trigger by CI.我想将长时间运行的测试添加到现有套件中,并且我不希望这些测试被 CI 触发。 What is the proper way to add tests that don't run automatically?添加不自动运行的测试的正确方法是什么?

I am thinking to use custom command line arguments .我正在考虑使用自定义命令行参数 Is there more explicit way to do it?有没有更明确的方法来做到这一点?

See Enabling or disabling test unit execution .请参阅启用或禁用测试单元执行

Essentially,本质上,

  BOOST_AUTO_TEST_CASE(test1, * boost::unit_test::disabled())
  {
     ...
  }

If you run without parameters, it will not execute.如果不带参数运行,它将不会执行。

With --run_test=test1 or --run_test=* , it still will execute.使用--run_test=test1--run_test=* ,它仍然会执行。

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

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