I have this block of code in the CruiseControl.NET configuration:
<exec>
<executable>C:\Windows\System32\cmd.exe</executable>
<buildArgs>/C SETX SELENIUM_BROWSER googlechrome /M</buildArgs>
</exec>
It is followed by an NUnit execution command that will run some Selenium tests on my website. The idea is that this command changes the testing browser (system environment variable) before the tests are run.
The problem is that the command does not seem to be working. The tests are still using the default browser, Firefox. It works if I manually change the environment variable.
What am I doing wrong?
EDIT:
I tried putting the command in a batch file and executing that, but it still didn't work:
<exec executable="C:\CCNet\setChrome.bat" />
The batch file contents:
SETX SELENIUM_BROWSER googlechrome /M
Formatting the command like this sets the environment variable correctly:
<exec>
<executable>cmd</executable>
<buildArgs>/C SETX SELENIUM_BROWSER googlechrome /M</buildArgs>
</exec>
Now I need to figure out why my NUnit tests aren't correctly picking it up.
UPDATE:
Should have used the environment
element in the executable task to pass variables to the test. For example:
<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>
I actually implemented the browser setting in a little config text file as a workaround, but this element would have made it easier and I wouldn't have needed to run any command line commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With