0

This question shows how to run a TestNG suite programmatically without an XML file.

However, when I run it from IDEA it just runs as a main method and the output is not in the test window, whereas the JUnit example in the question does appear in the test window.

How can I configure a TestNG test suite from a Java class and have IDEA/Eclipse output the results in the test window?

Community
  • 1
  • 1
opticyclic
  • 7,412
  • 12
  • 81
  • 155

1 Answers1

1

You can't because IDEA uses its own TestNG listeners which are not available easily.

A potential option would be to create your own IDEA plugin based on the TestNG one.

About Eclipse, you can ask for the feature but I don't know if it will be accepted.

juherr
  • 5,640
  • 1
  • 21
  • 63
  • What about annotating tests with groups then creating a test class with dependsOnGroups? – opticyclic Feb 27 '17 at 20:21
  • In fact, you need a standard test as IntelliJ runner. The runner may run another TestNG instance (what you are already able to do). But you must attach IDEA listeners to the new TestNG instance which is not possible IMO (using new instances of IDEA listeners may work). – juherr Feb 28 '17 at 10:16