Mockito Cookbook [NOOK Book]

Overview

In Detail

Mockito is a testing framework that creates external dependencies (which is called mocking) which is used to test/simulate the behavioral patterns of the software and generate reports about it. Frameworks like Mockito fake or “mock” the external dependencies so that the object being tested has a consistent interaction with the outside dependencies. Mockito streamlines the delivery of the external dependencies that are not subjects of the test. Why Mockito? Compared to ...

See more details below
Mockito Cookbook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$26.99
BN.com price

Overview

In Detail

Mockito is a testing framework that creates external dependencies (which is called mocking) which is used to test/simulate the behavioral patterns of the software and generate reports about it. Frameworks like Mockito fake or “mock” the external dependencies so that the object being tested has a consistent interaction with the outside dependencies. Mockito streamlines the delivery of the external dependencies that are not subjects of the test. Why Mockito? Compared to its main Java competitors EasyMock and jMock, Mockito, it is the most widely used mocking framework.

This book consists of recipes that depict the usage of a vast majority of Mockito functionalities in real-life examples. It goes beyond the documentation and covers how Mockito works and shows the steps to write effective tests using Mockito. It begins with getting to know the Mockito configuration, then you will learn how to create mocks and stubs, and afterwards you will be shown how to write good tests using Mockito together with how to properly stub behavior of your test objects. We'll finish by showing you some of the most interesting Mockito extension-based tools together with a comparison of the most widely used mocking frameworks.

Approach

This is a focused guide with lots of practical recipes with presentations of business issues and presentation of the whole test of the system. This book shows the use of Mockito's popular unit testing frameworks such as JUnit, PowerMock, TestNG, and so on.

Who this book is for

If you are a software developer with no testing experience (especially with Mockito) and you want to start using Mockito in the most efficient way then this book is for you. This book assumes that you have a good knowledge level and understanding of Java-based unit testing frameworks.

Read More Show Less

Product Details

  • ISBN-13: 9781783982752
  • Publisher: Packt Publishing
  • Publication date: 6/24/2014
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • File size: 390 KB

Meet the Author

Marcin Grzejszczak is an experienced Java / JEE web applications programmer; enthusiast of clean coding and good design; contributor to several open source projects (Drools, Moco, Mockito, and Spock) and to Groovy core; co-organizer of the Warsaw Groovy User Group; and a member of the Most Valuable Blogger program at DZone and Java Code Geeks.

Marcin is the author of Instant Mockito Starter published by Packt Publishing and Drools Refcard at DZone.

Visit his blog at http://toomuchcoding.blogspot.com, his homepage http://www.marcin.grzejszczak.pl, and follow him on Twitter at http://twitter.com/MGrzejszczak.

Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Posted July 26, 2014

    more from this reviewer

    One nice thing about Mockito is that its name actually makes [so

    One nice thing about Mockito is that its name actually makes [some] sense, instead of the random whimsical nomenclature adopted by many other packages. Mockito also addresses a real need to test your software. It offers a systematic approach, instead of the common ad hoc approaches devised earlier.

    Like having easy test stubs that simulate method calls with hardwired expected correct results, in lieu of the method actually doing what it is meant to do.

    Loose coupling is the hallmark of Mockito. That a deliberate minimal connection between the test code and the production code leads to easier testing. Otherwise when you change the production code, a concomitant change in the test code is needed. Which of course slows things down. As well, since any code is liable to bugs, updating test code can certainly put bugs into them. So if the buggy test harness says the production code is wrong, when it is the latter that is actually correct, this leads to circular debugging.

    The code snippets in the book are for Java. Heavy use is made of JUnit. Sensible, since it was explicitly for unit testing.

    Mockit also offers partial mocks. [Great terminology!] For the real word case when you have some new code base, written to solid techniques. But it integrates with a legacy code base or third pary libraries of uncertain calibre. I imagine partial mocks will be the most useful section of the book to some readers in this pickle.

    Much of Mockito can be understood as you writing tests that define what should happen, and not how. The latter is the duty of production code. In this sense, Mockito simply recaps what has long been known in large software projects, and certainly this predates the very existence of Java.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)