Shane Courtrille
Shane Courtrille

Reputation: 14097

Running unit tests from currently opened file in IntelliJ IDEA

Is there any way to have IntelliJ run the current MyTest.java file I'm looking at?

Thanks

Upvotes: 31

Views: 11068

Answers (2)

hvgotcodes
hvgotcodes

Reputation: 120188

Yeah, you can either:

  1. Right click on the file and go to

    Run 'MyTest'

  2. Use the key binding: if the caret is in a method on that method will be run
    • on a Mac: it's Control+Fn+Shift+F10
    • elsewhere: it's Alt+Shift+F10

Upvotes: 25

Amit Kotlovski
Amit Kotlovski

Reputation: 1908

Accepted answer did not work for me on a MacOS running Android Studio 2.1.13 .

After looking up the "Run Context Configuration" action mentioned by @ShawnFumo's comment, I found Ctrl + Shift + R which ended up working.

Upvotes: 9

Related Questions