如何将参数传递给 Fitnesse .NET 命令行任务运行程序

发布于 2024-08-06 06:56:32 字数 390 浏览 1 评论 0原文

我有一个 Fitnesse.NET 验收测试套件,我想将其作为 TFS/MSBuild CI 构建的一部分运行。

该套件包含一些在从构建过程调用时需要覆盖的 Fitnesse 变量,例如:

!define ConnectionString {Data Source=...}

从命令行测试运行程序调用套件时如何覆盖套件中定义的变量值?

我希望能够做这样的事情:

Tests\TestRunner.exe -v -results test.results localhost 8082 MyTestSuite -P:ConnectionString={MyBuildServerDB}

有什么想法吗?

I have a Fitnesse.NET acceptance test suite that I want to run as part of my TFS/MSBuild CI build.

The suite contains some Fitnesse variables that I need to override when calling from the build process, eg:

!define ConnectionString {Data Source=...}

How can I override the variable values defined in the suite when calling the suite from the command line test runner?

I'd like to be able to do something like:

Tests\TestRunner.exe -v -results test.results localhost 8082 MyTestSuite -P:ConnectionString={MyBuildServerDB}

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别挽留 2024-08-13 06:56:32

第一个答案的符号链接技巧效果很好。

另一种解决方案是使用环境变量或java变量。任何环境或java变量都可以从fitnesse页面访问,就好像它是一个变量一样。因此,如果 Fitnesse 页面上有 ${MYVAR},并且有 MYVAR 环境或 java 变量,那么它将使用环境或 java 变量的值。

The symbolic link trick of the first answer works nicely.

Another solution is to use environment variables or java variables. Any environment or java variable can be accessed from a fitnesse page as though it was a variable. So if you have ${MYVAR} on a fitnesse page, and you have a MYVAR environment or java variable, then it will use the value of the environment or java variable.

冷夜 2024-08-13 06:56:32

我不确定如何将一个传递到运行器中,但是您可以制作以不同方式定义变量的符号页面,然后您只需调用不同的页面即可。例如,在我们的设置中,我们可以使用内存存储库或使用 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

Im not sure of a way to pass one into the runner, but you could make symbolic pages that define your variables differently and then you just call the different page. For example in our setup we can run our tests with in-memory repositories or with MySQl as the database. This allows us to run the entire suite very fast and then CI can run the slow ones.

So we have two pages that contain a symbolic link. The properties looks like this:

<?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>

and the contents looks like this:

!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

Then the runner can get the pages to run as a param something like this:

.\dotnet\TestRunner -format xml -results results.xml localhost 8080 FrontPage.MemoryMustPass
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文