我不确定将一个传递给跑步者的方法,但您可以制作以不同方式定义变量的符号页面,然后您只需调用不同的页面。例如,在我们的设置中,我们可以使用内存存储库或 MySQl 作为数据库来运行我们的测试。这使我们可以非常快速地运行整个套件,然后 CI 可以运行慢速套件。
所以我们有两个包含符号链接的页面。属性如下所示:
<?xml version="1.0"?>
<properties>
<Help></Help>
<LastModified>20090427102431</LastModified>
<Search/>
<Suite/>
<Suites></Suites>
<SymbolicLinks>
<MustPass>.FrontPage.MustPass</MustPass>
</SymbolicLinks>
<saveId>1231186112073</saveId>
<ticketId>3122308994585074329</ticketId>
</properties>
内容如下所示:
!define repository_type {InMemory}
This is the test suite for in-memory tests. Run this instead of running the !-MustPass-! suite.
!contents -R2 -g -p -f -h
然后跑步者可以让页面作为参数运行,如下所示:
.\dotnet\TestRunner -format xml -results results.xml localhost 8080 FrontPage.MemoryMustPass