Is there a short cut to create a test method quickly in IntelliJ? What I want to happen is if I already have a test class called TestClass, then in my Class file if I create a new method I could right click on the new method and click something like 'create test' on the method itself. There is an option available for the class but I can't see it for the method level. Take a look at this photo and you'll see that the option is available for the class(by pressing alt + enter), but I'd like it available for the method also.
UPDATE: It seems the option might be in IntelliJ but I cannot find this in Android Studio 1.1. When I hit alt+enter on a method in android studio (where the hosting class already has a test case) I get this menu:
and here is the funny thing in android studio, if I go into the test case class itself then I see an option to create test method within that class. It's just not showing up in the concrete class I need to be tested:
Right-click the test root folder or package in the test root folder in which you want to create a new test and select New | Java Class. Name the new class and press Enter . Press Alt+Insert and select Test Method to generate a new test method for this class. Name the new method and press Enter .
Press ⇧⌘T (macOS), or Ctrl+Shift+T (Windows/Linux), to create the new Test class (or navigate to an existing Test class).
Android Studio Ctrl+Shift+T or Navigate->Test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With