diff --git a/src/status-emitter.ts b/src/status-emitter.ts
index 2eeacaf..92d2c08 100644
--- a/src/status-emitter.ts
+++ b/src/status-emitter.ts
@@ -38,27 +38,29 @@ class TestNgStatusEmitter {
testClass["test-method"]?.forEach((method: TestNg.TestMethod) => {
report._tests.total++;
+ const annotation = new Harness.ProjectAnnotation();
if (method.$.status == "FAIL") {
report._tests.failed++;
-
- const annotation = new Harness.ProjectAnnotation();
annotation.severity = Harness.Severity.BLOCKER;
- annotation.title = method.$.signature;
- annotation.detail = method.$.description;
- annotation.metadata = {
- duration_ms: method.$["duration-ms"],
- suite: suite.$.name,
- class: testClass.$.name,
- started: method.$["started-at"],
- finished: method.$["finished-at"]
- };
-
- annotations.push(annotation);
- } else if (method.$.status == "PASS") {
- report._tests.succeeded++;
} else if (method.$.status == "SKIP") {
report._tests.skipped++;
+ annotation.severity = Harness.Severity.WARNING;
+ } else if (method.$.status == "PASS") {
+ report._tests.succeeded++;
+ return; // continue loop; do not add annotation
}
+
+ annotation.title = method.$.signature;
+ annotation.detail = method.$.description;
+ annotation.metadata = {
+ duration_ms: method.$["duration-ms"],
+ suite: suite.$.name,
+ class: testClass.$.name,
+ started: method.$["started-at"],
+ finished: method.$["finished-at"]
+ };
+
+ annotations.push(annotation);
});
});
});
diff --git a/templates/report.md.tpl b/templates/report.md.tpl
index fef6518..3c62921 100644
--- a/templates/report.md.tpl
+++ b/templates/report.md.tpl
@@ -2,12 +2,17 @@
✔️ {{ event.report._tests.succeeded }} • ⏭ {{ event.report._tests.skipped }} • ❌ {{ event.report._tests.failed }}
-{% if annotations.length > 0 %}
-## Failed tests
-
-| Test | Description |
-|:---|:---|
-{% for annotation in annotations -%}
-| {{ annotation.title }} | {{ annotation.detail }} |
-{% endfor %}
-{% endif %}
+{%- for suite in event['testng-results'].suite %}
+
+### Suite {{ suite.$.name }}
+
+| | Group | Class | Test | Description |
+|---|:---|:---|:---|:---|
+{%- for test in suite.test %}
+{%- for testClass in test.class %}
+{%- for testMethod in testClass['test-method'] %}
+| {{ testMethod.$.status }} | {{ testClass.$.name }} | {{ testMethod.$.signature }} | {{ testMethod.$.description }} |
+{%- endfor %}
+{%- endfor %}
+{%- endfor %}
+{% endfor %}
diff --git a/test/mock/testng-report-multiple.xml b/test/mock/testng-report-multiple.xml
new file mode 100644
index 0000000..e5ac7dc
--- /dev/null
+++ b/test/mock/testng-report-multiple.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/template.spec.ts b/test/template.spec.ts
index f053e1e..08724d3 100644
--- a/test/template.spec.ts
+++ b/test/template.spec.ts
@@ -46,6 +46,26 @@ describe("Templating", () => {
expect(markdown).to.be.not.undefined;
expect(markdown).to.include("someDescription2");
expect(markdown).to.include("test1()");
- expect(markdown).to.include("Failed tests");
+ expect(markdown).to.include("test2()");
+ expect(markdown).to.include("setUp()");
+ });
+
+ it(`should be able to process multiple test-suites`, async () => {
+ const data = await xml2js.parseStringPromise(fs.readFileSync("./test/mock/testng-report-multiple.xml"));
+ const result = (statusEmitter as any).processEvent(
+ data
+ );
+
+ const templateData: TestNg.ReportTemplate = {
+ event: data,
+ annotations: result
+ };
+
+ const markdown = uut.template(Templates.REPORT, templateData);
+
+ expect(markdown).to.be.not.undefined;
+ expect(markdown).to.include("s2_test1()");
+ expect(markdown).to.include("s2_test2()");
+ expect(markdown).to.include("Suite2");
});
});