Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1398

TestNG test fails when both JUnitCore provider and TestNG provider are on classpath

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments



      When both JUnitCore and TestNG providers are on classpath:


      then the TestNG execution fails with a message:

      Configuring TestNG with: TestNG60Configurator
      Cannot use a threadCount parameter less than 1; 1 > 0
      Usage: <main class> [options] The XML suite files to run
             Configuration failure policy (skip or continue)
             Output directory
             Number of threads to use when running data providers
             Comma-separated list of group names to  exclude
             Comma-separated list of group names to be run
             JUnit mode
             Default: false
             List of .class files or list of class names implementing ITestListener or
             Comma separated of test methods
             Default: []
             List of .class files or list of class names implementing IMethodSelector
             Mixed mode - autodetect the type of current test and run it with
             appropriate runner
             Default: false
             List of .class files or list of class names implementing
             Parallel mode (methods, tests or classes)
             Possible Values: [tests, methods, classes, instances, none, true, false]
             The port
             Extended configuration for custom report listener
             Default name of test suite, if not specified in suite definition file or
             source code
             Size of the thread pool to use to run suites
             Default: 1
             The list of test classes
             A jar file containing the tests
             Default name of test, if not specified in suitedefinition file or source
             The list of test names to run
          -testrunfactory, -testRunFactory
             The factory used to create tests
             Number of threads to use when running tests in parallel
             Whether to use the default listeners
             Default: true
          -log, -verbose
             Level of verbosity
             The full path to the xml file inside the jar file (only valid if -testjar
             was specified)
             Default: testng.xml

      The same behavior occurs when instead of these two providers I use my own dynamic provider and delegate the execution to the TestNG provider.

      The cause of the behavior is a combination of the method convertJunitCoreParameters() and the TestNG provider.
      The method is called for JunitCoreProvider and sets the thread count to the current value (no matter if it is set or not). In case that it is not set, then the value is 0, which causes the before mentioned failure when TestNGProvider is being executed.
      The same in case of DynamicProvider
      In the description of the parameter threadCount, there is written that it only makes sense to use in conjunction with the parallel parameter. So, I would propose to set the parameter only when the parameter parallel is set.



          This comment will be Viewable by All Users Viewable by All Users


            sjaranowski Slawomir Jaranowski
            mjobanek Matous Jobanek
            1 Vote for this issue
            4 Start watching this issue




                Issue deployment