[testng] 99/355: Invoker: minor improvement

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:19:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit 4bad7e615c0a2e18218160a98521a8d015046a1d
Author: Vladislav Rassokhin <vladrassokhin at gmail.com>
Date:   Sun Nov 23 02:19:34 2014 +0300

    Invoker: minor improvement
---
 src/main/java/org/testng/internal/Invoker.java | 60 +++++++++++++-------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/src/main/java/org/testng/internal/Invoker.java b/src/main/java/org/testng/internal/Invoker.java
index b3732d7..625dfc6 100644
--- a/src/main/java/org/testng/internal/Invoker.java
+++ b/src/main/java/org/testng/internal/Invoker.java
@@ -1092,7 +1092,35 @@ public class Invoker implements IInvoker {
     ITestClass testClass= testMethod.getTestClass();
     long start = System.currentTimeMillis();
 
-    // For invocationCount > 1 and threadPoolSize > 1 the method will be invoked on a thread pool
+    String okToProceed = checkDependencies(testMethod, testContext.getAllTestMethods());
+
+    if (okToProceed != null) {
+      //
+      // Not okToProceed. Test is being skipped
+      //
+      ITestResult testResult = new TestResult(testClass, null /* instance */,
+          testMethod,
+          null /* cause */,
+          start,
+          System.currentTimeMillis(),
+          m_testContext);
+      testResult.setThrowable(new Throwable(okToProceed));
+      testResult.setStatus(ITestResult.SKIP);
+      result.add(testResult);
+      m_notifier.addSkippedTest(testMethod, testResult);
+      runTestListeners(testResult);
+      return result;
+    }
+
+
+    final Map<String, String> parameters =
+        testMethod.findMethodParameters(testContext.getCurrentXmlTest());
+
+    // For invocationCount > 1 and threadPoolSize > 1 run this method in its own pool thread.
+    if (testMethod.getInvocationCount() > 1 && testMethod.getThreadPoolSize() > 1) {
+      return invokePooledTestMethods(testMethod, suite, parameters, groupMethods, testContext);
+    }
+
     long timeOutInvocationCount = testMethod.getInvocationTimeOut();
     //FIXME: Is this correct?
     boolean onlyOne = testMethod.getThreadPoolSize() > 1 ||
@@ -1104,34 +1132,8 @@ public class Invoker implements IInvoker {
         MethodHelper.findExpectedExceptions(m_annotationFinder, testMethod.getMethod());
     final FailureContext failure = new FailureContext();
     while(invocationCount-- > 0) {
-      String okToProceed = checkDependencies(testMethod, testContext.getAllTestMethods());
-
-      if (okToProceed != null) {
-        //
-        // Not okToProceed. Test is being skipped
-        //
-        ITestResult testResult = new TestResult(testClass, null /* instance */,
-                                               testMethod,
-                                               null /* cause */,
-                                               start,
-                                               System.currentTimeMillis(),
-                                               m_testContext);
-        testResult.setThrowable(new Throwable(okToProceed));
-        testResult.setStatus(ITestResult.SKIP);
-        result.add(testResult);
-        m_notifier.addSkippedTest(testMethod, testResult);
-        runTestListeners(testResult);
-        return result;
-      }
-
-      //
-      // If threadPoolSize specified, run this method in its own pool thread.
-      //
-      Map<String, String> parameters =
-          testMethod.findMethodParameters(testContext.getCurrentXmlTest());
-      if (testMethod.getThreadPoolSize() > 1 && testMethod.getInvocationCount() > 1) {
-          return invokePooledTestMethods(testMethod, suite,
-              parameters, groupMethods, testContext);
+      if(false) {
+        // Prevent code formatting
       }
       //
       // No threads, regular invocation

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list