Course: Unit Testing with JUnit

$180.29 incl. vat


duration: 8 hours |

Language: English (US) |

access duration: 180 days |


JUnit is an open-source unit-testing framework and can be used by Java developers who use a test-driven development methodology. The platform allows you to write and run repeatable tests on parts of your code. This course is a quick theoretical and practical introduction to the JUnit framework.

You'll delve into the process of software testing, unit testing with JUnit, and how to write a simple Java app. Next, you'll cover assertions, a collection of utility methods that helps determine the status of test cases. Further more, you'll discover the use of annotations, which allow you to add a special form of syntactic metadata to Java source code for better code readability and structure. You'll also learn how to set up a particular test case to run multiple times using the RepeatedTest annotation. Finally, you will learn about using Maven and JUnit ConsoleLauncher to execute specific test cases in your application.


After completing this course you are ready to use JUnit in your daily work.


You have intermetiate experience with unit testing and Java development.

Target audience

Software Developer, Tester


Unit Testing with JUnit

8 hours

Unit Testing: An Introduction to the JUnit Framework

  • JUnit, an open-source unit testing framework, can be used by Java developers who employ a test-driven development methodology. The platform allows you to write and run tests on sections of code repeatedly. Use this course as a quick theoretical and hands-on introduction to the JUnit framework.
  • Begin by looking at the process of software testing in general, then unit-testing with JUnit in particular. Next, move on to writing a simple Java app for which you will write JUnit test cases to ensure that its functions behave in line with expectations.
  • Moving along, learn how to use annotations to mark out methods as test cases and set up work to be carried out before test case executions and tasks to be performed after they have run.
  • When you're done, you'll be able to get started writing unit tests for your code using the JUnit framework.

Unit Testing: Assertions & Assumptions in JUnit

  • Assertions, a collection of utility methods in in JUnit, help

  • assert the pass or fail status of test cases. The focus of this
  • course is on assertions that allow you to set the conditions for
  • the success and failure of test cases and assumptions to control
  • the flow of execution in a test case. Begin with simple assert
  • methods to compare the actual values of fields or return values of
  • methods with their expected values. Then, use assertions that
  • ensure your app's performance by failing a test if it takes too
  • long to run, followed by assert methods that check an exception is
  • thrown when invalid data is passed to a method. Next, use
  • assumptions that check for conditions before executing a code block
  • - effectively serving as control structures. When you're done,
  • you'll have a working knowledge of using assertions in JUnit.

Unit Testing: Advanced Annotations in JUnit

  • Using annotations in JUnit allows you to add a special form of syntactic meta-data to Java source code for better code readability and structure. The aim of this course is to give you hands-on experience with JUnit annotations which allow you to set when and how test-cases should be run.
  • Kick things off with a basic annotation to set the name of a test case that appears in execution summaries. Move on to using annotations that simplify the setting of conditions in which test cases should run - based on the current operating system, JRE version, and even environment variables.
  • Explore the definition of a custom annotation composed of a combination of pre-built annotations. Then, apply annotations that control the order of test case executions and enable parallel runs of tests.
  • When you're done, you'll be able to use JUnit annotations for several useful tasks.

Unit Testing: Parameterized JUnit Tests

  • Parameterized tests in JUnit help developers save time by running the same tests repeatedly, using only different inputs, and getting different results. The focus of this course is on scaling test case executions using repeated and parameterized tests.
  • Start by setting a particular test case to run multiple times using the RepeatedTest annotation. Next, move on to defining test cases that can accept parameters. Then, look into different ways in which the parameters can be fed into your test case - from hard-coded values defined in your test class to CSV files and method invocations.
  • Finally, learn how to build a specialized class to pre-process your parameters before being fed into test cases.
  • Upon completion, you'll know how to conduct repeated executions of JUnit test cases with or without parameters.

Unit Testing: Executing JUnit Tests

  • JUnit, the Java unit testing framework, can be used with an IDE

  • but also with a build system, such as Maven. Furthermore, JUnit
  • ConsoleLauncher, a stand-alone application, can be used to launch
  • the platform from the command line. This course will dive deep into
  • the use of Maven as well as the JUnit ConsoleLauncher to run all
  • and specific test cases in your application. Begin by running all
  • test cases you have written for your app using Maven. Then run
  • specific tests and define groups of tests using JUnit tags. Next,
  • run the tests from the command line. Finally, execute such tests
  • using the JUnit ConsoleLauncher, which can be run from a shell
  • without other tools such as Maven. Upon completing the course,
  • you'll be able to execute JUnit test cases from the command line
  • using Apache Maven and the JUnit ConsoleLauncher.

Course options

We offer several optional training products to enhance your learning experience. If you are planning to use our training course in preperation for an official exam then whe highly recommend using these optional training products to ensure an optimal learning experience. Sometimes there is only a practice exam or/and practice lab available.

Optional practice exam (trial exam)

To supplement this training course you may add a special practice exam. This practice exam comprises a number of trial exams which are very similar to the real exam, both in terms of form and content. This is the ultimate way to test whether you are ready for the exam. 

Optional practice lab

To supplement this training course you may add a special practice lab. You perform the tasks on real hardware and/or software applicable to your Lab. The labs are fully hosted in our cloud. The only thing you need to use our practice labs is a web browser. In the LiveLab environment you will find exercises which you can start immediatelyThe lab enviromentconsist of complete networks containing for example, clients, servers,etc. This is the ultimate way to gain extensive hands-on experience. 


Via ons opleidingsconcept bespaar je tot 80% op trainingen

Start met leren wanneer je wilt. Je bepaalt zelf het gewenste tempo

Spar met medecursisten en profileer je als autoriteit in je vakgebied.

Ontvang na succesvolle afronding van je cursus het officiële certificaat van deelname van

Krijg inzicht in uitgebreide voortgangsinformatie van jezelf of je medewerkers

Kennis opdoen met interactieve e-learning en uitgebreide praktijkopdrachten door gecertificeerde docenten


Once we have processed your order and payment, we will give you access to your courses. If you still have any questions about our ordering process, please refer to the button below.

read more about the order process

What is included?

Certificate of participation Yes
Monitor Progress Yes
Award Winning E-learning Yes
Mobile ready Yes
Sharing knowledge Unlimited access to our IT professionals community
Study advice Our consultants are here for you to advice about your study career and options
Study materials Certified teachers with in depth knowledge about the subject.
Service World's best service


Na bestelling van je training krijg je toegang tot ons innovatieve leerplatform. Hier vind je al je gekochte (of gevolgde) trainingen, kan je eventueel cursisten aanmaken en krijg je toegang tot uitgebreide voortgangsinformatie.

Life Long Learning

Follow multiple courses? Read more about our Life Long Learning concept

read more

Contact us

Need training advise? Contact us!