Creating Tests
You can create test classes for the supported testing frameworks using the intention action.
- Open the necessary class in the editor and place the cursor on a class name.
- Press Alt+Enter to invoke the list of available intention actions.
- Select Create Test.
Alternatively, you can place the cursor on the class name and select Navigate | Test from the main menu, or select Go to | Test from the shortcut menu, and click Create New Test.
- In the Create Test dialog, configure the required settings. You can specify a testing library you want to use, configure a test class name and its location, and select methods for which you want to generate test classes.
Configure naming pattern for generated test classes
By default, IntelliJ IDEA attaches the Test
suffix to source class names when it automatically generates test classes. You can change the naming pattern for test classes in the dialog on the Code Generation tab.
In the Naming section of the tab, type a suffix or a prefix (or both) that you want to use for naming generated test classes into the corresponding fields.