use of com.carrotsearch.randomizedtesting.RandomizedRunner in project randomizedtesting by randomizedtesting.
the class PrivateHooksPropagation method assertSameExecution.
private void assertSameExecution(Class<?> clazz) throws Exception {
new JUnitCore().run(Request.runner(new RandomizedRunner(clazz)));
List<String> order1 = new ArrayList<>(order);
order.clear();
String msg = "# RR order:\n" + order1;
Assertions.assertThat(order1).as(msg).containsOnly("super.beforeclass1", "sub.beforeclass1", "sub.beforeclass2", "super.before1", "sub.before1", "sub.before2", "super.testMethod1");
}
use of com.carrotsearch.randomizedtesting.RandomizedRunner in project randomizedtesting by randomizedtesting.
the class TestAnnotationInheritance method assertSameExecution.
private void assertSameExecution(Class<?> clazz) throws Exception {
order.clear();
runTests(clazz);
List<String> order1 = new ArrayList<>(order);
order.clear();
new JUnitCore().run(Request.runner(new RandomizedRunner(clazz)));
List<String> order2 = new ArrayList<>(order);
order.clear();
String msg = "# JUnit order:\n" + order1 + "\n" + "# RR order:\n" + order2;
Assertions.assertThat(order2).as(msg).isEqualTo(order1);
}
use of com.carrotsearch.randomizedtesting.RandomizedRunner in project randomizedtesting by randomizedtesting.
the class TestClassRules method assertSameExecution.
private void assertSameExecution(Class<?> clazz) throws Exception {
order.clear();
runTests(clazz);
List<String> order1 = new ArrayList<>(order);
order.clear();
new JUnitCore().run(Request.runner(new RandomizedRunner(clazz)));
List<String> order2 = new ArrayList<>(order);
order.clear();
Assert.assertEquals(order1, order2);
}
use of com.carrotsearch.randomizedtesting.RandomizedRunner in project randomizedtesting by randomizedtesting.
the class TestBeforeAfterMethodOrder method checkOrderFixedSeed.
@Test
public void checkOrderFixedSeed() throws Exception {
new JUnitCore().run(new RandomizedRunner(SubSubFixedSeed.class));
ArrayList<String> order = new ArrayList<String>(callOrder);
callOrder.clear();
new JUnitCore().run(new RandomizedRunner(SubSubFixedSeed.class));
assertEquals(order, callOrder);
}
use of com.carrotsearch.randomizedtesting.RandomizedRunner in project randomizedtesting by randomizedtesting.
the class TestBeforeAfterMethodOrder method checkOrder.
@Test
public void checkOrder() throws Exception {
// Normal JUnit.
checkTestsOutput(1, 0, 0, 0, SubSub.class);
ArrayList<String> junitOrder = new ArrayList<String>(callOrder);
callOrder.clear();
new JUnitCore().run(new RandomizedRunner(SubSub.class));
if (!callOrder.equals(junitOrder)) {
final int i = junitOrder.size();
final int j = callOrder.size();
System.out.println(String.format(Locale.ROOT, "%-30s | %-30s", "JUnit4", "RR"));
for (int k = 0; k < Math.max(i, j); k++) {
System.out.println(String.format(Locale.ROOT, "%-30s | %-30s", k < i ? junitOrder.get(k) : "--", k < j ? callOrder.get(k) : "--"));
}
Assert.fail("JUnit4 and RandomizedRunner differed.");
}
}
Aggregations