I'm a new to javaparser and I'm trying to look for ways on how one can improve overall code coverage of a class. From a very basic perspective I'm trying to parse the class and look for conditional statements (like if else if switch etc.) and try-catch clauses. Imo,if test-cases for all such possible branches are provided then it'll help increase the code coverage.
Question: 1.How can I look for keywords like "else-if" by parsing the file
2.What classes must I use?
I found the Statement class and created a mock method to check for if statements in a class
public void visit(IfStmt n,Void arg)
{
System.out.println("Found an if statement " + n.getClass() + " @ " + n.getBeginLine());
}
3.How can I search for operators like "&&" and "||" ?
4.Any tips on how I might go about increasing the code coverage?
Aucun commentaire:
Enregistrer un commentaire