/** * @return true if all the methods have been run successfully */ private boolean haveBeenRunSuccessfully(ITestNGMethod testMethod, ITestNGMethod[] methods) { // Make sure the method has been run successfully for (ITestNGMethod method : methods) { Set<ITestResult> results = keepSameInstances(testMethod, m_notifier.getPassedTests(method)); Set<ITestResult> failedAndSkippedMethods = Sets.newHashSet(); failedAndSkippedMethods.addAll(m_notifier.getFailedTests(method)); failedAndSkippedMethods.addAll(m_notifier.getSkippedTests(method)); Set<ITestResult> failedresults = keepSameInstances(testMethod, failedAndSkippedMethods); // If failed results were returned on the same instance, then these tests didn't pass if (failedresults != null && failedresults.size() > 0) { return false; } for (ITestResult result : results) { if(!result.isSuccess()) { return false; } } } return true; }
private boolean failuresPresentInUpstreamDependency(ITestNGMethod testMethod, ITestNGMethod[] methods) { // Make sure the method has been run successfully for (ITestNGMethod method : methods) { Set<ITestResult> results = keepSameInstances(testMethod, m_notifier.getPassedTests(method)); Set<ITestResult> failedAndSkippedMethods = Sets.newHashSet(); Set<ITestResult> skippedAttempts = m_notifier.getSkippedTests(method); failedAndSkippedMethods.addAll(m_notifier.getFailedTests(method)); failedAndSkippedMethods.addAll(skippedAttempts); Set<ITestResult> failedresults = keepSameInstances(testMethod, failedAndSkippedMethods); boolean wasMethodRetried = !results.isEmpty() && !skippedAttempts.isEmpty(); if (!wasMethodRetried && !failedresults.isEmpty()) { // If failed results were returned on the same instance, then these tests didn't pass return true; } for (ITestResult result : results) { if (!result.isSuccess()) { return true; } } } return false; }