2

I have written a number of test cases in C# for UI which uses Selenium Webdriver (I am new to Selenium).

I would like to run a particular test case out of N number of test cases through command prompt and NUnit by creating a .bat file which can be run using task scheduler.

Any pointers would be very helpful.

Niels van Reijmersdal
32.7k4 gold badges59 silver badges125 bronze badges
asked Dec 14, 2015 at 6:28
1
  • i thought it will be helpful.i dont know which framework you are using junit ,testng or something else this answer for testng framework 1) remove all other Testng annotation and place on method which you want to execute, 2)create jar of that or run directly right click on project then run as testng Commented Dec 14, 2015 at 7:03

2 Answers 2

2

You can run a single test from the command line using the nunit-console. Open command-prompt and change directory to the NUnit bin installation folder.

To run a single test use:

nunit-console /run:TestsToRun <path_to_dll>

E.g. If your test has the following structure

namespace TestsNamespace
{
 public class TestsClass
 {
 //your tests go here
 }
}

you'll need to use in the command line:

nunit-console /run:TestsNamespace.TestsClass <path_to_dll>

You can read more about the nunit command line options here.

answered Dec 14, 2015 at 8:17
0

Instead of creating a .bat file to schedule the tests you should think about setting up a continious integration. With this you can automatically run all your tests for example when a developer commited a change.

The idea of tests is to proove the functionality of the product when it changes not to be run at fixed times. When there were no changes you run the same tests multiple times against the same product. When there were multiple changes since your last execution it's more difficult to see which of the changes broke the tests.

answered Dec 14, 2015 at 7:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.