Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Unit Testing Using Mockito and JUnit

You're reading from  Mastering Unit Testing Using Mockito and JUnit

Product type Book
Published in Jul 2014
Publisher
ISBN-13 9781783982509
Pages 314 pages
Edition 1st Edition
Languages
Author (1):
Sujoy Acharya Sujoy Acharya
Profile icon Sujoy Acharya

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 $15.99/month. Cancel anytime}