We're receiving a failure for one of our tests, and the entire Trace Output of it is below:
Quote:NCrunch: This test was executed on server '(local)'
Test method must be public
We're unable to work out what's causing this problem, and we're only able to sort of reproduce it in a minimal solution currently, so I'm posting the details of it here to see if this makes any sense.
- We have an abstract class with a handful of test methods on it decorated with TestMethod attributes.
- The abstract class does not have a TestClass attribute.
- There are 3 concrete classes which inherit from the abstract class and have the TestClass attribute on them. These are nested within other public classes.
- Each of the 3 concrete classes have no test methods themselves, just the ones inherited from the abstract class.
- Each of the 3 concrete classes passes a different parameter into the abstract class's constructor (as this is what is being tested)
- 2 of the 3 concrete class have no problem running tests
- In the 3rd concrete class, the 2nd test fails to run with the above error
- By "the 2nd test" I literally mean the 2nd test that is declared in the file. It doesn't matter what it's called, or what it's testing (even an empty method) fails
- If we put an Ignore attribute on the 2nd test then no tests fail
- This only seems to happen in the "Optimised" instrumentation mode
- MSTest doesn't have a problem running any of the tests
- Renaming the test class has no effect
- Un-nesting this test class from the partial class fixes the problem
- Nesting the class within a different class also fixes the problem (in some scenarios)
My repro can be found
here. If it works the same for you as it does for me, then Class2 will have a failing test in it (the first one). I've left some TODO comments in there showing what happens when certain things are changed.