use of org.junit.experimental.ParallelComputer in project tutorials by eugenp.
the class Spring5JUnit5ParallelIntegrationTest method givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel.
@Test
void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() {
final Class<?>[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class };
JUnitCore.runClasses(new ParallelComputer(true, true), classes);
}
use of org.junit.experimental.ParallelComputer in project azure-iot-sdk-java by Azure.
the class LongHaulIT method runLongHaulTests.
@Test
public void runLongHaulTests() {
Class<?>[] classes = { LongHaulMessageTests.class };
JUnitCore.runClasses(new ParallelComputer(true, true), classes);
}
use of org.junit.experimental.ParallelComputer in project tutorials by eugenp.
the class ParallelIntegrationTest method runTestsInParallel.
@Test
public void runTestsInParallel() {
final Class<?>[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class };
JUnitCore.runClasses(new ParallelComputer(true, true), classes);
}
use of org.junit.experimental.ParallelComputer in project opennars by opennars.
the class NALTest method runTests.
public static double runTests(Class c) {
tests.clear();
scores.clear();
if (waitForEnterKeyOnStart) {
System.out.println("When ready, press enter");
try {
System.in.read();
} catch (IOException ex) {
}
}
// Result result = org.junit.runner.JUnitCore.runClasses(NALTest.class);
Result result = JUnitCore.runClasses(new ParallelComputer(true, true), c);
for (Failure f : result.getFailures()) {
String test = f.getMessage().substring(f.getMessage().indexOf("test/nal") + 8, f.getMessage().indexOf(".nal"));
tests.put(test, false);
}
int[] levelSuccess = new int[10];
int[] levelTotals = new int[10];
for (Map.Entry<String, Boolean> e : tests.entrySet()) {
String name = e.getKey();
int level = 0;
try {
level = Integer.parseInt(name.split("\\.")[0]);
} catch (NumberFormatException ne) {
}
levelTotals[level]++;
if (e.getValue()) {
levelSuccess[level]++;
}
}
double totalScore = 0;
for (Double d : scores.values()) totalScore += d;
if (showReport) {
int totalSucceeded = 0, total = 0;
for (int i = 0; i < 9; i++) {
float rate = (levelTotals[i] > 0) ? ((float) levelSuccess[i]) / levelTotals[i] : 0;
String prefix = (i > 0) ? ("NAL" + i) : "Other";
System.out.println(prefix + ": " + (rate * 100.0) + "% (" + levelSuccess[i] + "/" + levelTotals[i] + ")");
totalSucceeded += levelSuccess[i];
total += levelTotals[i];
}
System.out.println(totalSucceeded + " / " + total);
System.out.println("Score: " + totalScore);
}
return totalScore;
}
use of org.junit.experimental.ParallelComputer in project cucumber-jvm by cucumber.
the class CucumberTest method cucumber_can_run_features_in_parallel.
@Test
void cucumber_can_run_features_in_parallel() throws Exception {
RunNotifier notifier = new RunNotifier();
RunListener listener = Mockito.mock(RunListener.class);
notifier.addListener(listener);
ParallelComputer computer = new ParallelComputer(true, true);
Request.classes(computer, ValidEmpty.class).getRunner().run(notifier);
{
InOrder order = Mockito.inOrder(listener);
order.verify(listener).testStarted(argThat(new DescriptionMatcher("Followed by some examples #1(Feature A)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("Followed by some examples #1(Feature A)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("Followed by some examples #2(Feature A)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("Followed by some examples #2(Feature A)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("Followed by some examples #3(Feature A)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("Followed by some examples #3(Feature A)")));
}
{
InOrder order = Mockito.inOrder(listener);
order.verify(listener).testStarted(argThat(new DescriptionMatcher("A(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("A(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("B(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("B(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("C #1(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("C #1(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("C #2(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("C #2(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("C #3(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("C #3(Feature B)")));
}
}
Aggregations