Test parallelism with IntelliJ and TestNG

I am trying to run several TestNG tests in parallel, but do not have access to testng.xml since IntelliJ builds it on the fly. I tried adding parameters such as "parallel = methods" to the startup configuration, but that doesn't seem to make any difference.

How can I run TestNG in parallel with IntelliJ without having to create my own testng.xml file?

+6
source share
5 answers

You cannot set this with annotations. It must be configured in XML. You need to customize the XML template. In eclipse it will be windows -> preferences -> testNG Template XML File.

Use an XML file that has all of your parallel and regular functions, and when run as testNG, it replaces only the section, preserving the other settings.

+1
source

It looks like you can use the "JDK parameters" tab to specify "vm parameters" and then specify the following parameters: -parallel methods -threadcount 2

However, IntelliJ actually creates the XML file and then uses it when starting TestNG. This XML file has parallel = "none" inside it. As a result, the XML configuration wins and you donโ€™t get the parallelization you are looking for.

There seems to be no easy way to customize the contents of this XML file by default, at least in terms of parallelization options. You can just get stuck in creating XML sets yourself.

+1
source

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

0
source

I managed to run test methods in parallel, without specifying my own testng.xml test file for each test, adding "-parallel methods -threadcount 20 -dataproviderthreadcount 20" to the "Test runner params" field of the TestNG launch configuration.

0
source

Another option is to use the "Create TestNG XML" plugin . It instantly generates a testng.xml file, so you don't need to configure it. After installation, right-click on the name of your module and you will see the option โ€œCreate TestNG XMLโ€.

0
source

Source: https://habr.com/ru/post/950521/


All Articles