saab613
saab613

Reputation: 213

How do I run selenium projects with NUnit or MStest in Jenkins and record the results?

Trying to get a little bit of help with my selenium projects that I'm running.

Currently, I have two different C# selenium projects setup - they are both testing different things but for learning purposes, I (foolishly) decided to use two different test frameworks; NUnit and Microsoft.VisualStudio.TestTools.UnitTesting.

I've been learning everything as I go, these two projects have been moving along quite nicely and are quite successful.

I've been running all my tests locally on my machine and keeping track of passed and failed runs, which are working well on a small scale but this needs to change.I would like to do something a bit smarter, basically, I would like for people to be able to run the test while I'm not around and record all the details.

We currently have Jenkins as our continuous integration environment. My tests are stored in bitbucket. I'm not using selenium grid.

What I would like to do is set up these two projects as their own individual pipelines that somebody can just kick off and the pass/fail results are recorded in Jenkins.

I don't really want it to do anything like run on check-in, and I'm okay with chaining pipelines together. I'm just a little unsure of how to get this all going.

I have found various bits dotted around the internet but that has all been for MStest and very little (to nothing) for NUnit/selenium stuff. I'm just looking to get a better understanding of how to go about setting this all up in Jenkins.

Upvotes: 1

Views: 885

Answers (1)

danielonthenet
danielonthenet

Reputation: 444

You can use the following pipeline command to run the tests (assuming nunit console is installed under C:\NUnit.org\nunit-console\ in your Jenkins agent machine)

bat 'C:\NUnit.org\nunit-console\nunit3-console.exe ${workspace}\bin\Debug\SmokeTest.dll'

You will ideally do it in a stage (say, test) after you build your project

stage('Test'){
                steps {
bat 'C:\NUnit.org\nunit-console\nunit3-console.exe ${workspace}\bin\Debug\SmokeTest.dll'
                }
}

To know how to configure a pipeline, look here

Upvotes: 1

Related Questions