Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MASTERING UNIT TESTING USING MOCKITO AND JUNIT

You're reading from   MASTERING UNIT TESTING USING MOCKITO AND JUNIT An advanced guide to mastering unit testing using Mockito and JUnit

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781783982509
Length 314 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Sujoy Acharya Sujoy Acharya
Author Profile Icon Sujoy Acharya
Sujoy Acharya
Arrow right icon
View More author details
Toc

Working with Mockito

Mockito is an open source mock unit testing framework for Java. In the previous chapter, we read about test doubles and mock objects. Mockito allows mock object creation, verification, and stubbing.

To find out more about Mockito, visit the following link:

http://code.google.com/p/mockito/

Why should you use Mockito?

Automated tests are safety nets. They run and notify the user if the system is broken so that the offending code can be fixed very quickly.

If a test suite runs for an hour, the purpose of quick feedback is compromised. Unit tests should act as a safety net and provide quick feedback; this is the main principle of TDD.

I worked with an environment where when a piece of code is checked-in, the automated tests would run and would take hours to complete. So, a developer had to wait for an hour to check-in the new code unless the previous build/test run was complete. A developer can check-in the code in the middle of a build, but the best practice is to monitor...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image