private void onTestFinished(ITestResult iTestResult, TestResult.ResultType resultType) { Object testId; TestStartEvent startEvent = null; synchronized (lock) { testId = tests.remove(iTestResult); if (testId == null) { // This can happen when a method fails which this method depends on testId = idGenerator.generateId(); Object parentId = testMethodToSuiteMapping.get(iTestResult.getMethod()); startEvent = new TestStartEvent(iTestResult.getStartMillis(), parentId); } } if (startEvent != null) { // Synthesize a start event resultProcessor.started( new DefaultTestMethodDescriptor( testId, iTestResult.getTestClass().getName(), iTestResult.getName()), startEvent); } if (resultType == TestResult.ResultType.FAILURE) { resultProcessor.failure(testId, iTestResult.getThrowable()); } resultProcessor.completed( testId, new TestCompleteEvent(iTestResult.getEndMillis(), resultType)); }
public void onConfigurationFailure(ITestResult testResult) { // Synthesise a test for the broken configuration method TestDescriptorInternal test = new DefaultTestMethodDescriptor( idGenerator.generateId(), testResult.getMethod().getTestClass().getName(), testResult.getMethod().getMethodName()); resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis())); resultProcessor.failure(test.getId(), testResult.getThrowable()); resultProcessor.completed( test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE)); }
public void onConfigurationFailure(ITestResult testResult) { if (failedConfigurations.put(testResult, true) != null) { // workaround for bug in TestNG 6.2 (apparently fixed in some 6.3.x): listener is notified // twice per event return; } // Synthesise a test for the broken configuration method TestDescriptorInternal test = new DefaultTestMethodDescriptor( idGenerator.generateId(), testResult.getMethod().getTestClass().getName(), testResult.getMethod().getMethodName()); resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis())); resultProcessor.failure(test.getId(), testResult.getThrowable()); resultProcessor.completed( test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE)); }