Java JUnit for Unit Testing with TestNG, Mockito, EclEmma
3.6 (30 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.
724 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Java JUnit for Unit Testing with TestNG, Mockito, EclEmma to your Wishlist.

Add to Wishlist

Java JUnit for Unit Testing with TestNG, Mockito, EclEmma

JUnit 4.0, Unit Testing, Automatic Software Testing using JUnit, TestNG, Eclipse, EclEmma, Mockito, BlueJ)
3.6 (30 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.
724 students enrolled
Created by Dr. Eric Chou
Last updated 3/2017
Current price: $12 Original price: $40 Discount: 70% off
30-Day Money-Back Guarantee
  • 6.5 hours on-demand video
  • 4 Articles
  • 95 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Learn JUnit which is the top software testing tool for mobile application including Android and iOS.
  • Learn Eclipse and BlueJ tool for JUnit Testing setup development.
  • Learn general software development concept through JUnit. Experience with JUnit can be used for testing of all other programming language and platform.
View Curriculum
  • Some degree of involvement in Java Programming

[CS 140]

[Please watch all preview videos before signing up this course]

Java JUnit for Unit Testing

This course is an introductory course for unit test and the unit test tool JUnit for Java programming language.

The topics in this course including the following: 
(1) Overview of the course
(2) JUnit software installation on Eclipse and BlueJ
(3) JUnit test fixture, annotations, test case, test suite, and parameterized 
(4) Unit Test Strategy: white box testing techniques are discussed for 
students to gain in-sight understanding of how a test case should be built for 
unit test. 
(5) Unit Test/Integration Test/Functional Test Strategty: black box testing 
techniques are used for these tests.  JUnit can not only support unit test.  
It can also be used to support integration test and functional test.  Black 
box testing techniques are discussed for these tests.  EclEmma is 
introduced for code coverage. 
(6) TestNG API: TestNG is the next generation test software (API) which is 
inspired and can be co-operated with JUnit to provide more robust unit test and 
higher level test. 

(7) Mockito API: Mockito can work with JUnit and TestNG as a very powerful 
API to support testing mechanism using mock which allows many test patterns 
involving simulated test, test with substitutes such as dummy, fake object, spy, 
stub and others. 

Software Used: 

JUnit, TestNG, Eclipse, BlueJ, Apache Maven, Mockito, EclEmma, JaCoCo

Who is the target audience?
  • Java Programmer who want to know JUnit test
  • Java Program Tester
  • Java Software Integrator
  • Java Software Quality Assurance Team Member
  • Java Software Test Engineer
Curriculum For This Course
52 Lectures
3 Lectures 15:44

This course is an introductory software testing course focused on Unit Testing using JUnit (Java) and some other tools. 

Preview 02:35

Introduction to Unit Test and using JUnit in BLuJ. The program can be converted to Eclipse and Netbeans. That will be shown in later lectures.

Preview 11:24

Show the internet resources available for eC Learning Channel by Dr. Eric Chou to support this course. 

My Udemy:

Youtube channel:





eC Learning: Quality MOOC STEM Education
Introduction to JUnit Software Testing
8 Lectures 57:53

Introduction of JUnit API and its relationship with other language/platform and testing theory.

Preview 09:35

Demonstrate the advantages of BlueJ as the first Integrated IDE for beginning students.

Why BlueJ?

Introduce the steps to create a test class and test methods both by ad hoc testing and JUnit testing.

Preview 07:22

Discussion of how to run group of tests and interpret the test results from JUnit.

Preview 08:08

Java 8 Standard Edition Installation Guide (Standard-alone Version)

Java 8 Standard Edition Installation Guide (Stand-alone Version)

Use Eclipse for JUnit Testing

Preview 09:42

Eclipse library files. 

Library (zipped files) for Eclipse Users

Show student the resources and other educational materials provided by the Lecturer.  To guide student to learn Programming step by step. 

How to master Java Programming?

Quiz on Introduction to JUnit and the Software Testing

Section 2 Quiz:
5 questions
JUnit Framework
11 Lectures 01:14:19

Discuss the use of Test Fixture as an introduction for the rest of the chapter. Many different kinds of test fixtures will be presented in the following lectures.

What is a fixture?

JUnit Test Framework from the TestCase, TestSuite, Runner, Result, and Test design patterns point of view. Covering both JUnit 4 and 3.

JUnit Framework

JUnit Annotations Explanation

JUnit Annotations

Introduce the testing of execution program and provide example in both BlueJ and Eclipse

Flow Test

Explain and provide code example for Annotation @Ignore

Ignore Test

JUnit Unit Test for the assertion of certain Exception's occurrence. 

Exception Test

Test if a program pass a certain Time Limit test. 

Time Test

Suite Test and Parameterized Test is where BlueJ starts to show its insufficiency. Therefore, we started to show how to use Eclipse to do JUnit Test. (This is the part one of Suite Test, We used this to warm up the use of Eclipse.) This lecture will be followed by another example program on the Eclipse Suite Test.

Suite Test I (Eclipse Basic Text Fixture)

importing the five files for the Test Framework lecture into Eclipse and show it as an example for JUnit Suite Test.

Suite Test II (TestFrameWork in Eclipse)

Parameterized Test Fixture for a simple addition method.

Parameterized Test I (

Parameterized JUnit Test for Java language for web-site domain name using regular expression matcher.

Parameterized Test II (

JUnit Framework and Building Test Fixtures and Test Cases. 

Section 3 Quiz:
11 questions
JUnit Concept
2 Lectures 10:41

Discuss the general Unit Test concepts. STLC (Soft Testing Life Cycle), software test program development cycle and the advantages and disadvantages of JUnit Test.

JUnit Testing Strategies

Explain the white box testing and black box testing as the introduction for different goal-driven testing program development.

Black Box Testing Versus White Box Testing

Section 4 Quiz:
5 questions
White Box Testing
8 Lectures 59:10

First white box testing example. Also, the simplest one on boolean expression.An alternative for parameterized testing using arrays is given.

Expression Test

Demonstrate how to design a test program for a loop.

Loop Test

Test Program setup for methods using isPalindrome() as example.

Method Test

Discuss the various ways of preparing the test program for the classes and objects. Also introduce a very simple control flow (create account, withdraw, depost and getBalance()). Please download the attached controlFlowTesting.pdf to investigate into the details about Control Flow Test.

Class/Object Test: (Bank Account) Control-Flow Testing

Overview of Test Coverage using White Box Testing.  And, white box testing techniques Part 1: Exhaustive Testing and Data Flow Testing

Exhaustive Testing and Data Flow Testing

In this lecture, we combine the concept of input space partitioning, branch test coverage, Monte Carlo Testing and corner case handling for white box testing into one example test program. 

Monte Carlo Testing and Branching Testing

Use a delete element project to demonstrate the idea of corner case, edge case and path coverage.  The delete element method has two version.  One with path node monitor and one without. The path is clearly shown. 

Testing of Corner Cases and Edge Cases and Path Testing

Review the Test Coverage topics and the EclEmma tool installation.. 

Test Coverage (Statement and Decision Coverage)

Section 5 Quiz:
5 questions
Black Box Testing
5 Lectures 51:35

Discuss briefly about software testing life cycle and different testing stages. 

Overview of Software Testing Life Cycle (STLC)

Overview of various black box testing techniques. 

Black Box Testing Techniques

Use the BlueJ Object and Class management system to demonstrate the idea of error guessing testing, equivalent class partitioning and ad host testing using an integer reversing example. 

ad hoc Testing using BlueJ (Error Guessing)

Discuss cause-effect graphing, decision table and solution space analysis and put them all together into the vending machine change calculation program as an example. 

Cause Effect Graphing and Decision Table

All Pairs Testing

Section 6 Quiz:
10 questions
Advanced Testing Topics
10 Lectures 01:36:28

Describe the installation of TestNG tool and use it for an example time out Test for simple performance testing..

TestNG, Selenium, Maven, and JUnit (Timeout Example, Load Test Example)

Compare JUnit 4 and TestNG to show the advantages of next generation test (TestNG). 

JUnit VS TestNG I

Part 2 for comparison between JUnit4 and TestNG programs.  In this lecture, we focused on the parameterized test, group test, and the dependency tests. 

JUnit VS TestNG II

Introduction to Mockito API package and its installation. 

Introduction to Mockito API and Installation

Unit Testing: Stubs, Mocks and Fakes.  Stubs are an objects to simulate the tester program.  Mocks are objects as substitutes to the real objects. A Fake is a generic term for Mocks en Stubs; objects that replace dependencies.

Use of Mocks

Introduce the basic stubbing and the related setup of Mock, Assertion, and Verification: the so-called 3 phases for using mocks. 

Syntax of Mockito Tests

Launch a series of two lectures on one example for the stub in Mockito. 

Stubs I

Part 2 of two lectures on one example for the stub in Mockito. 

Stubs II

Mocking by using spy pattern.  Five example programs area given. 


Covers the use of Mockito Annotations and Dummy and Fake Objects. 

Dummy and Fake Objects

Section 7 Quiz:
6 questions
2 Lectures 08:44

Using a simple TicTacToe Program to explain that, after testing, how to pack up a project into an executable .jar file (need JRE) and, then, an executable .exe file (no need for JRE)

Packaging and Deployment

This lecture is the conclusion of this course. We covered the topics, tools and what is not covered in this course.  the lecture works as a guideline for student to move on to the next stage. 

Appendix A: Software Issues
2 Lectures 10:57

(Additional Lecture) Installation of BlueJ from AP Computer Science Part 1: Java Programming Essentials

Installation of Java Software and BlueJ (from Java Programming AP Ed.)

People are using Eclipse, Netbeans, IntelliJ and many other Java IDE tools.  Why BlueJ is picked as one of the tool? 

Why BlueJ used first?
Appendix B: eC Learning Channel Review and Recent Changes to the Courses
1 Lecture 00:34

Keep the video access to the eC Learning Channel reviews for all courses in recent month. 

eC Learning Channel Reviews
About the Instructor
Dr. Eric Chou
3.8 Average rating
149 Reviews
6,322 Students
4 Courses
IEEE Senior Member, an engineer and an inventor

I love computational research and its application to real world. i have involved in many large-scale computer/communication product research development in many world-leading company such as HP, Micrel, and many startups. I also involved in founding a startup company. I also enjoy sharing my ideas through teaching. I hold many US and international patents in technical fields such as software development, mobile computing, IC design and communication receiver design. I am also a certified coach in Taekwondo in both UAST and AAU. 

I also serve as an adjunct faculty for on-line M.S. program in Computer Science/Data Science at Lewis University, IL, USA.