Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shortcut to run concrete test

I can run the whole Junit test using:

Shift + Alt + X, T

But how I can run a single test? Using the mouse I click on concrete method and Run As -> Junit test

anyone know shortcut for this case ?

Thanks

like image 251
chris Avatar asked Feb 25 '11 08:02

chris


2 Answers

Shift + Alt + X, T runs one test method if the caret is on the method name.

enter image description here

like image 78
Thomas Jung Avatar answered Oct 09 '22 09:10

Thomas Jung


I find the "Shift-Alt-X" gives me trouble sometimes, sometimes what I think is the last executed command is not always and sometimes I end up running something I did not mean to. Also when doing TDD you rerun the tests so often and sometimes want to rerun the test from one project for a while, then you are on to the next project and want to start running its tests. Or you might be focusing on a specific area and only want to run a single unit test few a while. In this case I find I would like to simply rerun my last tests often and I find "Shift-Alt-X" to be a bit cumbersome.

So what I do is "Windows" > "Preferences" then click "General" > "Keys". Sort the table by "Command" and scroll down until you find "Rerun JUnit Test - Failures First" and "Rerun JUnit Test". Click on one of those and set the "Binding" field to whatever keyboard shortcut you want to use. Personally I set "Rerun JUnit Test" to CTRL+F5 so that its similar to refreshing a browser (plus this give me the quick and easy save/rerun combo of hitting CTRL+S, then CTRL+F5).

like image 34
rwblackburn Avatar answered Oct 09 '22 08:10

rwblackburn