Creating the test

To create the unit test for your class, choose Test from the Navigate menu. Alternatively, you can use the Ctrl + Shift + T (PC) or cmd + Shift + T (Mac) keyboard shortcut. If the class you have open in the editor doesn't have any unit tests, the Create New Test dialog box will pop up asking you to create one as shown here:

Creating the test

Depending on the plugins installed, the Testing library list will differ. Select the desired library from the list. The libraries for JUnit and TestNG are shipped with IntelliJ IDEA. Unless you have the testing dependencies defined in your Maven build file, these libraries will not be included in the classpath ...

Get IntelliJ IDEA Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.