Skip to content

Commit

Permalink
feat: added logging of suite result in csv
Browse files Browse the repository at this point in the history
  • Loading branch information
mattebit committed Feb 21, 2024
1 parent 486da22 commit 2acdc0c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tool/src/main/java/migt/TestSuite.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package migt;

import org.apache.commons.text.StringEscapeUtils;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
Expand Down Expand Up @@ -55,7 +57,7 @@ public void log_test_suite(String log_folder_path) {
}

String log_content = "";
log_content += "| test name | description | type | result | applicable |\n";
log_content += "| name | description | type | result | applicable |\n";
log_content += "|-----------|-------------|------|--------|------------|\n";

for (Test t : tests) {
Expand All @@ -77,6 +79,27 @@ public void log_test_suite(String log_folder_path) {
} catch (IOException e) {
e.printStackTrace();
}

String log_content_csv ="";
log_content_csv += "name,description,type,result,applicable\n";
for (Test t : tests) {
log_content_csv +=
StringEscapeUtils.escapeJava(t.name.replaceAll(",","")) + "," +
StringEscapeUtils.escapeJava(t.description.replaceAll(",","")) + "," +
(t.isActive ? "active" : "passive") + "," +
t.success + "," +
t.applicable + "\n";
}

File log_suite_csv = new File(test_log_folder + "results.csv");
try {
FileWriter fw = new FileWriter(log_suite_csv.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(log_content_csv);
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}


Expand Down

0 comments on commit 2acdc0c

Please sign in to comment.