-
Intellij Test case, Test method 단축키IntelliJ,Eclipse 2019. 5. 1. 06:10
클래스명에 마우스 위치후 alt + enter ==> Test Case 생성
Test Case 소스 상에서 alt + insert ==> Test Method 생성
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.
Create test methods #
To create stub test methods in JUnit test classes, you can use the IntelliJ IDEA code generation feature.
To create a test class with a complete set of test methods and fixtures, use the Create Test intention action.
-
Open the corresponding JUnit test class in the editor.
-
Place the cursor where you want a new test method to be generated.
-
Press Alt+Insert and select Test Method from the Generate menu.
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 Settings/Preferences (Ctrl+Alt+S, go to Editor | Code Style | Java, and open 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.
Last modified: 23 April 2019
'IntelliJ,Eclipse' 카테고리의 다른 글
Intellij에 Devtools 기능활성화(auto restart, live reload) (0) 2019.07.27 웹프로그램 배포방법(Intellij, Eclipse) (0) 2019.06.05 IntelliJ 함수가 한줄로 표시되는 문제, One-line methods (0) 2019.04.25 Intellij java: package org.apache.log4j does not exist (0) 2019.04.09 IntelliJ에서 Spring MVC (Maven) 생성 (0) 2019.04.09 -