Spock: Up and Running. Writing Expressive Tests in Java and Groovy
![Język publikacji: angielski Język publikacji: angielski](https://static01.helion.com.pl/global/flagi/1.png)
- Autor:
- Rob Fletcher
![Spock: Up and Running. Writing Expressive Tests in Java and Groovy Rob Fletcher - okładka ebooka](https://static01.helion.com.pl/global/okladki/326x466/e_0iwc.png)
![Spock: Up and Running. Writing Expressive Tests in Java and Groovy Rob Fletcher - tył okładki ebooka](https://static01.helion.com.pl/global/okladki-tyl/326x466/e_0iwc.png)
- Ocena:
- Bądź pierwszym, który oceni tę książkę
- Stron:
- 372
- Dostępne formaty:
-
ePubMobi
Opis ebooka: Spock: Up and Running. Writing Expressive Tests in Java and Groovy
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
Wybrane bestsellery
-
This course offers an in-depth introduction to Java and algorithmic thinking, ideal for beginners. Starting with fundamental computer concepts, it progresses through Java programming basics, & algorithmic principles, concluding with file management.
Java and Algorithmic Thinking for the Complete Beginner. From Basics to Advanced Techniques: Master Java and Algorithms for a Robust Programming Foundation Java and Algorithmic Thinking for the Complete Beginner. From Basics to Advanced Techniques: Master Java and Algorithms for a Robust Programming Foundation
-
Książka Java. Teoria w praktyce została pomyślana tak, by krok po kroku przybliżać specyfikę tego języka programowania. Zaczniesz od podstaw - poznasz między innymi główne założenia, zgodnie z którymi działa Java: maszynę wirtualną, zmienne, operatory, instrukcje sterujące i tablice - by następni...(76.30 zł najniższa cena z 30 dni)
70.85 zł
109.00 zł(-35%) -
Architect robust solutions like a pro with real-world insights and cutting-edge design techniques. Delve into advanced analytics, machine learning, generative AI, cloud-native architecture, and the key soft skills to excel as a solutions architect.
Solutions Architect's Handbook. Kick-start your career with architecture design principles, strategies, and generative AI techniques - Third Edition Solutions Architect's Handbook. Kick-start your career with architecture design principles, strategies, and generative AI techniques - Third Edition
Saurabh Shrivastava, Neelanjali Srivastav, Rajesh Sheth, Kamal Arora, Rohan Karmarkar
-
To dziewiąte wydanie znakomitego podręcznika programowania dla początkujących, starannie zaktualizowane i uzupełnione o informacje dotyczące Java Platform, Standard Edition 17. Książka rozpoczyna się od solidnej dawki wiedzy o kompilacji i uruchamianiu programu w Javie, słowach kluczowych i istot...(77.40 zł najniższa cena z 30 dni)
83.85 zł
129.00 zł(-35%) -
Dzięki tej książce zrozumiesz bazowe koncepcje programowania funkcyjnego i przekonasz się, że możesz włączać je do kodu bez rezygnacji z paradygmatu obiektowego. Dowiesz się również, kiedy w swojej codziennej pracy używać takich opcji jak niemutowalność i funkcje czyste i dlaczego warto to robić....
Java. Podejście funkcyjne. Rozszerzanie obiektowego kodu Javy o zasady programowania funkcyjnego Java. Podejście funkcyjne. Rozszerzanie obiektowego kodu Javy o zasady programowania funkcyjnego
(52.20 zł najniższa cena z 30 dni)56.55 zł
87.00 zł(-35%) -
Build Your Own Programming Language provides a hands-on approach to designing and implementing programming language features in a simple compiler and programming environment. This book will help you create new or domain-specific languages.
Build Your Own Programming Language. A programmer's guide to designing compilers, interpreters, and DSLs for modern computing problems - Second Edition Build Your Own Programming Language. A programmer's guide to designing compilers, interpreters, and DSLs for modern computing problems - Second Edition
-
Java. Podręcznik na start to pozycja idealna dla każdego, kto chce podjąć takie kroki. W przystępny sposób zaznajamia nie tylko z językiem, ale też z podstawowymi koncepcjami stosowanymi podczas programowania - w obrazowy sposób przyrównuje je do sytuacji znanych spoza świata wirtualnego. Autor n...(41.40 zł najniższa cena z 30 dni)
44.85 zł
69.00 zł(-35%) -
Java należy do najpopularniejszych języków programowania na świecie. Używana przez miliony programistów, jest na tyle uniwersalna, że znajduje zastosowanie zarówno w aplikacjach desktopowych, mobilnych, jak i serwerowych, a także w zaawansowanych systemach zarządzania bazami danych. Z jej zalet k...
Java 21. Kurs video. Od "Hello World!" do programowania obiektowego Java 21. Kurs video. Od "Hello World!" do programowania obiektowego
(44.55 zł najniższa cena z 30 dni)49.50 zł
99.00 zł(-50%) -
Oto kolejne wydanie zwięzłego podręcznika dla programistów Javy, który ma ułatwić maksymalne wykorzystanie technologii tego języka w wersji 17. Treść została skrupulatnie przejrzana i uzupełniona o materiał dotyczący nowości w obiektowym modelu Javy. Pierwsza część książki obejmuje wprowadzenie d...(53.40 zł najniższa cena z 30 dni)
57.84 zł
89.00 zł(-35%)
Ebooka "Spock: Up and Running. Writing Expressive Tests in Java and Groovy" przeczytasz na:
-
czytnikach Inkbook, Kindle, Pocketbook, Onyx Boox i innych
-
systemach Windows, MacOS i innych
-
systemach Windows, Android, iOS, HarmonyOS
-
na dowolnych urządzeniach i aplikacjach obsługujących formaty: PDF, EPub, Mobi
Masz pytania? Zajrzyj do zakładki Pomoc »
Audiobooka "Spock: Up and Running. Writing Expressive Tests in Java and Groovy" posłuchasz:
-
w aplikacji Ebookpoint na Android, iOS, HarmonyOs
-
na systemach Windows, MacOS i innych
-
na dowolnych urządzeniach i aplikacjach obsługujących format MP3 (pliki spakowane w ZIP)
Masz pytania? Zajrzyj do zakładki Pomoc »
Kurs Video "Spock: Up and Running. Writing Expressive Tests in Java and Groovy" zobaczysz:
-
w aplikacjach Ebookpoint i Videopoint na Android, iOS, HarmonyOs
-
na systemach Windows, MacOS i innych z dostępem do najnowszej wersji Twojej przeglądarki internetowej
Szczegóły ebooka
- ISBN Ebooka:
- 978-14-919-2324-5, 9781491923245
- Data wydania ebooka:
-
2017-05-08
Data wydania ebooka często jest dniem wprowadzenia tytułu do sprzedaży i może nie być równoznaczna z datą wydania książki papierowej. Dodatkowe informacje możesz znaleźć w darmowym fragmencie. Jeśli masz wątpliwości skontaktuj się z nami sklep@ebookpoint.pl.
- Język publikacji:
- angielski
- Rozmiar pliku ePub:
- 2.3MB
- Rozmiar pliku Mobi:
- 6.0MB
Spis treści ebooka
- Introduction
- Meet Spock
- A Short Background on Groovy
- Who Is This Book For?
- About This Book
- Navigating This Book
- Conventions Used in This Book
- Using Code Examples
- OReilly Safari
- How to Contact Us
- Acknowledgments
- I. Spock 101
- 1. The Up and Running Part
- Installation
- Running with the JUnit Runner
- Running with Gradle
- When Groovy Is Used in the Project
- Synchronizing Groovy Versions Between Main and Test Classpaths
- Running with Maven
- 2. Specification Basics
- Anatomy of a Specification
- Why Use Quoted Strings for Feature Method Names?
- Anatomy of a Specification
- An Introduction to Spocks Blocks
- Block Taxonomy
- Basic Block Usage
- The Specification Lifecycle
- Fixture methods: setup and cleanup
- Block Descriptions
- and: blocks
- A Note on Comprehensibility
- Summary
- Comparison with JUnit
- 3. Spock Assertions
- The Importance of Good Diagnostics
- The Power Assert
- Type Information in Power Asserts
- Using Groovy for Effective Assertions
- Using List Comprehensions and List Literals
- Asserting Something About Every Item in a Collection
- Expressive Assertions with Groovy Operators
- Expecting Exceptions
- Interrogating the Exception
- Grouping Assertions on the Same Object
- Summary
- 4. Managing Resources
- How (Not) to Approach Persistence Testing
- Testing a Persistence Layer
- Managing Resources with the Spock Lifecycle
- Specifications and Inheritance
- Execution Order of Lifecycle Methods in an Inheritance Hierarchy
- 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
- Wildcard Shortcuts
- Defining Behavior for Mocked Methods
- Removing Invocation Constraints with Stubs
- When Should I Use a Mock and When Should I Use a Stub?
- Mixing Mocks and Stubs
- Summary
- 6. Parameterized Specifications
- Paramaterization in JUnit
- Spocks where: block
- Separating Iteration Reporting by Using @Unroll
- Adding @Unroll Descriptions
- @Unroll Tokens in Feature Method Names
- Class Level @Unroll Annotations
- Multiple Data Pipes
- Data Tables
- Fields and Methods as Data Providers
- Derived Values
- Clarifying @Unroll Expressions
- Summary
- II. Advanced Spock
- 7. Idiomatic Spock
- Organizing Tests
- The Test-per-Method Antipattern
- Organizing Tests
- Well-Factored Specifications
- Sharing Helper Methods
- Sharing Methods by Using import static
- Sharing Methods with Groovy Traits
- Sharing Methods with Delegation
- Helper Methods and Assertions
- Helper Methods and Mock Interactions
- Comparing Before and After Values
- The Grammar of Blocks
- Separation of Logic and Data with where: Blocks
- Using when/then or given/expect
- Separating Preconditions
- Separating Preconditions from Actions
- Method Parameter Capture with Mocks
- Using a Closure as a Parameter Predicate
- Using Hamcrest for Parameter Predicates
- Parameter Capture Using a Mock Responder
- @Stepwise Specifications
- How to Use @Stepwise
- Disadvantages of @Stepwise
- Conditional Specifications
- Marking Pending Features
- Selectively Executing Tests
- Automatically Cleaning Up Resources
- Documenting Specifications
- Summary
- 8. Advanced where: Blocks
- A Primary Key Verifier
- A Static Site Link Checker
- JBake Configuration
- A Data Pipe Driven by a File
- A Filtered Data Pipe
- Relative Filepaths
- Summary
- 9. Asynchronous Testing
- Blocking Constructs
- BlockingVariable
- BlockingVariables
- Blocking Constructs
- Testing Nonblocking APIs by Using Callbacks
- Using BlockingVariable in a Callback
- Using a Reference to BlockingVariable.set as a Callback
- Awaiting Multiple Values with BlockingVariables
- Improving diagnostics
- Polling for Eventual State
- Using PollingConditions as a Delegate
- Asynchronous Interaction Testing
- Asynchronous Parameter Capture
- Extending BlockingVariable
- Summary
- 10. Extending Spock
- The Message Timeline
- Hamcrest Matchers
- Hamcrest Support in Spock
- JUnit Rules
- Reusable Data Cleanup
- Simplifying the Rule by Using ExternalResource
- Making the Cleanup Logic Generic
- Spock Extensions
- Data Cleanup as a Spock Extension
- Further Steps
- Global Extensions
- Taking it Further
- Summary
- 11. Test-Driven Development: The Diamond Kata
- The Diamond Kata
- Implementation
- First Step: The Pathological Case
- The Simplest Valid Diamond
- Enforcing Invariants
- Matrix Content
- Symmetry
- Eliminating the Assertion Loop
- Adding Padding to the Rows
- Refinement
- Summary
- III. Integrating Spock
- 12. Spock and Spring
- What Do We Mean by Integration Tests?
- Container Tests
- What Do We Mean by Integration Tests?
- Spring Compatibility
- @SpringBootTest
- Testing Annotation-Driven Transactions
- Tracking Who Is Mentioned in a Message
- Non-Spring-Dependent Tests
- Testing a Transaction Rollback
- Setting Up the Spring Application
- A First Integration Test
- Convenience and Cost
- Unexpected Side Effects
- Forcing Spring to Re-Create the Application Context
- A Better Way to Force Errors
- Mock and Stub Beans
- Mention Events
- Mock Beans Before Spock 1.1
- Mock Bean Delegates
- Detached Mocks in the Spring Context
- Spring Autoconfiguration and Test Configuration Classes
- Mock Beans in XML Configuration
- Replacing Application Beans with Mocks
- Declarative Test Data
- Using the @Sql Annotation for Data Fixtures
- Global Fixture Data
- Cleaning Up Test Data Spring-Style
- Tests in Transactions
- Propagated Transactions
- Summary
- 13. Testing REST APIs
- Defining the Application URL
- A First Specification
- Web Application Lifecycle
- Creating Data for End-to-End Tests
- Bleeding Data Between Tests
- Creating Test Data on Demand
- Cleaning Up Test Data
- Requests with Data
- Fixture Methods
- Testing for HTTP Errors
- Verifying Response Data
- Typed Response Entities
- Multiple HTTP Requests in a Feature Method
- Backdoors or Pure API Testing?
- Handling Redirect Responses
- Verifying Redirect Details
- REST API Security
- Authentication versus Authorization
- Summary
- 14. End-to-End Web Testing
- Geb
- Getting Started with Geb
- A First Frontend Test
- Introducing Page Models
- Setting the Base URL
- Gebs Automatic Delegation
- Authentication
- Encapsulating Interactions by Using Methods
- Modules
- Parameterized Pages
- Interacting with Forms
- Accessing Form Elements by Name
- Encapsulating Interactions with Methods
- Form Validation
- 15. Testing JavaScript Using Spock
- Why Test JavaScript from the JVM?
- Setting Up Nashorn for Tests
- Calling JavaScript Functions
- JavaScript Functions as Objects
- Specifying this in a JavaScript Function
- Testing an Isomorphic View Component
- An Invocable Script Engine as a Delegate
- Passing Mocks to JavaScript
- Rendering a View with the Handlebars Library
- Compiling Handlebars Templates
- Testing Template Rendering
- Handling Properties That Dont Convert to JavaScript
- Registering Handlebars Helper Functions
- Composing Templates with Handlebars Partials
- Passing Iterable Values to JavaScript
- Summary
- 16. Test Driving an RxJava Application
- Tests, Behaviors, and Properties
- The Skeleton Implementation
- Test Driving the Implementation
- Defining the Behavior
- A First Test
- Polling at Regular Intervals
- No Sleep `Til the Test Goes Green
- Testing Subscription to the Stream
- Unchunking the Message Stream
- Requesting Messages Since the Last Received
- Recovering from Polling Errors
- Recovering from Downstream Errors
- Final Implementation
- A. Groovy Primer
- History
- Syntactic and Semantic Differences to Java
- Semicolons
- Import Statements
- Class Literals
- Visibility
- Exceptions
- Implicit Return
- Default Parameters
- Method Dispatch
- Valid Java Code That Is Not Valid Groovy Code
- Array initialization
- Multiple for loop variables or increments
- The dowhile loop
- Try with resource (Java 7+)
- Lambdas (Java 8+)
- Method references (Java 8+)
- Dynamic-Typed Variables
- List and Map literals
- Lists
- Indexing lists
- Lists
- Maps
- Programmatically assigning map keys
- Accessing map values
- Ranges
- Immutability
- Maps as Named Arguments
- Set and Array Literals
- Truthiness
- Properties
- Accessing Properties
- Properties of Java Classes
- Strings in Groovy
- Templated Strings
- Regular Expression Literals
- The Dollar-Slashy String
- Multiline Strings
- Operator Overloading
- Unary Math Operators
- Comparison Operators
- Mathematical Operators
- Bitwise Operators
- Shift Operators
- Operators Not Present in Java
- Safe Dereference Operator
- Call Operator
- Subscript Operators
- Elvis Operator
- Spaceship Operator
- Spread Operators
- Spreading parameters
- Regular Expression Operators
- Field Access Operator
- Method Pointer Operator
- Operator-Like Keywords
- Closures
- Defining Closures
- Optional parameter types
- The implicit closure parameter
- Defining Closures
- Methods That Accept Closures
- Closure Delegates
- Parameter and Delegate Type Information
- Closures and Java 8 Functional Interfaces
- The Groovy Development Kit
- Functional Iterator Methods
- each(Closure)
- eachWithIndex(Closure)
- find(Closure)
- findAll(Closure)
- collect(Closure)
- any(Closure)
- every(Closure)
- Functional Iterator Methods
- Chained Functional Style
- AST Transformations
- Summary
- Bibliography
- Index
O'Reilly Media - inne książki
-
Keeping up with the Python ecosystem can be daunting. Its developer tooling doesn't provide the out-of-the-box experience native to languages like Rust and Go. When it comes to long-term project maintenance or collaborating with others, every Python project faces the same problem: how to build re...(203.15 zł najniższa cena z 30 dni)
203.29 zł
239.00 zł(-15%) -
Bringing a deep-learning project into production at scale is quite challenging. To successfully scale your project, a foundational understanding of full stack deep learning, including the knowledge that lies at the intersection of hardware, software, data, and algorithms, is required.This book il...(237.15 zł najniższa cena z 30 dni)
244.53 zł
279.00 zł(-12%) -
Frontend developers have to consider many things: browser compatibility, usability, performance, scalability, SEO, and other best practices. But the most fundamental aspect of creating websites is one that often falls short: accessibility. Accessibility is the cornerstone of any website, and if a...(202.60 zł najniższa cena z 30 dni)
202.55 zł
239.00 zł(-15%) -
In this insightful and comprehensive guide, Addy Osmani shares more than a decade of experience working on the Chrome team at Google, uncovering secrets to engineering effectiveness, efficiency, and team success. Engineers and engineering leaders looking to scale their effectiveness and drive tra...(116.53 zł najniższa cena z 30 dni)
116.48 zł
149.00 zł(-22%) -
Data modeling is the single most overlooked feature in Power BI Desktop, yet it's what sets Power BI apart from other tools on the market. This practical book serves as your fast-forward button for data modeling with Power BI, Analysis Services tabular, and SQL databases. It serves as a starting ...(202.78 zł najniższa cena z 30 dni)
202.28 zł
239.00 zł(-15%) -
C# is undeniably one of the most versatile programming languages available to engineers today. With this comprehensive guide, you'll learn just how powerful the combination of C# and .NET can be. Author Ian Griffiths guides you through C# 12.0 and .NET 8 fundamentals and techniques for building c...(245.09 zł najniższa cena z 30 dni)
244.59 zł
279.00 zł(-12%) -
Learn how to get started with Futures Thinking. With this practical guide, Phil Balagtas, founder of the Design Futures Initiative and the global Speculative Futures network, shows you how designers and futurists have made futures work at companies such as Atari, IBM, Apple, Disney, Autodesk, Luf...(150.10 zł najniższa cena z 30 dni)
150.00 zł
179.00 zł(-16%) -
Augmented Analytics isn't just another book on data and analytics; it's a holistic resource for reimagining the way your entire organization interacts with information to become insight-driven.Moving beyond traditional, limited ways of making sense of data, Augmented Analytics provides a dynamic,...(178.05 zł najniższa cena z 30 dni)
177.85 zł
209.00 zł(-15%) -
Learn how to prepare for—and pass—the Kubernetes and Cloud Native Associate (KCNA) certification exam. This practical guide serves as both a study guide and point of entry for practitioners looking to explore and adopt cloud native technologies. Adrián González Sánchez ...
Kubernetes and Cloud Native Associate (KCNA) Study Guide Kubernetes and Cloud Native Associate (KCNA) Study Guide
(169.14 zł najniższa cena z 30 dni)177.65 zł
199.00 zł(-11%) -
Python is an excellent way to get started in programming, and this clear, concise guide walks you through Python a step at a time—beginning with basic programming concepts before moving on to functions, data structures, and object-oriented design. This revised third edition reflects the gro...(143.54 zł najniższa cena z 30 dni)
143.04 zł
179.00 zł(-20%)
Dzieki opcji "Druk na żądanie" do sprzedaży wracają tytuły Grupy Helion, które cieszyły sie dużym zainteresowaniem, a których nakład został wyprzedany.
Dla naszych Czytelników wydrukowaliśmy dodatkową pulę egzemplarzy w technice druku cyfrowego.
Co powinieneś wiedzieć o usłudze "Druk na żądanie":
- usługa obejmuje tylko widoczną poniżej listę tytułów, którą na bieżąco aktualizujemy;
- cena książki może być wyższa od początkowej ceny detalicznej, co jest spowodowane kosztami druku cyfrowego (wyższymi niż koszty tradycyjnego druku offsetowego). Obowiązująca cena jest zawsze podawana na stronie WWW książki;
- zawartość książki wraz z dodatkami (płyta CD, DVD) odpowiada jej pierwotnemu wydaniu i jest w pełni komplementarna;
- usługa nie obejmuje książek w kolorze.
Masz pytanie o konkretny tytuł? Napisz do nas: sklep[at]helion.pl.
Książka, którą chcesz zamówić pochodzi z końcówki nakładu. Oznacza to, że mogą się pojawić drobne defekty (otarcia, rysy, zagięcia).
Co powinieneś wiedzieć o usłudze "Końcówka nakładu":
- usługa obejmuje tylko książki oznaczone tagiem "Końcówka nakładu";
- wady o których mowa powyżej nie podlegają reklamacji;
Masz pytanie o konkretny tytuł? Napisz do nas: sklep[at]helion.pl.
Książka drukowana
![Loader](https://static01.helion.com.pl/ebookpoint/img/ajax-loader.gif)
![ajax-loader](https://static01.helion.com.pl/ebookpoint/img/ajax-loader.gif)
Oceny i opinie klientów: Spock: Up and Running. Writing Expressive Tests in Java and Groovy Rob Fletcher (0)
Weryfikacja opinii następuję na podstawie historii zamówień na koncie Użytkownika umieszczającego opinię. Użytkownik mógł otrzymać punkty za opublikowanie opinii uprawniające do uzyskania rabatu w ramach Programu Punktowego.