Learn by Example: JUnit
4.2 (21 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.
1,450 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learn by Example: JUnit to your Wishlist.

Add to Wishlist

Learn by Example: JUnit

A comprehensive guide to JUnit with 25 solved examples
4.2 (21 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.
1,450 students enrolled
Created by Loony Corn
Last updated 12/2016
English
Curiosity Sale
Current price: $10 Original price: $50 Discount: 80% off
30-Day Money-Back Guarantee
Includes:
  • 3 hours on-demand video
  • 25 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Test functionality of Java applications using JUnit
  • Write test cases using Assertions and Matchers
  • Create mock objects to test interdependent classes
  • Run multiple test classes under different conditions
View Curriculum
Requirements
  • Experience in Java programming and familiarity with using Java frameworks
Description

JUnit is one of a family of unit testing frameworks all built with the same philosophy. To abstract the programmer away from the mechanics of running tests. You concentrate on testing the functionality of the application, and the logistics of running, monitoring and displaying results is taken care of by the framework.

In this course, we’ll be writing simple tests using all the different features of JUnit tests. Using 25 solved examples, you'll get a complete overview of the JUnit framework and all the functionality within.

What's covered?

1) Assertions : the fundamental component of any Junit test
2) Matchers : Write complicated tests in a very readable way. Implement your own custom matchers
3) Assumptions : Check for preconditions and external dependencies

4) Fixtures : Setup and Cleanup for your tests

5) Runners : Understand what goes on under the hood in JUnit. Use different runners to run multiple test classes with different conditions and parameters
4) Mockito : Understand the concept of mock objects and use the Mockito framework to run tests on interdependent classes.


Using discussion forums

Please use the discussion forums on this course to engage with other students and to help each other out. Unfortunately, much as we would like to, it is not possible for us at Loonycorn to respond to individual questions from students:-(

We're super small and self-funded with only 2 people developing technical video content. Our mission is to make high-quality courses available at super low prices.

The only way to keep our prices this low is to *NOT offer additional technical support over email or in-person*. The truth is, direct support is hugely expensive and just does not scale.

We understand that this is not ideal and that a lot of students might benefit from this additional support. Hiring resources for additional support would make our offering much more expensive, thus defeating our original purpose.

It is a hard trade-off.

Thank you for your patience and understanding!


Who is the target audience?
  • Yep! Software Engineers who are looking to learn how to test Java applications
  • Yep! Students learning Java who want to get familiar with testing
Students Who Viewed This Course Also Viewed
Curriculum For This Course
26 Lectures
02:46:50
+
You, This Course and Us
1 Lecture 01:44

Let's start with an introduction. We'll understand what JUnit can do for us and what's covered in the course. 

Preview 01:44
+
Getting Started with JUnit Tests and Assertions
3 Lectures 28:18

Write your very first JUnit test and understand what is happening when a test is run. 

Example 1 : The @Test Annotation : Writing a test
11:42

What are the different things you need to do in a test? Every test is made up of 3 basic steps - understand this to test any class. 

Preview 07:38

The Assert class provides many methods to check different conditions against different types of objects. 

Example 3: Assertions
08:58
+
Granular Checks with Matchers
4 Lectures 26:50

Make complex checks more readable with the help of matchers. 

Example 4: assertThat and Matchers
06:27

Understand the different methods available in the Matchers class

Preview 07:56

Error messages for Matchers are very verbose and help with debugging! 

Example 6: Using Matchers for Debugging
04:52

Implement a custom matcher, when you have a special requirement not already handled! 

Example 7: Implementing a Custom Matcher
07:35
+
Assumptions
1 Lecture 07:17

Use Assumptions to check that preconditions and external dependencies are set up correctly.

Example 8: Checking Preconditions with Assumptions
07:17
+
Fixtures
1 Lecture 07:43

Fixtures are used for setup and cleanup. Ex: Setting up common objects, starting and closing server/database/file connections. 

Example 9: Using Fixtures for Setup and Cleanup
07:43
+
Working with Different TestRunners
5 Lectures 44:27

JUnit allows you to specify different Test Runners, each with different ways to control how your tests are run

Example 10: The @RunWith Annotation
14:35

Run multiple tests at at time.

Example 11: Aggregating tests in a Suite
05:12

Run tests with different values for certain parameters.

Example 12: Parameterized Tests
09:26

Example 13: Running Subsets of Tests
07:00

Run tests with different sets of assumptions.

Example 14: Theories
08:14
+
Controlling Test Behavior with Rules
9 Lectures 40:04
Example 15: External Resource Rules
06:26

Example 16: The Temporary Folder Rule
04:12

Example 17: Error Collector Rule
04:56

Example 18: Verifier Rule
03:29

Example 19: Test Watcher Rule
06:59

Example 20: TestName Rule
03:47

Example 21: ExpectedException Rule
04:12

Example 22: Timeout Rule
03:15

Example 23: Class Rule
02:48
+
Mockito : The Mock Object Framework
2 Lectures 10:27
Example 24: Creating Mock Objects and Verifying Interactions
06:01

Example 25: Stubbing Objects for Expected Results
04:26
About the Instructor
Loony Corn
4.3 Average rating
4,997 Reviews
38,978 Students
74 Courses
An ex-Google, Stanford and Flipkart team

Loonycorn is us, Janani Ravi and Vitthal Srinivasan. Between us, we have studied at Stanford, been admitted to IIM Ahmedabad and have spent years  working in tech, in the Bay Area, New York, Singapore and Bangalore.

Janani: 7 years at Google (New York, Singapore); Studied at Stanford; also worked at Flipkart and Microsoft

Vitthal: Also Google (Singapore) and studied at Stanford; Flipkart, Credit Suisse and INSEAD too

We think we might have hit upon a neat way of teaching complicated tech courses in a funny, practical, engaging way, which is why we are so excited to be here on Udemy!

We hope you will try our offerings, and think you'll like them :-)