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:
- New - ⌘N (macOS) / Alt+Insert (Windows/Linux)
- Run test class - ⌃⇧R (macOS) / Ctrl+Shift+F10 (Windows/Linux)
- Inline variable or method ⌥⌘N (macOS) / Ctrl+Alt+N (Windows/Linux)
- Find action, use if you don't remember a keyboard shortcut. We used this for "rerun tests" - ⌘⇧A (macOS) / Ctrl+Shift+A (Windows/Linux)
- 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 - ⌥⏎ (macOS) / Alt+Enter (Windows/Linux)
- Load Gradle/Maven changes - ⌘⇧I (macOS) / Ctrl+Shift+O (Windows/Linux)
- Open Preferences/Settings dialog - ⌘, (macOS) / Ctrl+Alt+S (Windows/Linux)
There are links to more information on this tutorial's introduction.