nihulus
nihulus

Reputation: 1495

set up c# Selenium webdriver to Jenkins

I'm trying to set up my Selenium webdriver for .Net tests to Jenkins, first time to Jenkins never tried it before, but having some issues giveing a headache.

I installed VSTest Runner plugin in Jenkins, in Configuration I added Path to VSTest C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe in VSTest installer.

VSTestInstall

And added run tests:

runTests

But getting following errors:

Error: The test source file "C:\Program" provided was not found.
Error: The test source file "Files" provided was not found.
Error: The test source file "(x86)\Jenkins\jobs\Jenkins" provided was not found.
Error: The test source file "Test" provided was not found.
Error: The test source file "App\workspace\RegressionTestLibrary\bin\Debug\RegressionTest.dll" provided was not found.

Looks like it read whitespace as a new-line, I'm not even sure doing right, anyone can enlight me? :)

Upvotes: 0

Views: 3472

Answers (2)

Alex Ionut
Alex Ionut

Reputation: 36

You could try to use a Windows Batch Command instead of plugin. I will assume that you are using a single instance of Jenkins, not a Master-Slave structure (Jenkins with multiple nodes):

  1. Go to Jenkins Dashboard > Manage Jenkins > Configure System > Global Properties > check Environment Variables box and add Path Variable with the location of your VSTest runner. (Please see the attached picture for example) First Step

  2. Go to your Jenkins Jobs > Add Build Step > Execute Windows Batch command and enter: vstest.console.exe "{{ your_test.dll_location }}". The path is relative to the workspace Jenkins folder. Second Step

If you are using a node: Go to Jenkins Dashboard > Your Node > Configure > Node Properties check Environment Variable box and add Path variable with the location of your VSTest runner. Repeat the step 2 but don't forget to check the Restrict where this project can be run box in job configuration and select the label for your node.

The result: Result

Hope this will help you!

Upvotes: 2

S.MCI
S.MCI

Reputation: 1

I had this exact problem, I fixed it by replacing C:\Program Files(x86)\Jenkins\jobs\Jenkins Test App\workspace with {WORKSPACE} So for you it should look like {WORKSPACE}\RegressionTestLibrary\bin\Debug\RegressionTest.dll, however I now have the issue that my build will pass, but now the console tells me

Starting test discovery, please wait...

Finished: SUCCESS

so my tests are never actually ran, this could be a separate issue, and for all I know you may not encounter it.

Upvotes: 0

Related Questions