Symptoms
JetBrains Rider does not immediately recognize unit test cases for dynamic tests, e.g. decorated with the [Theory] or [TestCaseSource] attributes. Upon running the tests, test cases show up in the test explorer tree.
Cause
By default, Rider or ReSharper discover tests in the build artifacts without launching the test runner. As tests are defined using attributes, Rider or ReSharper can quickly scan the metadata of managed artifacts to find most tests in the project. However, it may fail to find some tests. In the scenario with parametrized tests, test cases can only be discovered by using the test runner to analyze build artifacts. Running the tests implies the test runner discovery process, so the test cases are displayed after the run.
Resolution
Please follow the steps below to change a setting that will make test cases in parametrized tests be discovered upon building the solution:
Rider
- Go to Setting | Build, Execution, Deployment | Unit Testing | <your test framework>
- In this section, set Test discovery to Test runner.
ReSharper
- Go to (Extensions |) ReSharper | Options | Tools | Unit Testing | <your test framework>
- In this section, set Test discovery to Test runner.
Comments
0 comments
Please sign in to leave a comment.