Edg*_*gar 5 cruisecontrol.net selenium nunit
我在CruiseControl.NET配置中有这个代码块:
<exec>
<executable>C:\Windows\System32\cmd.exe</executable>
<buildArgs>/C SETX SELENIUM_BROWSER googlechrome /M</buildArgs>
</exec>
Run Code Online (Sandbox Code Playgroud)
接下来是一个NUnit执行命令,它将在我的网站上运行一些Selenium测试.我们的想法是,在运行测试之前,此命令会更改测试浏览器(系统环境变量).
问题是该命令似乎不起作用.测试仍在使用默认浏览器Firefox.如果我手动更改环境变量,它可以工作.
我究竟做错了什么?
编辑:
我尝试将命令放在批处理文件中并执行它,但它仍然无效:
<exec executable="C:\CCNet\setChrome.bat" />
Run Code Online (Sandbox Code Playgroud)
批处理文件内容:
SETX SELENIUM_BROWSER googlechrome /M
Run Code Online (Sandbox Code Playgroud)
像这样格式化命令可以正确设置环境变量:
<exec>
<executable>cmd</executable>
<buildArgs>/C SETX SELENIUM_BROWSER googlechrome /M</buildArgs>
</exec>
Run Code Online (Sandbox Code Playgroud)
现在我需要弄清楚为什么我的NUnit测试没有正确地提取它.
更新:
应该使用environment可执行任务中的元素将变量传递给测试.例如:
<exec>
<executable>make</executable>
<baseDirectory>D:\dev\MyProject</baseDirectory>
<buildArgs>all</buildArgs>
<buildTimeoutSeconds>10</buildTimeoutSeconds>
<successExitCodes>0,1,3,5</successExitCodes>
<environment>
<variable>
<name>MyVar1</name>
<value>Var1Value</value>
</variable>
<variable name="MyVar2" value="Var2Value" />
</environment>
</exec>
Run Code Online (Sandbox Code Playgroud)
我实际上在一个小配置文本文件中实现了浏览器设置作为一种解决方法,但是这个元素会使它更容易,我不需要运行任何命令行命令.
| 归档时间: |
|
| 查看次数: |
3681 次 |
| 最近记录: |