Unit testing

This tutorial will guide you on how to incorporate JUnit support into your Spring Boot application based on Maven. Spring Boot Starter Test Dependency To add JUnit and Mockito support to your Maven-based Spring Boot application, include the following dependencies in the <dependencies> section of your pom.xml file: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> By adding…

Read More JUnit Support in Spring Boot

There are different ways to test that the UIViewController has been successfully pushed onto the navigation stack and in this tutorial, I will cover a few of them. For this tutorial, I have created a simple project with two view controllers on the Main.storyboard. The very first view controller has a button. When the button…

Read More Test View Controller Push to Navigation Controller

There are a few different ways to Unit test code that throws an Error in Swift and my preferred way is to use the XCTAssertThrowError and XCTAssertNoThrows. I will also share with you how to use the traditional way of handling an error with the do-try-catch. Error To Be Thrown Let’s assume that we have…

Read More Unit Testing Code That Throws Error in Swift

There are different ways to load UIViewController in a Unit Test and in this tutorial you will learn three of them. Loading UIViewController from Main.storyboard, Loading UIViewController from XIB, Loading UIViewController that is not on the Main.storyboard and does have an interface XIB file. This is a type of UIViewController that creates views programmatically. Loading…

Read More Ways to Load UIViewController in a Unit Test

When writing unit tests, developers try to follow the F.I.R.S.T principle as much as possible. F.I.R.S.T is a combination of multiple principles. Let’s learn what these are. Fast The first letter in the F.I.R.S.T principle stands for – Fast. Unit tests are small pieces of code that perform one, specific task. Because unit tests are…

Read More The F.I.R.S.T. Principle in Unit Testing