JetBrains Rider 2022.3 Help

Maintain code quality of unit tests

One of the most powerful JetBrains Rider features, code inspection, comes in handy when you write unit tests. In addition to hundreds of general-purpose inspections, there is also a number of dedicated inspections that target problems specific to unit tests:

NUnit (30 inspections)

These inspections detect code issues related to NUnit tests.

Inspection

Default severity

NUnit. Async test method must return Task or Task<T>

Warning

NUnit. Cannot resolve symbol in TestCaseSource or ValueSource attribute.

Warning

NUnit. Duplicate values.

Warning

NUnit. Ignored parameter attribute.

Warning

NUnit. Implicitly unspecified null values.

Warning

NUnit. Incompatible argument type or incorrect argument value.

Warning

NUnit. Incompatible expected result type or incorrect value.

Warning

NUnit. Incorrect range bounds. 'to' must be greater than or equal to 'from'.

Warning

NUnit. Mismatch of the range step sign.

Warning

NUnit. Missing arguments in TestCase attribute.

Warning

NUnit. Missing expected result for non-void test method.

Warning

NUnit. No values provided in the attributes.

Warning

NUnit. Non-public test method.

Warning

NUnit. Range 'step' parameter value must be non-zero.

Warning

NUnit. Redundant argument in TestCase attribute.

Warning

NUnit. Redundant argument instead of ExpectedResult.

Warning

NUnit. Redundant expected result for void test method.

Warning

NUnit. Specified attribute values produce too many tests.

Disabled

NUnit. Specified values are not compatible with the test parameter type.

Warning

NUnit. Test case Result property duplicates ExpectedResult.

Warning

NUnit. Test case Result property is obsolete.

Warning

NUnit. Test case source must be field, property, or method.

Warning

NUnit. Test case source must be non-abstract and implement IEnumerable.

Warning

NUnit. Test case source must be static.

Warning

NUnit. The maximum range value is not reachable with the step value.

Warning

NUnit. Values for test method parameters are not provided.

Warning

NUnit. Values in range do not fit the type of the test parameter.

Warning

NUnit.AutoFixture. Incompatible argument type or incorrect argument value.

Warning

NUnit.AutoFixture. Missing Test or TestFixture attribute.

Warning

NUnit.AutoFixture. Redundant argument in InlineAutoData attribute.

Warning

Xunit (1 inspection)

These inspections detect code issues related to xUnit.Net tests.

Last modified: 19 August 2021