Test parallelism with IntelliJ and TestNG

后端 未结 5 1945
深忆病人
深忆病人 2021-02-08 16:12

I\'m attempting to run some TestNG tests in parallel but don\'t have access to a testng.xml as IntelliJ builds it on the fly. I\'ve tried adding parameters such as \'parallel=m

相关标签:
5条回答
  • 2021-02-08 16:32

    Another option is to use a 'Create TestNG XML' plugin. It instantly generates a testng.xml file so you don't have to customise one. Once installed, right click on your module name and you will see the 'Create TestNG XML' option.

    0 讨论(0)
  • 2021-02-08 16:34

    You can't set this up with annotations. It must be configured in the XML. You need to set up an XML template. In eclipse it would be windows -> preferences -> testNG Template XML File.

    Use an XML file that has all your parallel and usual optins and when you run as testNG it will replace only the section, while maintaining your other settings.

    0 讨论(0)
  • 2021-02-08 16:36

    The best option for Intellij IDEA is to create additional testng.xml or you may run test from command line.

    0 讨论(0)
  • 2021-02-08 16:46

    I managed to get test methods to run in parallel without defining a custom testng.xml for each test by adding "-parallel methods -threadcount 20 -dataproviderthreadcount 20" in the "Test runner params" field of a TestNG run configuration.

    0 讨论(0)
  • 2021-02-08 16:50

    It appears that you would be able to use the JDK Settings tab to specify "vm parameters", and then specify the parameters like so: -parallel methods -threadcount 2

    However, IntelliJ actually creates an XML file and then uses that when running TestNG. That XML file has parallel="none" inside of it. As a result, the XML configuration 'wins' and you do not get the parallelization you are looking for.

    There doesn't appear to be an easy way to adjust the contents of that default XML file, at least in terms of the parallelization options. You may just be stuck with creating XML suites yourself.

    0 讨论(0)
提交回复
热议问题