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

Support parallel execution with surefire and failsafe #154

Open
wants to merge 6 commits into
base: master
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class TestLogWriter {
* </pre>
* in the log message)
*/
public void log(int logLevel, int indent, String message, Object... params) {
public synchronized void log(int logLevel, int indent, String message, Object... params) {
switch (logLevel) {
case LogLevel.OFF:
break;
Expand Down Expand Up @@ -84,7 +84,7 @@ private void logAtError(int indent, String message, Object... params) {

// indent the log message based on the indent-level
private String indentMessage(int level, String message) {
StringBuilder strBuilder = new StringBuilder();
StringBuilder strBuilder = new StringBuilder(Thread.currentThread().getId() + " ");
for (int i = 0; i < level; i++) {
if (i < LOG_PREFIX.length) {
strBuilder.append(LOG_PREFIX[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
Expand All @@ -12,7 +13,7 @@ public class TestDataObjectRegistry {

private static final Logger LOG = LoggerFactory.getLogger(TestDataObjectRegistry.class);

private BiMap<String, Class<?>> registry = HashBiMap.create();
private BiMap<String, Class<?>> registry = Maps.synchronizedBiMap(HashBiMap.create());

public void register(Class<?> type, String name) {
// keys must be unique in both directions
Expand Down
24 changes: 24 additions & 0 deletions justtestlah-demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,27 @@
<groupId>qa.justtestlah</groupId>
<artifactId>justtestlah-core</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>qa.justtestlah</groupId>
<artifactId>justtestlah-visual</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>qa.justtestlah</groupId>
Expand Down Expand Up @@ -83,6 +99,14 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>methods</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
</plugin>
<plugin>
<groupId>com.trivago.rta</groupId>
<artifactId>cluecumber-report-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion justtestlah-demos/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<appender name="testlog" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%magenta(%d{HH:mm:ss.SSS} %msg) %n</pattern>
<pattern>%t %magenta(%d{HH:mm:ss.SSS} %msg) %n</pattern>
</encoder>
</appender>

Expand Down