Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG with IntelliJ IDEA: How to use the testng.xml file in IntelliJ IDEA 9

I'm able to run TestNG unit tests in IntelliJ and see the pass/fail output in a window; this is without using any testng.xml file. I can also run the tests in the command-line using maven, i.e. mvn clean test -Dgroups=fast, and that works fine.

I've created a testng.xml file and added it to my project's directory, but it doesn't seem to have any effect.

How do I integrate the usage of a testng.xml file to define my test execution within IntelliJ IDEA 9?

like image 660
kemeryqa Avatar asked Jun 06 '13 19:06

kemeryqa


People also ask

How do I open an XML file in IntelliJ?

Import XML namespacesPress Alt+Enter . If there are multiple choices, select the desired namespace from the list. Alternatively, hover your mouse pointer over the problem and click Create namespace declaration in the popup that opens. If there are multiple choices, select the desired namespace from the list.

How add TestNG jar to IntelliJ?

Go to the dependencies tab. Click the "+" sign to add a new dependency and then select "JARs or directories". Write the path where you downloaded the jar file or navigate directly through the GUI and click Okay. Select Okay in the returning panel, and you will have your TestNG installed in IntelliJ.


1 Answers

Follow the below steps:

  • Goto Intellij IDEA preferences ain search (command+,)
  • Search for plugins
  • Click on Marketplace
  • Search for testng
  • Install the plugin "Create TestNG XML" and Apply the changes
  • Restart Intellij
  • Right on your project and click on "Create TestNG XML"
  • Click OK on the confirmation dialog.
  • Expand the project folder and Voila, testng.xml will be created.
like image 59
md.yusuf ansari Avatar answered Sep 20 '22 05:09

md.yusuf ansari