Search in sources :

Example 6 with RandomizedRunner

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);
}
Also used : RandomizedRunner(com.carrotsearch.randomizedtesting.RandomizedRunner) JUnitCore(org.junit.runner.JUnitCore) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 7 with RandomizedRunner

use of com.carrotsearch.randomizedtesting.RandomizedRunner in project randomizedtesting by randomizedtesting.

the class JUnitAnnotationPropagation method assertSameExecution.

private void assertSameExecution(Class<?> clazz) throws Exception {
    order.clear();
    WithNestedTestClass.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;
    // Don't care about relative ordering of hook methods.
    Assertions.assertThat(noNumbers(order2)).as(msg).isEqualTo(noNumbers(order1));
    // But do care that all methods show up.
    Collections.sort(order1);
    Collections.sort(order2);
    Assertions.assertThat(order2).as(msg).isEqualTo(order1);
}
Also used : RandomizedRunner(com.carrotsearch.randomizedtesting.RandomizedRunner) JUnitCore(org.junit.runner.JUnitCore) ArrayList(java.util.ArrayList)

Aggregations

RandomizedRunner (com.carrotsearch.randomizedtesting.RandomizedRunner)7 JUnitCore (org.junit.runner.JUnitCore)7 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)3