Skip to content

Commit

Permalink
distinguish error and failure in the junit report
Browse files Browse the repository at this point in the history
  • Loading branch information
albaizq committed Apr 14, 2020
1 parent d911a0a commit 991b354
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/oeg/albafernandez/tests/utils/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ public static String jsonToJUnitXML(JSONArray jsonArray){
if(obj.getJSONObject(0).has("Ontology")){
ontology = obj.getJSONObject(0).getString("Ontology");
}
if(!result.equalsIgnoreCase("passed")){
if(result.equalsIgnoreCase("conflict")){
String msg="";
failures++;
if(result.equalsIgnoreCase("conflict")){
msg="There is an inconsistency between the ontology and the requirement associated to the test\n";
}else if(result.equalsIgnoreCase("Absent")){
msg="There is an inconsistency between the ontology and the requirement associated to the test\n";
testcases+="\t\t\t<failure message=c"+msg+" with URI "+ontology+"\">" +
"</failure>\n";
}else if(result.equalsIgnoreCase("Absent") || result.equalsIgnoreCase("Incorrect") || result.equalsIgnoreCase("Undefined")){
String msg="";
if(result.equalsIgnoreCase("Absent")){
msg="A restriction included in the test may be missing in the ontology";
}else if(result.equalsIgnoreCase("Undefined")){
if(obj.getJSONObject(0).has("Undefined")){
Expand All @@ -100,9 +103,12 @@ public static String jsonToJUnitXML(JSONArray jsonArray){
}else
msg="There are tests in the test that are not defined as in the ontology";
}
testcases+="\t\t\t<failure message="+msg+" with URI "+ontology+">" +
"</failure>\n";
testcases+="\t\t\t<error message=\""+msg+" with URI "+ontology+"\">" +
"</error>\n";

}


testcases+="\t\t</testcase>\n";
}

Expand Down

0 comments on commit 991b354

Please sign in to comment.