I have the following:
- .orderedtest file which has a list of tests in an order
- .runsettings file where I have specified some test parameters
I am trying to execute the tests through command line, using the following command:
vstest.console.exe MyOrderedTests.orderedtest /Settings:MyTestParameters.runsettings /TestCaseFilter:"TestCategory=Production" /Logger:trx
I am getting the below warning and none of the tests are executed.
Warning: No test is available in MyOrderedTests.orderedtest. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
I really appreciate the help!
I even tried to run tests through the VS IDE. To elaborate more: 1. I have two tests 2. I have a Class Initialize which access the TestRunParameters from a .runsettings file. 3. I print the TestRunParameter in the tests. 4. I execute the tests individually and even all at once, they execute just fine.
Now I introduce the test ordering using .orderedtest file 1. I execute the tests using this orderedtest file and I get the NullReferenceException in the Class Initialize (where it tries to access the TestRunParameters from .runsettings file)
Class Initialization method TestTestProject.UnitTest1.ClassInit threw exception. System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object..
Below is my simple sample test code:
public static string url;
[TestMethod]
public void TestMethod1()
{
Console.WriteLine("Test Method 1");
Console.WriteLine(url);
}
[TestMethod]
public void TestMethod2()
{
Console.WriteLine("Test Method 2");
Console.WriteLine(url);
}
[ClassInitialize]
public static void ClassInit(TestContext context)
{
url = context.Properties["webAppUrl"].ToString();
}
I get the NullReferenceException in the ClassInit().