Standard Analyses

SemmleCode Professional comes with a wide range of pre-packaged analyses, from architectural properties and metrics, to statement-level checks for likely bugs and violations of best practice.


Test Case Has No Tests

This query finds empty, non-abstract JUnit test case classes.

How to Interpret the Query Results

The query flags all such classes and displays a list of found occurrences in the result view.

How to Address the Query Results

Write some test cases.

Source Code
import default

from JUnit38TestClass j
where j.fromSource() and
      not j.hasModifier("abstract") and
      not exists (TestMethod t | t.getDeclaringType() = j)
select j, "TestCase has no tests"
References

JUnit 3.8.1 Cookbook