Instant Mockito
Marcin Grzejszczak
- 出版商: Packt Publishing
- 出版日期: 2013-08-16
- 售價: $1,060
- 貴賓價: 9.5 折 $1,007
- 語言: 英文
- 頁數: 66
- 裝訂: Paperback
- ISBN: 1782167978
- ISBN-13: 9781782167976
海外代購書籍(需單獨結帳)
買這商品的人也買了...
-
$880$695 -
$580$458 -
$940$700 -
$1,180$1,121 -
$454Jenkins 權威指南
-
$580$458 -
$332遊戲情感設計:如何觸動玩家的心靈
-
$580$452 -
$480$379 -
$653Jenkins 2 權威指南 (Jenkins 2: Up and Running: Evolve Your Deployment Pipeline for Next Generation Automation)
-
$520$411 -
$403OpenShift 助力 DevOps : 雲部署更簡單 (DevOps with OpenShift: Cloud Deployments Made Easy)
-
$480$379 -
$709OpenShift 在企業中的實踐:PaaS DevOps 微服務
商品描述
Learn how to create stubs, mocks, and spies and verify their behavior using Mockito
Overview
- Learn something new in an Instant! A short, fast, focused guide delivering immediate results
- Stub methods with callbacks
- Verify the behavior of test mocks
- Assert the arguments passed to functions of mocks
- Create custom argument matchers
In Detail
Mockito is an open source testing framework for Java that automates unit tests for use in test-driven development (TDD) or behavior-driven development (BDD), decoupling test code from the system under test by eliminating the expect-run-verify pattern. It lets you write beautiful tests with a clean and simple API.
Instant Mockito contains plenty of real-life examples on how to unit test your code. It shows you how to use this testing framework and explains best practices on how to use it effectively.
Instant Mockito helps you break each significant method into a set of practical examples. It will clarify all the concepts of unit testing and Mockito.
You will learn how to properly capture and verify arguments passed into your stubbed methods. We will also take a look at verifying an order and returning custom answers on the stubs. If you want to take advantage of using the Mockito framework’s API to tame your code base, then this is the book for you.
You will learn everything you need to know to unit test your code in a clear, readable, and high quality manner.
What you will learn from this book
- Create stubs, mocks, and spies
- Perform argument matching
- Work with void methods and thrown exceptions
- Perform stubbing with a custom answer
- Verify the behaviour of mocks
- Perform argument capturing
- Verify the call order
- Work with asynchronous code
- Learn about partial mocking
- Reduce boilerplate code with annotations
- Learn about advanced mock configuration
Approach
Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. This is a standard, tutorial-based guide using plenty of examples for illustration.
Who this book is written for
Instant Mockito is ideal for developers new to unit testing, who are looking to get to know how to create high quality tests using Mockito. It’s assumed that you will have some experience in Java already.