如何将参数传递给 Fitnesse .NET 命令行任务运行程序
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第一个答案的符号链接技巧效果很好。
另一种解决方案是使用环境变量或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.
我不确定如何将一个传递到运行器中,但是您可以制作以不同方式定义变量的符号页面,然后您只需调用不同的页面即可。例如,在我们的设置中,我们可以使用内存存储库或使用 MySQl 作为数据库来运行测试。这使我们能够非常快地运行整个套件,然后 CI 可以运行较慢的套件。
所以我们有两个包含符号链接的页面。属性如下所示:
内容如下所示:
然后运行程序可以将页面作为参数运行,如下所示:
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:
and the contents looks like this:
Then the runner can get the pages to run as a param something like this: