Sonarqube and Test Assertions (S2699)

We’re on the enterprise edition of SonarQube (8.2) and we’ve got some questions about what causes the S2699 rule to fire sometimes unexpectedly. We’re trying to better understand why sometimes we have assertions in place (perhaps named something different depending the testing framework we’re using) and it triggers this rule and other times does not. Can someone provide more detail on exactly what this rule is looking for? Thanks in advance!


What language are we talking about? C# or Java?


Well, our company uses both so eventually I’d like to understand both. That being said my immediate concern in around C#.

hi @Brian.Flynn

You can read the rule specification:

In addition, you can read the rule implementation ( TestMethodShouldContainAssertion) and the UnitTestHelper class which contains some helper methods.

If you have specific questions in mind, please ask.