单元测试(命令行)
资料
示例
参考项目xkexp.cpp/test/CppUnitTest
运行所有测试用例
VsTest.Console UnitTestCpp.dll
运行指定测试用例
- 运行UnitTestCpp项目的所有名为"TestMethond11"的测试方法
(只看
TEST_METHOD
指定的方法名,并不区分命名空间,类名等)
VsTest.Console UnitTestCpp.dll /Tests:TestMethod11
# 所以这是正则了个寂寞,和这条是没区别的,并不能区别命名空间和类名
VsTest.Console UnitTestCpp.dll /Tests:TestMethod11
VsTest.Console UnitTestCpp.dll /TestCaseFilter:"TestMethod11"
VsTest.Console UnitTestCpp.dll /TestCaseFilter:"Name~TestMethod11"
- 运行UnitTestCpp项目的所有名为"TestMethod11"和"TestMethod22"的测试方法
VsTest.Console UnitTestCpp.dll /Tests:TestMethod11,TestMethod22
- 看起来指定了测试限定名,但经测无效
VsTest.Console UnitTestCpp.dll /TestCaseFilter:"FullyQualifiedName=UnitTestCpp.UnitTestCpp.TestMethod11"
VsTest.Console UnitTestCpp.dll /TestCaseFilter:"ClassName=UnitTestCpp.UnitTestCpp"