In this post we show common Spock Framework Maven/Gradle configurations ready to use in your projects and in the rest of the Spock Tutorial.
Spock Framework Mocks allow to easily test handling of unexpected behaviors and inspect thrown exceptions. See how to *throw and handle expected exceptions in unit tests!
Spock Framework Mock‘s are very easy to use. When mixed with Groovy closures they become even more powerful and allow us to look inside passed parameters. Learn how to mix both!
Problem: Spock Framework Mocks are powerful and very easy to use. Learn here how to use and interact with Mocks in your unit tests on these examples!
Problem: while loop is a basic construct in many programming languages. Bash also allows us to use it to iterate over many things. Learn here how!
Problem: When running a test with Gradle and trying to print to System.out or System.err nothing happens. How to make Gradle to display standard output?
Problem: How to run initialization code before and/or after class/specification in Spock Framework? As always, examples will clarify things out!
Problem: How to run some initialization code before and/or after each test case/feature in Spock Framework? The following examples will clarify things out!
Problem: You’ve got some very costly object to instantiate or it just doesn’t change through all the tests and just want to reuse it (for example DateTime object). Spock Framework allows to do it in an easy and readable way. Learn here how!
Problem: Spock Framework is powerful data-driven testing library. Its where block makes tests very concise, but sometimes when test fail how to quickly find out which dataset didn’t work?