Test Runner ignores tests with ClassInitialize MSTest attribute

When trying to use the ClassInitialize attribute shown below, test runner will not execute the test class. When it is removed, the tests are executed. 

 

    [ClassInitialize]
        public static void OneTimeSetup()
        {

        }

1
1 comment

Hello Andrew,

MSTest's [ClassInitialize] attribute requires the method to have a particular signature, namely you have to pass a parameter of a TestContext type. In your example in would be as follows:

  [ClassInitialize]
  public static void OneTimeSetup(TestContext context)
  {

  }

Adding this parameter should fix the Inconclusive test runs for you.

Also, currently we have an open request in our tracker that, if implemented, would enable providing information to users about the reason tests did not run. We would appreciate if you could upvote the issue to demonstrate the interest. You can also click Watch in the tracker to subscribe to future status updates.

0

Please sign in to leave a comment.