我一直在使用 MsTest.exe 使用这样的命名空间运行测试:
mstest.exe /testcontainer:"MyDllFile.dll" /test:"NameSpace.Folder.Folder1.*"
这就像一个魅力,但我需要能够在运行时将参数传递给我的测试,所以我找到了 *.runsetttings 文件以及它使用 RunTestParameters 将参数传递给测试并从 TestContext 的属性中获取它们的能力,但是缺点是我必须非常具体地说明我想运行什么测试,并且必须给它一个特定的方法名称或用逗号分隔的名称来执行测试,如下所示:
vstest.console.exe "MyDllFile.dll" /Settings:"my.runsettings" /Tests:"TestMethod1,TestMethod2"
我也尝试了 TestCaseFilter 也没有运气:
vstest.console.exe "vstest.console.exe "MyDllFile.dll" /Settings:"my.runsettings" /TestCaseFilter:"TestCategory=MyTestCategory"
有没有人建议我如何使用 vstest.console.exe 完成我对 mstest.exe 所做的事情?
谢谢!!