org.junit.experimental.ParallelComputer Java Examples
The following examples show how to use
org.junit.experimental.ParallelComputer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringJUnit4ConcurrencyTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void runAllTestsConcurrently() throws Exception { final int FAILED = 0; final int ABORTED = 0; final int IGNORED = countAnnotatedMethods(Ignore.class); final int TESTS = countAnnotatedMethods(Test.class) - IGNORED; runTestsAndAssertCounters(new ParallelComputer(true, true), TESTS, FAILED, TESTS, IGNORED, ABORTED, this.testClasses); }
Example #2
Source File: SpringJUnit4ConcurrencyTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void runAllTestsConcurrently() throws Exception { final int FAILED = 0; final int ABORTED = 0; final int IGNORED = countAnnotatedMethods(Ignore.class); final int TESTS = countAnnotatedMethods(Test.class) - IGNORED; runTestsAndAssertCounters(new ParallelComputer(true, true), TESTS, FAILED, TESTS, IGNORED, ABORTED, this.testClasses); }
Example #3
Source File: RunParallelTest.java From samples with MIT License | 5 votes |
@Test public void parallelTest() { Class[] cls = { TestRunner_android_web.class, TestRunner_ios_web.class, TestRunner_android_app.class, TestRunner_ios_app.class}; // Parallel among classes JUnitCore.runClasses(ParallelComputer.classes(), cls); // Parallel all methods in all classes JUnitCore.runClasses(new ParallelComputer(true, true), cls); }
Example #4
Source File: StabilityTest.java From opennars with MIT License | 4 votes |
public static double runTests(final Class c) { tests.clear(); scores.clear(); if (waitForEnterKeyOnStart) { System.out.println("When ready, press enter"); try { System.in.read(); } catch (final IOException ex) { throw new IllegalStateException("Could not read user input.", ex); } } //Result result = org.junit.runner.JUnitCore.runClasses(NALTest.class); final Result result = JUnitCore.runClasses(new ParallelComputer(true, true), c); for (final Failure f : result.getFailures()) { final String test = f.getMessage().substring(f.getMessage().indexOf("/nal/single_step") + 8, f.getMessage().indexOf(".nal")); tests.put(test, false); } final int[] levelSuccess = new int[10]; final int[] levelTotals = new int[10]; for (final Map.Entry<String, Boolean> e : tests.entrySet()) { final String name = e.getKey(); int level = 0; level = Integer.parseInt(name.split("\\.")[0]); levelTotals[level]++; if (e.getValue()) { levelSuccess[level]++; } } double totalScore = 0; for (final Double d : scores.values()) totalScore += d; if (showReport) { int totalSucceeded = 0, total = 0; for (int i = 0; i < 9; i++) { final float rate = (levelTotals[i] > 0) ? ((float)levelSuccess[i]) / levelTotals[i] : 0; final 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; }
Example #5
Source File: NALTest.java From opennars with MIT License | 4 votes |
public static void runTests(final Class c) { tests.clear(); scores.clear(); final Result result = JUnitCore.runClasses(new ParallelComputer(true, true), c); for (final Failure f : result.getFailures()) { final String test = f.getMessage().substring(f.getMessage().indexOf("/nal/single_step") + 8, f.getMessage().indexOf(".nal")); tests.put(test, false); } /* commented because name.split() is broken for a special case in NalTestMetrics final int[] levelSuccess = new int[10]; final int[] levelTotals = new int[10]; for (final Map.Entry<String, Boolean> e : tests.entrySet()) { final String name = e.getKey(); int level = 0; level = Integer.parseInt(name.split("\\.")[0]); levelTotals[level]++; if (e.getValue()) { levelSuccess[level]++; } } if (showReport) { int totalSucceeded = 0, total = 0; for (int i = 0; i < 9; i++) { final float rate = (levelTotals[i] > 0) ? ((float)levelSuccess[i]) / levelTotals[i] : 0; final 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); } */ }
Example #6
Source File: ParallelIntegrationTest.java From tutorials with MIT License | 4 votes |
@Test public void runTestsInParallel() { final Class<?>[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; JUnitCore.runClasses(new ParallelComputer(true, true), classes); }
Example #7
Source File: Spring5JUnit5ParallelIntegrationTest.java From tutorials with MIT License | 4 votes |
@Test void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() { final Class<?>[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; JUnitCore.runClasses(new ParallelComputer(true, true), classes); }