Given a test failure, I have to extract all code statements that the test execution ran.
Let's say unit test 1 has failed. I have to extract all the codes it executed.
public class Driver {
method1 {
}
method2 {
}
method3 {
}
public TakeScreenshot(int flag){
statement1;
statement2;
if(flag) {
statement_inside_flag;
}
statement100;
}
}
[TestMethod]
public void TestThings()
{
boolean result = Driver.TakeScreenshot(true);
Assert.isTrue(result);
}
Is there an easy way I can do it using an open-source tool?
If I want to extract the body of the code under test
i.e. in this case the output would be as follows. Some lines in the TakeScreenshot
was not executed:
public class Driver {
public TakeScreenshot(int flag){
statement1;
statement2;
if(flag) {
statement_inside_flag;
return;
}
}
}