- In the editor, place the caret at the class declaration, or somewhere within a method.
- Do one of the following:
- On the main menu or on the context menu, choose .
- Press Ctrl+Shift+TCtrl+Shift+TCtrl+Shift+TCtrl+Shift+TCtrl+Shift+TCtrl+Shift+TCtrl+Shift+TCtrl+Shift+TShift Command TShift Command TShift Command T.
PyCharm shows the list of available tests.
- If the desired test doesn't yet exist, click the Create new test option:
The Create Test dialog box opens.
- In the Create Test dialog box, specify the following settings:
- Target directory, where the new test class will be generated.
- The name of the test file, and the name of the test class.
- Select the check boxes next to the methods you want to include in the test class.
Note that if the caret has been placed within a method, only this method name is included in the list.
- Click OK when ready. PyCharm generates the test file in the specified location.