Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create test stub for a new method using IDEA?

Suppose you have a new Main class, with 2 methods a and b

Pressing Control-Shift-T allows us to create new test class and create stubs for both methods

enter image description here

Ok, now if i add 1 more method c, i'd like to add a test for it in already existing MainTest class

How can this be done please using IDEA? Control-Shift-T does not work as it attempts to create an already existing test class.

like image 720
James Raitsev Avatar asked Oct 07 '12 18:10

James Raitsev


3 Answers

This feature has now been added. CTRL+SHIFT+T | Meta+Shift+T

like image 80
Alan B. Dee Avatar answered Nov 13 '22 22:11

Alan B. Dee


in Idea 14.x you can press Alt+Enter on method names, if there are some missing tests, you can select option named "Generate missed test methods"

Generate missed test methods

like image 20
teymourlouie Avatar answered Nov 13 '22 23:11

teymourlouie


This feature is not implemented yet, please vote for the linked request.

like image 9
CrazyCoder Avatar answered Nov 14 '22 00:11

CrazyCoder