JUnit and Mockito Crash Course

Learn how to use JUnit and Mockito and Unit Test in easy steps.
4.3 (389 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
2,229 students enrolled Bestselling in JUnit
$19
$20
5% off
Take This Course
  • Lectures 66
  • Length 3.5 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 9/2015 English

Course Description

Course Updated on December 7th , 2015

I added a new Bonus section "Section 11 - Spring Testing Quick Start " . Enjoy :)

Are you a java developer who want to become an expert at Unit Testing ? Then this course is a quick practical guide for you. Learn how to write real unit tests using JUnit and Mockito. This course will simplify things with concepts and step by step implementations .

There are so many java professionals who write great code , but not unit tests. This course aims at filling that gap by covering JUnit and Mockito the two required frameworks to write good unit tests.

Learn and master the most popular unit testing technologies in this comprehensive course.

  • Understand the importance of writing Unit Tests
  • Demystify the topics of Mocking
  • Write Unit tests using JUnit and Mockito
  • Learn what test coverage is and how to measure it
  • Run unit tests as a part of your Maven build
  • All in easy steps

Mastering Unit Testing for Java Professionals:

JUnit is a open source Framework to test and assert code behavior . Mockito mocks out the dependencies and stub the expectations allowing testing a particular layer/unit in isolation.

Any java developer at any level can access the key lessons and concepts in this course and learn to write quality unit tests.

This course is perfect for every java developer who works on building high quality applications .

Contents and Overview:

In over 2 hours of lectures this course covers necessary JUnit API and its usage with Mockito.

This course covers the importance of unit testing , how to effectively use JUnit ,how mocking works and how to use Mockito to write real unit tests.

Up on completion you will be able to test Java and JavaEE applications ,run unit tests as a part of your build and measure code coverage and improve it.

What are the requirements?

  • Java Knowledge
  • Eclipse IDE Kepler(or Higher) For Java Developers

What am I going to get from this course?

  • Learn what Unit Testing is
  • Understand the importance of Unit Testing
  • Learn the JUnit Framework and API
  • Learn what mocking is and why we should mock
  • Write tests using JUnit and Mockito
  • Learn What Test Coverage is and how to measure it
  • All in simple and easy steps
  • Spring Testing Quick Start
  • PowerMock Quick Start
  • Parameterized JUnit

What is the target audience?

  • Anyone who wants to write quality code
  • Student with java background
  • Java Developers
  • Java EE Developers

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Software Setup
Installing Java SDK and Eclipse IDE
Preview
03:18
Section 2: Introduction
Course Introduction
Preview
01:46
Unit Testing Introduction
04:06
Unit Testing Introduction
4 questions
Section 3: JUnit in Action
Introduction
Preview
00:24
JUnit Introduction
05:05
JUnit Introductioin
5 questions
Hello JUnit
06:48
Hello JUnit
1 question
Testing for Exceptions
05:20
Exceptions
1 question
@Before and @After
04:18
Before and After
1 question
Section 4: Mockito in Action
Introduction
Preview
00:22
Mocking Introduction
04:02
Mocking Introduction
2 questions
The Order Processor Usecase
01:25
Create the DAO Layer
04:45
Create the BO Layer
07:55
Add the Mockito Dependency
02:33
Stubbing and Setting Expectations
06:03
Stubbing and setting expectations
4 questions
Verify the results
03:17
Verify the results
2 questions
Test a negative scenario
02:50
Mocking Exceptions
02:29
Test Cancel Order
03:19
Cancel Order Negative Scenario
01:13
Cancel Order Exception Scenario
01:52
Cancel Order Exception On Update
01:46
Section 5: Test Coverage
Introduction
Preview
00:19
Test Coverage
02:40
Test Coverage
2 questions
EclEmma Installation
01:43
Measuring coverage using Emma
03:11
Improving the Coverage
03:26
Section 6: More Mockito
Introduction
Preview
00:16
Verification Mode
02:15
Verify More
02:53
Create the ScrapBook Project
04:08
Add the Mockito Dependency
01:21
Stub Void Methods Implicitly
04:52
Stub Void Methods Explicitly
00:45
Use doNothing to test Consecutive calls
02:47
Section 7: Best Practices and Patterns
The F.I.R.S.T Principle
03:18
Test Doubles Introduction
01:54
Test Doubles In Mockito
03:04
Partial Mocking Using Mockito Spy
06:17
Spy vs Mock
02:13
Section 8: Maven and JUnit Quick Start
Maven Overview
04:00
Creating a Maven Project
04:03
Running Tests
04:48
Section 9: Parameterized JUnit
Introduction
Preview
02:56
Create The Fields and Constructor
02:49
Create The Static Data Set Method
02:53
Create or Update The Test
02:33
The Parameterized Test Flow
01:33
Parameterized JUnits
3 questions
Section 10: PowerMock Jump Start
PowerMock Introduction
Preview
02:59
PowerMock Jump Start
2 questions
Usecase
01:10
Create the project
04:11
Download and Add PowerMock Dependencies
02:46
Prepare For Testing
02:18
Mock Static Methods and Test
04:31
Section 11: Spring Testing Quick Start
Spring Framework Introduction
04:15
Ticketing Usecase
00:40
Create the Maven Project
02:35
Create the DAO Layer
03:13
Create the Services Layer
03:05
Update the pom.xml
04:18
Create the Spring Configuration file
01:28
Do Dependency Injection
03:11
Create the JUnit Test
04:01
Use Spring Test API
05:26
Test Flow Explained
01:50
Unit vs Integration Testing
01:24

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Bharath Thippireddy, Java Architect and Instructor at Vivekananda Consulting USA

I have 13 + years of Software design and development Experience. While working for companies like Oracle, HP, TCS, Siemens and NCR I have architected applications using Java, JEE, Java Script and SOA technologies.

I love learning new things both in technology and personal development and I love sharing them - "Sharing is learning!”. I have mentored students in class room trainings as well as in the corporate world both in India as well as in USA.I also share my adventures on my website and YouTube channels.

I have spoken on technical topics at several agile conferences. While in India I also voluntarily teach interview and soft skills at Vivekananda Kendra.

I am a Sun Certified Developer, Web Component Developer, Business Component Developer, Web Services Developer.

Ready to start learning?
Take This Course