I am using Selenium with C # for automation, and I want to call NUnit through code as follows:
CoreExtensions.Host.InitializeService(); TestPackage testPackage = new TestPackage(@"D:\Automation\bin\Debug\Test.dll"); RemoteTestRunner remoteTestRunner = new RemoteTestRunner(); remoteTestRunner.Load(testPackage); //TestFilter filter = new NameFilter(new TestName() { Name = "Test1" }); TestResult testResult = remoteTestRunner.Run( new NullListener(), TestFilter.Empty, false, LoggingThreshold.Off );
I can run tests using the category filter as shown below
remoteTestRunner.Run( new NullListener(), new CategoryFilter("MyCat"), false, LoggingThreshold.Off );
But I want to perform specific tests. How to set dialing filter? I tried the following, but it does not work:
TestFilter filter = new NameFilter(new TestName() { Name = "Test1" }); TestResult testResult = remoteTestRunner.Run( new NullListener(), filter, false, LoggingThreshold.Off );
How to run certain tests and how to pass arguments using code?
source share