Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests run concurrently using Multi threading #254

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
<version>3.0.0-M7</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,9 @@ public Integer execute() throws Exception {
} else if (coverage) {
new Coverage(resolver).getAll().print();
}

return exitStatus;

} catch (Throwable e) {

System.out.println(AnsiColors.red("Error: " + e));
log.error("Running tests failed.", e);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public class AnsiTestExecutionListener implements ITestExecutionListener {
public static final int TEST_PADDING = 2;

@Override
public void testPlanExecutionStarted() {
public synchronized void testPlanExecutionStarted() {

start = System.currentTimeMillis();

}

@Override
public void testPlanExecutionFinished() {
public synchronized void testPlanExecutionFinished() {

end = System.currentTimeMillis();

Expand Down Expand Up @@ -75,7 +75,7 @@ public void testPlanExecutionFinished() {
}

@Override
public void testSuiteExecutionStarted(ITestSuite testSuite) {
public synchronized void testSuiteExecutionStarted(ITestSuite testSuite) {

System.out.println();
System.out.println(AnsiText.bold(testSuite.getName()));
Expand All @@ -84,7 +84,7 @@ public void testSuiteExecutionStarted(ITestSuite testSuite) {
}

@Override
public void testSuiteExecutionFinished(ITestSuite testSuite) {
public synchronized void testSuiteExecutionFinished(ITestSuite testSuite) {

if (!testSuite.hasSnapshotLoaded()) {
return;
Expand Down Expand Up @@ -129,7 +129,7 @@ public void testSuiteExecutionFinished(ITestSuite testSuite) {
}

@Override
public void executionSkipped(ITest test, String reason) {
public synchronized void executionSkipped(ITest test, String reason) {

}

Expand All @@ -144,7 +144,7 @@ public void executionStarted(ITest test) {
}

@Override
public void executionFinished(ITest test, TestExecutionResult result) {
public synchronized void executionFinished(ITest test, TestExecutionResult result) {

switch (result.getStatus()) {

Expand Down Expand Up @@ -174,12 +174,12 @@ public void executionFinished(ITest test, TestExecutionResult result) {

}

public int getCount() {
public synchronized int getCount() {
return count;
}

@Override
public void setDebug(boolean debug) {
public synchronized void setDebug(boolean debug) {
this.debug = debug;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,66 @@ public class GroupTestExecutionListener implements ITestExecutionListener {
private List<ITestExecutionListener> listeners = new Vector<ITestExecutionListener>();

@Override
public void testPlanExecutionStarted() {
public synchronized void testPlanExecutionStarted() {
for (ITestExecutionListener listener : listeners) {
listener.testPlanExecutionStarted();
}
}

@Override
public void testPlanExecutionFinished() throws Exception {
public synchronized void testPlanExecutionFinished() throws Exception {
for (ITestExecutionListener listener : listeners) {
listener.testPlanExecutionFinished();
}
}

@Override
public void testSuiteExecutionStarted(ITestSuite testSuite) {
public synchronized void testSuiteExecutionStarted(ITestSuite testSuite) {
for (ITestExecutionListener listener : listeners) {
listener.testSuiteExecutionStarted(testSuite);
}
}

@Override
public void testSuiteExecutionFinished(ITestSuite testSuite) {
public synchronized void testSuiteExecutionFinished(ITestSuite testSuite) {
for (ITestExecutionListener listener : listeners) {
listener.testSuiteExecutionFinished(testSuite);
}
}

@Override
public void executionSkipped(ITest test, String reason) {
public synchronized void executionSkipped(ITest test, String reason) {
for (ITestExecutionListener listener : listeners) {
listener.executionSkipped(test, reason);
}
}

@Override
public void executionStarted(ITest test) {
public synchronized void executionStarted(ITest test) {
for (ITestExecutionListener listener : listeners) {
listener.executionStarted(test);
}
}

@Override
public void executionFinished(ITest test, TestExecutionResult testExecutionResult) {
public synchronized void executionFinished(ITest test, TestExecutionResult testExecutionResult) {
for (ITestExecutionListener listener : listeners) {
listener.executionFinished(test, testExecutionResult);
}
}

@Override
public void setDebug(boolean debug) {
public synchronized void setDebug(boolean debug) {
for (ITestExecutionListener listener : listeners) {
listener.setDebug(debug);
}
}

public void addListener(ITestExecutionListener listener) {
public synchronized void addListener(ITestExecutionListener listener) {
listeners.add(listener);
}

public void removeListener(ITestExecutionListener listener) {
public synchronized void removeListener(ITestExecutionListener listener) {
listeners.remove(listener);
}

Expand Down
Loading
Loading