get the names of test cases that execute a particular statement in Clover XML report

aliparsai July 25, 2016

I'd like to get the names of test cases that execute a particular statement using Clover, and use this information in my research. While this information is available in the HTML report if I click on a statement, it is lacking in the XML report, so I cannot parse this information automatically. Is there a way to export this information?

1 answer

1 accepted

1 vote
Answer accepted
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 25, 2016

Hi Ali,

Please have a look at https://confluence.atlassian.com/display/CLOVER/Database+Structure, chapter "Reading from a Clover database" on how to load the Clover's database with coverage data. 

In order to get list of test cases hitting given statement you have to call CloverDatabase#getTestHits() method, for example:

for (StatementInfo stmtInfo : methodInfo.getStatements()) {
    // cast is needed because StatementInfo interface does not expose this
    database.getTestHits((FullStatementInfo) stmtInfo); 
}

Cheers
Marek 

aliparsai July 25, 2016

worked like a charm!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events