Master JUnit 5 for Java developers

Understand JUnit architecture

Understand and create tests using assertions with hands on coding

Create different types of tests – repeated, conditional, nested etc…

Create TestSuites

Generate JUnit reports

Requirements

  • Basic Java knowledge

Description

This course is for Java developers who are trying to learn JUnit5 to test their code.

JUnit is probably the most widely used unit testing framework for Java developers. It is the next iteration of JUnit after Junit4 and has a number of new features added.

Knowing how to test your code automatically and enabling your code to be seamlessly tested as part of a CICD pipeline is a “must have” for any developer.

With this course you learn:

JUnit 5 architecture – You learn the basic architecture of JUnit5 and how it builds on top of the JUnit testing platform.

Lifecycle annotations – @Test, @BeforeEach, @AfterEach, @AfterAll @BeforeAll

Testing using assertions – You learn to test for equality, null, exceptions etc…

Various testing scenarios – Write test cases using @RepeatedTest, @ParameterizedTest, @ConditionalTest

Grouping tests – group various tests using @Nested and @Suite annotations.

Reporting test results using maven. With just a few additions to your maven configuration, you will be able to publish these results to a web-page and also share it with your team.

All of the coding will be done on Eclipse. However, if you are familiar with IntelliJ, that should be fine too.

The course will be completely hands on, except when it is required to explain concepts.

Who this course is for:

  • Java developers and anyone interested in building robust Java applications

Course content

8 sections • 21 lectures • 49m total lengthExpand all sections

Course Introduction1 lecture • 2min

  • Introduction01:34

JUnit5 Architecture and Environment Setup2 lectures • 4min

  • JUnit Architecture01:56
  • Environment Setup01:56

Your first JUnit test3 lectures • 7min

  • Section Introduction00:36
  • Creating test cases with a custom folder structure02:43
  • Creating test cases using Maven03:54

JUnit lifecycle and assertions7 lectures • 14min

  • JUnit Lifecycle annotations01:07
  • Assertions Introduction00:56
  • Assertions – 102:32
  • Assertions – 201:57
  • Assertions – 302:35
  • Before and After annotations04:11
  • Naming Tests01:08

Types of JUnit testing4 lectures • 15min

  • Enable and Disable Tests02:42
  • Ordering the sequence of test cases01:44
  • Repeated tests03:05
  • Parameterized tests07:19

Grouping tests2 lectures • 5min

  • Grouping tests using @Nested01:20
  • Grouping tests using @Suite03:41

Reporting test results1 lecture • 2min

  • Reporting using maven site02:22

Conclusion1 lecture • 1min

  • Thank you!00:21

Best Practical Java TDD(Test Driven Development)with JUnit 5

Fully understand Java TDD(Test Driven Development)

Fully understand TDD Three Phases(Red-Green-Refactor) workflow

Hands-on Arithmetic Expression Implementation

Fully understand Java Stack Data Structure

Requirements

  • Java Development Experiences
  • JUnit 5 Experiences
  • Apache Maven

Description

This course is a TDD best practical tutorial, i will tutorial the TDD concepts at the second section by high level and details explain development work flow. TDD provides several benefits:

  1. It can enable faster innovation and continuous delivery because the code is robust.
  2. It makes your code flexible and extensible. The code can be refactored or moved with minimal risk of breaking code.
  3. The tests themselves were tested. A key characteristic of a test is that it can fail, and the development team verifies that each new test fails.
  4. The code that is  designed easy to test.
  5. The requirements are implemented with little to no wasted effort because only the function that will be implement.

At the third and fourth section we implement the arithmatic expression by three version

  1. string textual split
  2. regular expression
  3. Stack with infix to postfix and then evaluate

finally we will implement the result of: (13 + 4) * 2 + 3^2 = ?

Test Driven Development (TDD) is software development approach in which test cases are developed to specify and validate what the code will do.

Test-Driven Development starts with designing and developing tests for every small functionality of an application.

TDD rooted in extreme programming(XP), and is one of the best pracitice of  Agile methodology.

Who this course is for:

  • Java Developer
  • Java Develop Engineer
  • Scala/Koltin/Clojure Develop Engineer

Course content

5 sections • 19 lectures • 1h 42m total lengthExpand all sections

Introduction1 lecture • 2min

  • Course Introduction01:47

TDD(Test Driven Development) Introduction3 lectures • 8min

  • What is TDD?01:16
  • Red-Green-Refactor phase introduction02:58
  • TDD development workflow explanation03:29

TDD Practice Arithmetic Expression (Regular Expression) Version 1,26 lectures • 39min

  • Arithmetic Expression API Skeleton design03:23
  • Develop unit test code(Red Phase)05:01
  • Develop SimpleExpression let unit testing pass(Green Phase)05:40
  • Rethink the source code and test code(Refactor)10:12
  • Append more test cases re-enter Red Phase05:04
  • Enhancement source code let unit testing pass(Green Phase)09:51

TDD Practice Arithmetic Expression(Stack & Postfix)Version 38 lectures • 54min

  • Append new more complex requirements re-enter Red Phase02:30
  • Implement Stack<T> data structure08:19
  • Infix to Postfix algorithm detailed explanation09:13
  • Infix to Postfix algorithm implementation11:15
  • Infix to Postfix algorithm implementation simple validation03:15
  • Postfix expression algorithm detailed explanation05:40
  • Postfix expression algorithm implementation08:58
  • Execution test cases verify complex arithmetic expression function04:26

Appendix1 lecture • 1min

  • Course source code and ppt00:02