Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running single test with TestNG in Intellij IDEA

How do you guys run single tests with IDEA's TestNG plugin? I tried creating a focus group, but it seems the TestNG plugin does not resolve dependencies to other tests automatically. Even when I comment out dependsOnMethods, it seems @BeforeMethod is not run.

Advice is greatly appreciated,

Robin

like image 211
rweng Avatar asked Nov 17 '11 06:11

rweng


People also ask

How do I run a single test case in IntelliJ?

Rerun a single test Right-click a test on the Test Runner tab of the Run tool window and select Run 'test name'.

How do I run TestNG test cases in IntelliJ?

Run a test suite To be able to run a TestNG test suite, create a run configuration for this suite: From the main menu, select Run | Edit Configurations. and from the list that opens, select TestNG. Name the new configuration.

Is there a TestNG plugin for IntelliJ?

The plugin is free and can be downloaded and installed using IntelliJ IDEA Plugin Manager. The plugin is available for both IntelliJ IDEA 5.


2 Answers

If you mean a single test method inside a test class there is a right-click option called Run "testMethod" where testMethod is the actual method name.

The short cut is ctrl+shift+F10.

If you put the cursor between methods (even outside the javadoc) or outside the entire class it will test all methods in that file.

like image 133
Andreas Wederbrand Avatar answered Oct 20 '22 00:10

Andreas Wederbrand


Bring the class into focus in the editor, and then simply right-click, select run?

like image 22
d33j Avatar answered Oct 19 '22 22:10

d33j