1

I have the following:

  1. .orderedtest file which has a list of tests in an order
  2. .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().

Rishi
  • 31
  • 4
  • I tried even though the VS IDE. Elaborating more: – Rishi Nov 19 '15 at 06:53
  • Have you checked the actual content of your _MyOrderedTests.orderedtest_? I had a similar problem, and I've noticed that the `storage` attribute within that XML file contains a relative path to the DLLs to test; that path could not be correct when the tests are run from vstest.console in that way... – mguassa Nov 26 '15 at 09:42

0 Answers0