Spock – Up and Running

Writing Expressive Tests in Java and Groovy

Paperback Engels 2017 1e druk 9781491923290
€ 68,94
Levertijd ± 16 werkdagen
Gratis verzonden

Samenvatting

Most developers would agree that writing automated tests is a good idea, but writing good, well-structured tests is still an elusive skill for many. For Java and Groovy developers, however, there’s good news. This practical guide shows you how to write concise and highly readable tests with Spock, the most innovative testing and specification framework for the JVM since JUnit.

Author Rob Fletcher takes you from Spock basics to advanced topics, using fully worked integration examples. Through the course of this book, you’ll build a simple web application—Squawker—that allows users to post short messages. You’ll discover how much easier it is to write automated tests with Spock’s straightforward and expressive language.

- Start by learning how to write simple unit tests
- Understand the lifecycle of Spock specifications and feature methods
- Dive into interaction testing, using Spock’s intuitive syntax for dealing with mocks and stubs
- Learn about parameterized tests—writing feature methods that run for multiple sets of data
- Move into advanced topics, such as writing idiomatic Spock code and driving parameterized tests with file or database input
- Learn how everything works together in a standalone, fully-worked, test-driven development example

Specificaties

ISBN13:9781491923290
Taal:Engels
Bindwijze:paperback
Aantal pagina's:349
Uitgever:O'Reilly
Druk:1
Verschijningsdatum:5-6-2017
Hoofdrubriek:IT-management / ICT

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

Preface

Part 1: Spock 101
1. The “Up and Running” Part
Installation
Running with the JUnit Runner
Running with Gradle
Running with Maven

2. Specification Basics
Anatomy of a Specification
An Introduction to Spock’s Blocks
The Specification Lifecycle
Block Descriptions
Summary

3. Spock Assertions
The Importance of Good Diagnostics
The Power Assert
Using Groovy for Effective Assertions
Expecting Exceptions
Grouping Assertions on the Same Object
Summary

4. Managing Resources
How (Not) to Approach Persistence Testing
Testing a Persistence Layer
Specifications and Inheritance
Summary

5. Interaction Testing
Asserting that a Method Is Called
Specifying Invocation Cardinality
Declaring the Return Value from a Mocked Method
Parameter Predicates
Disallowing Unexpected Calls or “Strict Mocking”
Looser Matching with Wildcard Parameters
Defining Behavior for Mocked Methods
Removing Invocation Constraints with Stubs
Summary

6. Parameterized Specifications
Paramaterization in JUnit
Spock’s where: block
Separating Iteration Reporting by Using @Unroll
Multiple Data Pipes
Data Tables
Fields and Methods as Data Providers
Derived Values
Summary
Advanced Spock

7. Idiomatic Spock
Organizing Tests
Well-Factored Specifications
The Grammar of Blocks
Method Parameter Capture with Mocks
@Stepwise Specifications
Conditional Specifications
Automatically Cleaning Up Resources
Documenting Specifications
Summary
Afgekapt op 62 regels

Managementboek Top 100

€ 68,94
Levertijd ongeveer 16 werkdagen
Gratis verzonden

Rubrieken

Producten

    Auteurs

      Trefwoorden

        Artikelen

          Spock – Up and Running