Is there a way to run a java program against some data, then find out which branches were not taken? (code coverage)
I have some fairly complex java programs with lots of if/else statements where various components interact with each other. I have some test data which exercises the code as much as possible.
Is there a way for me to run my code against this data and get information about which code paths were and were not executed?
(by test files, I mean I literally have text based csv files with hundreds of thousands of lines. Think of these lines as a collection of parameters. I try to randomly generate these开发者_运维百科 parameters to make sure all parts of my code are touched, but I'd like to be more sure since these programs have a high cost of failure)
I use EclEmma (Emma Eclipse plugin) with TestNG in Eclipse. It provides a nice visual indication of what is and isn't covered, plus coverage statistics in the coverage view.
I believe JUnit is supported, too.
I'm not sure about code paths, but for simple code coverage Emma is good. Has plugins for most of the major IDEs and "just works".
I think clover can do that
http://www.atlassian.com/software/clover/
精彩评论