How To: Running Specflow features with Selenium in Jenkins

This is a short guide how to run Specflow features which use Selenium for interaction with a web site. In our building environment these tests are running in Jenkins. Implementing this you’ll get automated UI-test runner.

Running Tests

We’re using NUnit as a test framework under the hood. Because of that all .feature files have auto-generated .cs files with NUnit tests.

The easiest way to run it in Jenkins which I found is running it from the command line. In order to do that you need to use nunit-console.exe. The console can be downloaded from NUnit web site.  The command line can look like:

More abut command line parameters here.

Configuring Jenkins

In the command line above the key “format=nunit2” is important for Jenkins because the new format of result XML is not supported. We’re using Jenkins ver. 1.647. Without it the results won’t be imported. In order to run tests you should do the following:

  1. To add a build step to your job ‘Execute Windows batch command’. Input the command to run the tests.
  2. To add a post build action ‘Publish NUnit test result report’ where you specify the path to the result XML from the command line.
  3. Make sure settings for browsers allows Javascript and other required features. It should be done for each web driver that you use.

In order to adjust browser settings you should login to the machine with the appropriate use and go to Internet Options (for IE).

Configuring the Project

The project with Specflow features that use Selenium also must be adopted. In order to do that I just added several suggested official NuGet packages: RC, WebDriver, WebDriverBackedSelenium, Support.

See Also




No Comments


You can leave the first : )



Leave a Reply