@Test public void reschedulesTestWhenTestFailsAndThenTestRunCrashes() { RetryListener retryListener = new RetryListener(pool, device, mockFailedTestScheduler, fakeDeviceTestFilesCleaner, fatalCrashedTestCaseEvent); mockery.checking(new Expectations() {{ oneOf(mockFailedTestScheduler).rescheduleTestExecution(fatalCrashedTestCaseEvent); }}); TestPipelineEmulator emulator = testPipelineEmulator() .withTestFailed("assert exception") .withTestRunFailed("fatal error") .build(); emulator.emulateFor(retryListener, fatalCrashedTest); }
private void rescheduleTestExecution() { if (failedTestScheduler.rescheduleTestExecution(runningTestCase)) { logger.info("Test " + runningTestCase.getTestFullName() + " enqueued again into pool:" + pool.getName()); removeFailureTraceFiles(runningTestCase); } else { logger.info("Test " + runningTestCase.getTestFullName() + " failed on device " + device.getSafeSerial() + " but retry is not allowed."); } }
RetryListener extends NoOpITestRunListener { private void rescheduleTestExecution() { if (failedTestScheduler.rescheduleTestExecution(runningTestCase)) { logger.info("Test " + runningTestCase.getTestFullName() + " enqueued again into pool:" + pool.getName()); removeFailureTraceFiles(runningTestCase); } else { logger.info("Test " + runningTestCase.getTestFullName() + " failed on device " + device.getSafeSerial() + " but retry is not allowed."); } } }
RetryListener extends NoOpITestRunListener { private void rescheduleTestExecution() { if (failedTestScheduler.rescheduleTestExecution(runningTestCase)) { logger.info("Test " + runningTestCase.getTestFullName() + " enqueued again into pool:" + pool.getName()); removeFailureTraceFiles(runningTestCase); } else { logger.info("Test " + runningTestCase.getTestFullName() + " failed on device " + device.getSafeSerial() + " but retry is not allowed."); } } RetryListener(Pool pool,
                         Device device,
                         FailedTestScheduler failedTestScheduler,
                         DeviceTestFilesCleaner deviceTestFilesCleaner,
                         @Nonnull TestCaseEvent runningTestCase); }
RetryListener extends NoOpITestRunListener { private void rescheduleTestExecution() { if (failedTestScheduler.rescheduleTestExecution(runningTestCase)) { logger.info("Test " + runningTestCase.getTestFullName() + " enqueued again into pool:" + pool.getName()); removeFailureTraceFiles(runningTestCase); } else { logger.info("Test " + runningTestCase.getTestFullName() + " failed on device " + device.getSafeSerial() + " but retry is not allowed."); } } RetryListener(Pool pool,
                         Device device,
                         FailedTestScheduler failedTestScheduler,
                         DeviceTestFilesCleaner deviceTestFilesCleaner,
                         @Nonnull TestCaseEvent runningTestCase); @Override void testStarted(TestIdentifier test); @Override void testFailed(TestIdentifier test, String trace); @Override void testRunFailed(String errorMessage); @Override void testRunEnded(long elapsedTime, Map<String, String> runMetrics); }
RetryListener extends NoOpITestRunListener { private void rescheduleTestExecution() { if (failedTestScheduler.rescheduleTestExecution(runningTestCase)) { logger.info("Test " + runningTestCase.getTestFullName() + " enqueued again into pool:" + pool.getName()); removeFailureTraceFiles(runningTestCase); } else { logger.info("Test " + runningTestCase.getTestFullName() + " failed on device " + device.getSafeSerial() + " but retry is not allowed."); } } RetryListener(Pool pool,
                         Device device,
                         FailedTestScheduler failedTestScheduler,
                         DeviceTestFilesCleaner deviceTestFilesCleaner,
                         @Nonnull TestCaseEvent runningTestCase); @Override void testStarted(TestIdentifier test); @Override void testFailed(TestIdentifier test, String trace); @Override void testRunFailed(String errorMessage); @Override void testRunEnded(long elapsedTime, Map<String, String> runMetrics);  }