Chapter 7. Integration and functional testing with Spock

This chapter covers

  • Understanding the categories of unit tests in an enterprise application
  • Writing integration tests for the Spring framework
  • Testing REST endpoints with Spock
  • Performing web-based tests with Spock and Geb
  • Using Spock as part of the build process

At this point in the book, you probably want to start writing Spock tests for your own application. If you’re a single developer or your application is fairly small and self-contained (for example, a standalone utility), then the previous chapters have covered the most important Spock features you’ll need. If, on the other hand, you’re part of a bigger team that works in large enterprise applications with an existing build infrastructure (automatic builds, test environments, code quality, and so on), you might be wondering how Spock fits the existing paradigm and practices already used in your organization.

In this chapter, you’ll see how Spock can be used for the full testing lifecycle of an enterprise application that includes multiple layers of testing procedures running either automatically (after each code change) or on demand as part of a release. Spock is suitable for both integration tests (which cover multiple classes/modules and don’t focus on a single class) and functional tests (which cover end-to-end functionality and view the whole system as a single entity instead of individual classes). Like the previous chapter, this one briefly covers the theory behind these types of tests.

Last but not least, a popular requirement for enterprise testing is examining web applications. You’ll see how Spock can be used in conjunction with Geb (www.gebish.org), another Groovy library that makes web testing easy.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.75.70