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.

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 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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.