I am talking about the real 'Test Completeness', not the traditional 'Code Coverage',because Code Coverage is not very helpful when people start asking for more accurate estimations.

And by 'Test Completeness' I mean that (virtually) ALL possible usages of a function are covered, including Border conditions of the arguments, etc.

There is another Stackoverflow thread discussing this topic, but no java tool is mentioned in it.

Is there such as tool that can take a look at the current JUnit Tests and tell me approximately the percentage of completeness?

  • Can you list your test cases for a function SomeObject doSth(List<SomeObject> l) { return doSomethingElse(l); }? Applications like pex can find edge cases (e.g., collections with null values), but they cannot generate all test cases. You need a human that understands the logic of the application and its expected results. Human use equivalence partitioning approach for instance to track coverage. Obviously, the challenge it define those classes.
    – dzieciou
    Jan 22 '14 at 5:33
  • Though there are tools that can help a bit, see stackoverflow.com/questions/2131935/….
    – dzieciou
    Jan 22 '14 at 5:40

Have you tried Jacoco? Jacoco generates line and branch coverage (more info in the docs). I'm not really sure if that covers your "completeness" definition. Personally, I don't write many unit tests, I use the Java Agent to show lines/branches executed during functional automated tests (this feature is totally awesome). I hope it fits what you are looking for.

If not, I hope others add it to there test automation stack, it gives you hard numbers on what lines of code are being executed in your automated or manual tests.

  • Thanks for the answer. What I meant is not lines of code executed, but all possible conditions of a function. For example, if there is a function int sum(int a, int b) which calculates the sum of two integers, then we need to make lots of test cases against this function including floating numbers, negative numbers, etc.
    – Victor
    Oct 12 '13 at 13:31
  • I don't understand this comment. In Java, it is impossible to pass floating point numbers to a function like sum(int a,int b).
    – user246
    Dec 22 '13 at 13:09

http://testinginterviewsquestions.blogspot.com/2012/10/unit-testing.html'>Unit Software Testing = The unit testing features of Visual Studio 2012 were shown to be an effective way to improve software quality by introducing various tests.

  • 2
    the unit testing features of Visual Studio do not include Java. In addition, the question is asking for advice about a way to tell how many of the possible paths through a routine are covered by unit tests. You haven't answered that question.
    – Kate Paulk
    Oct 23 '13 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.