This tutorial will guide you through the process of running Unit Tests and Integration Tests separately in a Maven-based Spring Boot application. We will use the JUnit Tag feature to group our test cases and separate Unit Tests from Integration Tests. To learn more, check out the Test Java code tutorials page. Create your tests…Read More Running Unit Tests and Integration Tests Separately in Spring Boot
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
Test Plans in Xcode allow us to run Unit Tests and UI Tests with different configurations multiple times. It is very convenient and is very quick. Available Configuration Options Each Test Plan can have a different configuration. Launch arguments and Launch environment variables, Language and region, Sanitizers and Main Thread Checker, Simulated location, UI Testing…Read More Test Plans in Xcode
In this XCTest tutorial, you will learn how to write a unit test that will test if UIButton is connected to @IBOutlet and has @IBAction assigned. For this tutorial, I will create a Single View application project. I will use the default View Controller that XCode creates for all new projects and I will position…Read More XCTest. Test if UIButton is Connected And Has Action
All unit test methods use Assertions to validate the result produced by the System Under the Test and present the user with a test method result. It is the assertion that will make a decision whether the test method is passing or failing. This blog post contains a list of assertions you can use with…Read More A List of XCTest Assertions
In this tutorial, you will learn how to build and run Xcode Unit Tests from the command line. Command Line Tools Package for Xcode To be able to build and test your project using the terminal window you will need to have the Command Line Tools package installed on your machine. If the machine you…Read More Run Xcode Unit Tests From The Command Line
When writing code we come up with method or function names all the time. And it is pretty much up to us developers how to name our methods. When writing Unit Tests in Xcode there are a few little requirements for a test method name which we must follow if we want our test method…Read More Naming iOS Unit Test Methods
There is a number of ways to disable a unit test in Xcode although it might not seem very obvious at first. In this blog post, I will share with you just a few that I personally use from time to time. Why Disable Unit Test? I am a strong advocate to always write unit…Read More How to Disable or Skip Unit Test in Xcode
Unit tests in Xcode can run in different orders. They can run in alphabetical order, randomized or executed in parallel. The default order in which Xcode runs unit tests is alphabetical. In this blog post, you will learn how the alphabetical order works. The Flow of Unit Test Execution For each test method, a new…Read More The Order of Unit Tests in Xcode
When we take the Test Driven Development(TDD) approach to write code we eventually ask ourselves a couple of questions: Have I covered all possible use cases? Have I written enough unit tests? What helps me is writing a bulleted list of functional requirements for the feature I am developing. Having a clear list of things…Read More Swift TDD. How Many Unit Tests to Write?
This blog post will give you a brief introduction to a Test-Driven Development(TDD) in Swift and will demonstrate how you can create a very basic Unit test in Swift to test a User Model Struct that holds the details of the Account Registration form. Assume that you need to follow the Test-Driven development approach to…Read More Swift Unit Test of User Registration Model
This tutorial will teach you how to build a Maven-based Spring Boot project and skip Unit tests. Sometimes, when working on a project, we need to build and run it even though our Unit test is failing. When there is a flailing Unit test, the Maven package and install commands will also fail. This is because…Read More How to Skip Unit Tests in Maven
In this tutorial on Rest Assured, I am going to share with you how to create a test case which sends HTTP Get Request and includes two Query String Request Parameters. Let’s assume we need to test a RESTful Web Service Endpoint which returns a list of users. The URL to our RESTful Web Service…Read More Rest Assured HTTP Request with Query Parameters
In this JUnit 5 and Rest Assured tutorial, I am going to share with you how to add JUnit 5 and Rest Assured support to your Spring Boot project. It will be more than that actually. This tutorial will cover: Add JUnit 5 and Rest Assured to Spring Boot Project, Create a new JUnit 5…Read More Create a JUnit 5 Test Case with Rest Assured. Video Tutorial.
In this short tutorial on REST Assured you will learn how to get the entire HTTP Response Body when testing your RESTful Web Service Endpoint. Web Service Endpoint Response Let’s assume we have the following Web Service Endpoint URL and when HTTP GET request is made to this Web Service Endpoint a JSON representation of…Read More REST Assured Get HTTP Response Body