Shortcuts used

Finally, let's summarise the shortcuts we've learnt and see links to further information.

In this tutorial we saw how to use the Spock testing framework to test Java code. We also saw how IntelliJ IDEA can help us to write and run tests.

Spock is powerful and has even more to offer than we've looked at here. We've only touched the surface of what Spock can offer. We've seen the basics of a test, we've seen how to use labels to define tests, we've seen the power of data driven testing, and we've covered a range of tips and tricks for writing correct and readable tests.

If you want to find out more about Spock, take a look at the excellent reference documentation.

Here are some helpful shortcuts mentioned in the tutorial and video:

NamemacOS ShortcutWindows Shortcut
New⌘NAlt+Insert
- use in the project window to create a new file or directory
- use inside a test class to generate a new test method
- use inside the build.gradle or pom.xml file to add a new dependency
Run test class⌃RShift+F10
Inline variable or method⌘⌥NCtrl+Alt+N
Clone caret above or below twice without releasing it, then press the Up or Down arrow keysCtrl twice without releasing it, then press the Up or Down arrow keys
Find action, use if you don't remember a keyboard shortcut. We used this for "rerun tests"⌘⇧ACtrl+Shift+A
Context suggestions. IntelliJ IDEA suggests ways to fix or change the code at the caret. In our case, we used this to generate methods when we called a method that didn't exist yet.⌥⏎Alt+Enter
Load Gradle/Maven changes⇧⌘ICtrl+Shift+O
Open Preferences/Settings dialog⌘,Ctrl+Alt+S

There are links to more information on this tutorial's introduction.