Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij running one test in TestNG

So my typical workflow is

  1. I write a data driven test using TestNG in IntelliJ.
  2. I supply hundreds of data items
  3. Run the test and one or two of them fail
  4. I see the list of passed/failed tests in the "Run" pane.

I would like the ability to just right click that "instance" of the test and run that test alone (with breakpoints). Currently IntelliJ does not seem to have that feature. I would have to right click the test and when I run, it runs the whole set of tests with hundreds of data points.

Is this possible?

like image 391
Kannan Ekanath Avatar asked Nov 04 '22 14:11

Kannan Ekanath


1 Answers

TestNG supports this at the testng.xml level, where you can specify which indices of your data provider should be used. It's called "invocation-numbers" and you can see what it looks like by running a test with a data provider, failing some of its invocation numbers and looking at the testng-failed.xml that gets generated.

Back to your question: your IDE needs to support this feature in order to make it available in the UI, so I suggest you ask on the IDEA forums

like image 78
Cedric Beust Avatar answered Nov 08 '22 15:11

Cedric Beust