Skip to content

Commit

Permalink
testng-team#1673 fix problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanaduchi committed Feb 3, 2018
1 parent 2b46499 commit cb13acf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/main/java/org/testng/IReporter2.java
Expand Up @@ -8,9 +8,6 @@
* This interface can be implemented by clients to generate a report. Its method
* generateReport() will be invoked after all the suite have run and the parameters
* give all the test results that happened during that run.
*
* @author kanaduchi
* Feb 02, 2018
*/
public interface IReporter2 extends ITestNGListener {
/**
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/org/testng/internal/ExitCodeListener.java
@@ -1,17 +1,11 @@
package org.testng.internal;

import org.testng.IAttributes;
import org.testng.IReporter2;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import org.testng.*;
import org.testng.xml.XmlSuite;

import java.util.List;

public class ExitCodeListener implements ITestListener, IReporter2 {
public class ExitCodeListener implements ITestListener, IReporter, IReporter2 {
private boolean hasTests = false;
private final ExitCode status = new ExitCode();

Expand All @@ -23,6 +17,16 @@ public boolean hasTests() {
return hasTests;
}

@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
for (ISuite suite : suites) {
for (ISuiteResult suiteResult : suite.getResults().values()) {
ITestContext context = suiteResult.getTestContext();
status.computeAndUpdate(context);
}
}
}

@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, IAttributes attributes) {
for (ISuite suite : suites) {
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/testng.xml
Expand Up @@ -127,6 +127,7 @@
<class name="test.preserveorder.PreserveOrderTest" />
<class name="test.SerializationTest" />
<class name="test.CountTest" />
<class name="test.CountTest2" />
<class name="test.EclipseTest" />
<class name="test.ReporterApiTest" />
<class name="test.reports.UniqueReporterInjectionTest"/>
Expand Down

0 comments on commit cb13acf

Please sign in to comment.