Testing with JUnit

Master high quality software development driven by unit tests
Preview in Mapt

Testing with JUnit

Frank Appel

1 customer reviews
Master high quality software development driven by unit tests

Quick links: > What will you learn?> Table of content> Product reviews

Mapt Subscription
FREE
$29.99/m after trial
eBook
$16.80
RRP $23.99
Save 29%
Print + eBook
$29.99
RRP $29.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$16.80
$29.99
$29.99 p/m after trial
RRP $23.99
RRP $29.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Testing with JUnit Book Cover
Testing with JUnit
$ 23.99
$ 16.80
Mastering Unit Testing Using Mockito and JUnit Book Cover
Mastering Unit Testing Using Mockito and JUnit
$ 26.99
$ 18.90
Buy 2 for $34.30
Save $16.68
Add to Cart

Book Details

ISBN 139781782166603
Paperback200 pages

Book Description

JUnit has matured to become the most important tool when it comes to automated developer tests in Java. Supported by all IDEs and build systems, it empowers programmers to deliver software features reliably and efficiently. However, writing good unit tests is a skill that needs to be learned; otherwise it's all too easy to end up in gridlocked development due to messed up production and testing code. Acquiring the best practices for unit testing will help you to prevent such problems and lead your projects to success with respect to quality and costs.

This book explains JUnit concepts and best practices applied to the test first approach, a foundation for high quality Java components delivered in time and budget.

From the beginning you'll be guided continuously through a practically relevant example and pick up background knowledge and development techniques step by step. Starting with the basics of tests organization you'll soon comprehend the necessity of well structured tests and delve into the relationship of requirement decomposition and the many-faceted world of test double usage. In conjunction with third-party tools you'll be trained in writing your tests efficiently, adapt your test case environment to particular demands and increase the expressiveness of your verification statements. Finally, you'll experience continuous integration as the perfect complement to support short feedback cycles and quality related reports for your whole team.

The tutorial gives a profound entry point in the essentials of unit testing with JUnit and prepares you for test-related daily work challenges.

Table of Contents

Chapter 1: Getting Started
Why you should busy yourself with unit tests
Setting the table
Serving the starter
Understanding the nature of a unit test
Summary
Chapter 2: Writing Well-structured Tests
The four phases of a unit test
Choosing the next functionality to test
Getting the test names right
Summary
Chapter 3: Developing Independently Testable Units
Decomposing requirements
Understanding isolation
Working with test doubles
Increasing efficiency with mock frameworks
Using test helpers
Summary
Chapter 4: Testing Exceptional Flow
Testing patterns
Treating collaborators
Summary
Chapter 5: Using Runners for Particular Testing Purposes
Understanding the architecture
Using custom runners
Writing dataset tests
Summary
Chapter 6: Reducing Boilerplate with JUnit Rules
Understanding rules
Working with advanced concepts
Employing custom solutions
Summary
Chapter 7: Improving Readability with Custom Assertions
Working with the JUnit built-in assert approach
Creating flexible expressions of intent with Hamcrest
Writing fluently readable assertions with AssertJ
Summary
Chapter 8: Running Tests Automatically within a CI Build
Wrapping up the sample application
Setting up an automated CI build
Integrating code coverage reports
Summary

What You Will Learn

  • Organize your test infrastructure and resources reasonably
  • Understand and write well structured tests
  • Decompose your requirements into small and independently testable units
  • Increase your testing efficiency with on-the-fly generated stand-in components and deal with the particularities of exceptional flow
  • Employ runners to adjust to specific test demands
  • Use rules to increase testing safety and reduce boilerplate
  • Use third party supplements to improve the expressiveness of your verification statements

Authors

Table of Contents

Chapter 1: Getting Started
Why you should busy yourself with unit tests
Setting the table
Serving the starter
Understanding the nature of a unit test
Summary
Chapter 2: Writing Well-structured Tests
The four phases of a unit test
Choosing the next functionality to test
Getting the test names right
Summary
Chapter 3: Developing Independently Testable Units
Decomposing requirements
Understanding isolation
Working with test doubles
Increasing efficiency with mock frameworks
Using test helpers
Summary
Chapter 4: Testing Exceptional Flow
Testing patterns
Treating collaborators
Summary
Chapter 5: Using Runners for Particular Testing Purposes
Understanding the architecture
Using custom runners
Writing dataset tests
Summary
Chapter 6: Reducing Boilerplate with JUnit Rules
Understanding rules
Working with advanced concepts
Employing custom solutions
Summary
Chapter 7: Improving Readability with Custom Assertions
Working with the JUnit built-in assert approach
Creating flexible expressions of intent with Hamcrest
Writing fluently readable assertions with AssertJ
Summary
Chapter 8: Running Tests Automatically within a CI Build
Wrapping up the sample application
Setting up an automated CI build
Integrating code coverage reports
Summary

Book Details

ISBN 139781782166603
Paperback200 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Unit Testing Using Mockito and JUnit Book Cover
Mastering Unit Testing Using Mockito and JUnit
$ 26.99
$ 18.90
Test-Driven Java Development Book Cover
Test-Driven Java Development
$ 39.99
$ 28.00
Java Hibernate Cookbook Book Cover
Java Hibernate Cookbook
$ 35.99
$ 25.20
Spring: Developing Java Applications for the Enterprise Book Cover
Spring: Developing Java Applications for the Enterprise
$ 67.99
$ 47.60
Mastering Concurrency Programming with Java 8 Book Cover
Mastering Concurrency Programming with Java 8
$ 43.99
$ 30.80
Learning Android Application Testing Book Cover
Learning Android Application Testing
$ 39.99
$ 28.00