Spock: Up and Running. Writing Expressive Tests in Java and Groovy
- Autor:
- Rob Fletcher
- 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
-
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)
90.30 zł
129.00 zł(-30%) -
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)60.90 zł
87.00 zł(-30%) -
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)
48.30 zł
69.00 zł(-30%) -
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 developer's comprehensive guide to crafting, compiling, and implementing programming languages - Second Edition Build Your Own Programming Language. A developer's comprehensive guide to crafting, compiling, and implementing programming languages - Second Edition
-
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
(39.60 zł najniższa cena z 30 dni)54.45 zł
99.00 zł(-45%) -
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)
62.30 zł
89.00 zł(-30%) -
Kariera zawodowa programisty jest związana z nieustanną nauką i doskonaleniem zdobytych umiejętności. Jednym z podstawowych etapów rozwoju programisty Java jest zaznajomienie się z dobrymi praktykami programistycznymi, co obejmuje także wzorce projektowe – i to im właśnie poświęcony jest te...
Wzorce projektowe w Javie. Kurs video. Programowanie efektywnych rozwiązań Wzorce projektowe w Javie. Kurs video. Programowanie efektywnych rozwiązań
(39.90 zł najniższa cena z 30 dni)81.95 zł
149.00 zł(-45%) -
Oto zaktualizowane i uzupełnione wydanie zwięzłego wprowadzenia do Javy SE 17, przeznaczonego dla profesjonalnych programistów Javy. Przedstawiono w nim wszystkie istotne zagadnienia, łącznie z takimi koncepcjami jak wyrażenia lambda i strumienie, nowoczesnymi konstrukcjami, jak rekordy i klasy z...
Java. Przewodnik doświadczonego programisty. Wydanie III Java. Przewodnik doświadczonego programisty. Wydanie III
(53.40 zł najniższa cena z 30 dni)62.30 zł
89.00 zł(-30%) -
This practical guide teaches inexperienced Java programmers and web developers how to design, develop, test, and deploy highly scalable and maintainable APIs using REST, gRPC, GraphQL, and reactive programming paradigms with Java and Spring Boot. Complete with real-world examples, it will guide y...
Modern API Development with Spring 6 and Spring Boot 3. Design scalable, viable, and reactive APIs with REST, gRPC, and GraphQL using Java 17 and Spring Boot 3 - Second Edition Modern API Development with Spring 6 and Spring Boot 3. Design scalable, viable, and reactive APIs with REST, gRPC, and GraphQL using Java 17 and Spring Boot 3 - Second Edition
-
Ideal for working programmers new to Java, this best-selling book guides you through the language features and APIs of Java 21. Through fun, compelling, and realistic examples, authors Marc Loy, Patrick Niemeyer, and Dan Leuck introduce you to Java's fundamentals, including its class libraries, p...(245.65 zł najniższa cena z 30 dni)
254.15 zł
299.00 zł(-15%)
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
-
JavaScript gives web developers great power to create rich interactive browser experiences, and much of that power is provided by the browser itself. Modern web APIs enable web-based applications to come to life like never before, supporting actions that once required browser plug-ins. Some are s...(177.65 zł najniższa cena z 30 dni)
186.15 zł
219.00 zł(-15%) -
How will software development and operations have to change to meet the sustainability and green needs of the planet? And what does that imply for development organizations? In this eye-opening book, sustainable software advocates Anne Currie, Sarah Hsu, and Sara Bergman provide a unique overview...(160.65 zł najniższa cena z 30 dni)
177.65 zł
209.00 zł(-15%) -
OpenTelemetry is a revolution in observability data. Instead of running multiple uncoordinated pipelines, OpenTelemetry provides users with a single integrated stream of data, providing multiple sources of high-quality telemetry data: tracing, metrics, logs, RUM, eBPF, and more. This practical gu...(143.65 zł najniższa cena z 30 dni)
152.15 zł
179.00 zł(-15%) -
Interested in developing embedded systems? Since they don't tolerate inefficiency, these systems require a disciplined approach to programming. This easy-to-read guide helps you cultivate good development practices based on classic software design patterns and new patterns unique to embedded prog...(152.15 zł najniższa cena z 30 dni)
160.65 zł
189.00 zł(-15%) -
If you use Linux in your day-to-day work, then Linux Pocket Guide is the perfect on-the-job reference. This thoroughly updated 20th anniversary edition explains more than 200 Linux commands, including new commands for file handling, package management, version control, file format conversions, an...(92.65 zł najniższa cena z 30 dni)
101.15 zł
119.00 zł(-15%) -
Gain the valuable skills and techniques you need to accelerate the delivery of machine learning solutions. With this practical guide, data scientists, ML engineers, and their leaders will learn how to bridge the gap between data science and Lean product delivery in a practical and simple way. Dav...(245.65 zł najniższa cena z 30 dni)
254.15 zł
299.00 zł(-15%) -
This practical book provides a detailed explanation of the zero trust security model. Zero trust is a security paradigm shift that eliminates the concept of traditional perimeter-based security and requires you to "always assume breach" and "never trust but always verify." The updated edition off...(203.15 zł najniższa cena z 30 dni)
211.65 zł
249.00 zł(-15%) -
Decentralized finance (DeFi) is a rapidly growing field in fintech, having grown from $700 million to $100 billion over the past three years alone. But the lack of reliable information makes this area both risky and murky. In this practical book, experienced securities attorney Alexandra Damsker ...(203.15 zł najniższa cena z 30 dni)
211.65 zł
249.00 zł(-15%) -
Whether you're a startup founder trying to disrupt an industry or an entrepreneur trying to provoke change from within, your biggest challenge is creating a product people actually want. Lean Analytics steers you in the right direction.This book shows you how to validate your initial idea, find t...(126.65 zł najniższa cena z 30 dni)
126.65 zł
149.00 zł(-15%) -
When it comes to building user interfaces on the web, React enables web developers to unlock a new world of possibilities. This practical book helps you take a deep dive into fundamental concepts of this JavaScript library, including JSX syntax and advanced patterns, the virtual DOM, React reconc...(194.65 zł najniższa cena z 30 dni)
211.65 zł
249.00 zł(-15%)
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
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.