Java JUnit for Unit Testing with TestNG, Mockito, EclEmma

JUnit 4.0, Unit Testing, Automatic Software Testing using JUnit, TestNG, Eclipse, EclEmma, Mockito, BlueJ)
4.6 (20 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.
628 students enrolled
25% off
Take This Course
  • Lectures 51
  • Length 6.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


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


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

About This Course

Published 4/2016 English

Course Description

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

What are the requirements?

  • Some degree of involvement in Java Programming

What am I going to get from this course?

  • 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.

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

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.


Section 1: Introduction

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


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.


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

My Udemy:

Youtube channel:





Section 2: Introduction to JUnit Software Testing

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


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


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


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


Use Eclipse for JUnit Testing


Eclipse library files. 


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

5 questions

Quiz on Introduction to JUnit and the Software Testing

Section 3: JUnit Framework

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.


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


JUnit Annotations Explanation


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


Explain and provide code example for Annotation @Ignore


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


Test if a program pass a certain Time Limit 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.


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


Parameterized Test Fixture for a simple addition method.


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

11 questions

JUnit Framework and Building Test Fixtures and Test Cases. 

Section 4: JUnit Concept

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


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

Section 4 Quiz:
5 questions
Section 5: White Box Testing

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


Demonstrate how to design a test program for a loop.


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


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.


Overview of Test Coverage using White Box Testing.  And, white box testing techniques Part 1: 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. 


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. 


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

Section 5 Quiz:
5 questions
Section 6: Black Box Testing

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


Overview of various 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. 


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. 

All Pairs Testing
Section 6 Quiz:
10 questions
Section 7: Advanced Testing Topics

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


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


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


Introduction to Mockito API package and its 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.


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


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


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


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


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

Section 7 Quiz:
6 questions
Section 8: Wrap-up

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)


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. 

Section 9: Appendix A: Software Issues

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


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

Section 10: Appendix B: eC Learning Channel Review and Recent Changes to the Courses

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

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Dr. Eric Chou, 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.

Ready to start learning?
Take This Course