Reputation: 13
Is there a tools which shows the number of test cases to provide decision/condition coverage ?
for ex:
if(x>0)
if(x<=10 && y>0)
3 cases are enough for decision/condition coverage.
if(x>0)
if(x<=10 || y>0)
4 cases are enough for decision/condition coverage.
Is it true?
Upvotes: 0
Views: 1338
Reputation: 80276
Yes, there are tools that generate testcases in order to achieve coverage. If all you are interested in is the number only, you can count them once they are all there. The generated test suites usually have at least the property that each of the testcases improved coverage when it was added (in sequence). Because of the way they work, these tools are usually flexible in terms of the coverage criteria to achieve. I would guess they all allow decision/condition coverage.
We present a new symbolic execution tool, KLEE, capable of automatically generating tests that achieve high coverage on a diverse set of complex and environmentally-intensive programs.
From http://llvm.org/pubs/2008-12-OSDI-KLEE.html
Another testcase generation tool is PathCrawler
A third is the internal tool Sage, used at Microsoft.
The generic name of the technique these tools rely on is concolic testing. Since, as Oli points out in his answer, it is a difficult problem these tools are solving, the design space is very large and the details differ widely between these tools.
Upvotes: 0
Reputation: 272497
Probably not.* Other than for trivial situations like this, it's very difficult to figure out the number of possible cases.
On the other hand, there are code-coverage tools, which track what percentage of your code has actually been run in a test.
Upvotes: 1