CxxTest之 CxxTestGen命令

CxxTestGen是一个用于C++测试的工具,它能够解析头文件并生成测试运行器。这个命令行工具支持多种选项,如自定义输出文件、测试世界标签、错误处理方式等。它可以创建基于不同类的测试运行器,并提供XML结果输出,适配不同的测试打印器。此外,CxxTestGen还允许用户选择是否使用标准库和异常处理,以及自定义模板和全局数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CxxTestGen命令

CxxTestGen处理一个或者多个C++头文件生成test runner.
该命令通过解析头文件以查找从类继承的测试类来执行测试发现CxxTest::TestSuite。

Usage: cxxtestgen [options] [<filename> ...]

The 'cxxtestgen' command processes C++ header files to perform test discovery,
and then it creates files for the 'CxxTest' test runner.

Options:
  -h, --help            show this help message and exit
  --version             Write the CxxTest version.
  -o NAME, --output=NAME
                        Write output to file NAME.
  -w WORLD, --world=WORLD
                        The label of the tests, used to name the XML results.
  --include=HEADER      Include file HEADER in the test runner before other
                        headers.
  --abort-on-fail       Abort tests on failed asserts (like xUnit).
  --main=MAIN           Specify an alternative name for the main() function.
  --headers=HEADER_FILENAME
                        Specify a filename that contains a list of header
                        files that are processed to generate a test runner.
  --runner=CLASS        Create a test runner that processes test events using
                        the class CxxTest::CLASS.
  --gui=CLASS           Create a GUI test runner that processes test events
                        using the class CxxTest::CLASS. (deprecated)
  --error-printer       Create a test runner using the ErrorPrinter class, and
                        allow the use of the standard library.
  --xunit-printer       Create a test runner using the XUnitPrinter class.
  --xunit-file=XUNIT_FILE
                        The file to which the XML summary is written for test
                        runners using the XUnitPrinter class.  The default XML
                        filename is TEST-<world>.xml, where <world> is the
                        value of the --world option.  (default: cxxtest)
  --have-std            Use the standard library (even if not found in tests).
  --no-std              Do not use standard library (even if found in tests).
  --have-eh             Use exception handling (even if not found in tests).
  --no-eh               Do not use exception handling (even if found in
                        tests).
  --longlong=TYPE       Use TYPE as for long long integers.  (default: not
                        supported)
  --no-static-init      Do not rely on static initialization in the test
                        runner.
  --template=TEMPLATE   Generate the test runner using file TEMPLATE to define
                        a template.
  --root                Write the main() function and global data for a test
                        runner.
  --part                Write the tester classes for a test runner.
  -f, --fog-parser      Use new FOG C++ parser
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值