src/test/java/test/thread/parallelization/ParallelByMethodsTestCase9Scenario1.java
//Verifies that the test method listener and execution events for a given test method all run in the same thread.
Verifies that the test method listener and execution events for a given test method all run in the same thread.
Verifies that the test method listener and execution events for a given test method all run in the same thread .
@Test
    public void verifyThatMethodLevelEventsRunInDifferentThreadsFromSuiteAndTestLevelEvents() {
        verifyEventThreadsSpawnedAfter(getAllSuiteListenerStartEventLogs().get(0).getThreadId(),
                testMethodLevelEventLogs, "All the thread IDs for the test method level events should be greater " +
                        "than the thread ID for the suite and test level events. The expectation is that since the " +
                        "suite and test level events are running sequentially, and all the test methods are running " +
                        "in parallel, new threads will be spawned after the thread executing the suite and test " +
                        "level events when new methods begin executing. Suite and test level events thread ID: " +
                        getAllSuiteListenerStartEventLogs().get(0).getThreadId() + ". Test method level event logs: " +
                        testMethodLevelEventLogs);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassBSixMethodsWithMethodOnMethodDependenciesSample.class,
                SUITE_A, SUITE_A_TEST_A);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassAThreeMethodsWithMethodOnMethodDependenciesSample.class,
                SUITE_A, SUITE_A_TEST_A);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassDThreeMethodsWithNoDepsSample.class, SUITE_A,
                SUITE_A_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassAFiveMethodsWithMethodOnMethodDependenciesSample.class,
                SUITE_A, SUITE_A_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassASixMethodsWithMethodOnMethodDependenciesSample.class,
                SUITE_A, SUITE_A_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassASevenMethodsWithMethodOnMethodDependenciesSample.class,
                SUITE_A, SUITE_A_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassAFiveMethodsWithIntraClassGroupDepsSample.class, SUITE_B,
                SUITE_B_TEST_A);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassAFiveMethodsWithInterClassGroupDepsSample.class, SUITE_B,
                SUITE_B_TEST_A);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassGThreeMethodsWithNoDepsSample.class, SUITE_B,
                SUITE_B_TEST_A);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassASevenMethodsWithIntraClassGroupDepsSample.class, SUITE_B,
                SUITE_B_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassAFourMethodsWithIntraClassGroupDepsSample.class, SUITE_B,
                SUITE_B_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassAThreeMethodsWithIntraAndInterClassGroupDepsSample.class,
                SUITE_B, SUITE_B_TEST_B);
        verifyEventsForTestMethodsRunInTheSameThread(TestClassASixMethodsWithIntraClassGroupDepsSample.class, SUITE_B,
                SUITE_B_TEST_B);
    }
@ Test public void verifyThatMethodLevelEventsRunInDifferentThreadsFromSuiteAndTestLevelEvents ( ) { verifyEventThreadsSpawnedAfter ( getAllSuiteListenerStartEventLogs ( ) . get ( 0 ) . getThreadId ( ) , testMethodLevelEventLogs , "All the thread IDs for the test method level events should be greater " + "than the thread ID for the suite and test level events. The expectation is that since the " + "suite and test level events are running sequentially, and all the test methods are running " + "in parallel, new threads will be spawned after the thread executing the suite and test " + "level events when new methods begin executing. Suite and test level events thread ID: " + getAllSuiteListenerStartEventLogs ( ) . get ( 0 ) . getThreadId ( ) + ". Test method level event logs: " + testMethodLevelEventLogs ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassBSixMethodsWithMethodOnMethodDependenciesSample . class , SUITE_A , SUITE_A_TEST_A ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassAThreeMethodsWithMethodOnMethodDependenciesSample . class , SUITE_A , SUITE_A_TEST_A ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassDThreeMethodsWithNoDepsSample . class , SUITE_A , SUITE_A_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassAFiveMethodsWithMethodOnMethodDependenciesSample . class , SUITE_A , SUITE_A_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassASixMethodsWithMethodOnMethodDependenciesSample . class , SUITE_A , SUITE_A_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassASevenMethodsWithMethodOnMethodDependenciesSample . class , SUITE_A , SUITE_A_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassAFiveMethodsWithIntraClassGroupDepsSample . class , SUITE_B , SUITE_B_TEST_A ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassAFiveMethodsWithInterClassGroupDepsSample . class , SUITE_B , SUITE_B_TEST_A ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassGThreeMethodsWithNoDepsSample . class , SUITE_B , SUITE_B_TEST_A ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassASevenMethodsWithIntraClassGroupDepsSample . class , SUITE_B , SUITE_B_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassAFourMethodsWithIntraClassGroupDepsSample . class , SUITE_B , SUITE_B_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassAThreeMethodsWithIntraAndInterClassGroupDepsSample . class , SUITE_B , SUITE_B_TEST_B ) ; verifyEventsForTestMethodsRunInTheSameThread ( TestClassASixMethodsWithIntraClassGroupDepsSample . class , SUITE_B , SUITE_B_TEST_B ) ; }
Verifies that the test method listener and execution events for a given test method all run in the same thread.
Verifies that the test method listener and execution events for a given test method all run in the same thread .