Gradle tutorial for WildFly users

This is an updated tutorial for getting started with Gradle. You will learn how to compile and assemble a Jakarta EE 10 application in a matter of minutes and we will deploy it on WildFly. Installing gradle More and more developers are turning to Gradle for creating high performance builds. There are several advantages when … Read more

Getting started with TestNG

TestNG is a testing framework inspired by JUnit but introducing a whole set of new functionalities. In this tutorial we will walk through the set up and execution of some example tests with TestNG.

Read more

TestNG Configuration file in a nuthell

TestNG is a testing framework inspired by JUnit but introducing a whole set of new functionalities. Let’s see how to create a sample project which uses a testng.xml configuration file to drive a Test suite TestNG Example Test suite Let’s write a proof of concept Hello World example with TestNG. In order to use it, … Read more

Getting started with JUnit 5

JUnit is the most popular Java Testing framework. It is explicitly recommended for Unit Testing of Java applications. JUnit framework is also well integrated with common IDE such as Eclipse and IntelliJ Idea which allows quick and easy generation of test cases and test data. In this tutorial we will learn how to code a … Read more

Getting started with JUnit Assertions

In this tutorial we will learn how to use JUnit assertions. An assertion is one of a number of static methods on the org.junit.jupiter.api.Assertions class. Assertions are used to test a condition that must evaluate to true in order for the test to continue executing. If an assertion fails, the test is halted at the … Read more

Getting started with JUnit and IntelliJ Idea

In this tutorial we will learn how to create a JUnit 5 project using IntelliJ. We will be at first creating a simple Maven Project, then we will add a basic Class and a JUnit Test for it. Creating an IntelliJ Project: Requirements: Download IntelliJ Community edition from: https://www.jetbrains.com/idea/download/ Install IntelliJ Idea, then launch it: … Read more

How to control JUnit Tests order

JUnit tests are executed using a deterministic (but not obvious) criteria, however it’s possible to define the exact order of Test execution. This tutorial shows how to do it. Even if true unit tests should not rely on a precise order in which they are executed, sometimes it is needed to enforce a specific order … Read more

How to run repeated tests in JUnit

The @RepeatedTest annotation enable to run multiple times single tests in JUnit 5. The number of times the test will be executed can be configured as parameter to @RepeatedTest annotation. Example: @Test @RepeatedTest(5) void addNumber() { Calculator calculator = new Calculator(); Random rand = new Random(); int n = rand.nextInt(50); Assertions.assertEquals(n*2, calculator.add(n, n), “Checking calculator … Read more