Build robust API tests with RestAssured
This workshop will show you how to use a different approach from SpringTest or any other tool to build robust API tests in the integration later or intra-services.
Rest-Assured is a well-known Java DSL for testing REST services, giving software engineers a lot of freedom during the test automation process creation.
The workshop will start with the RestAssured basics and how we can use any REST API methods in a test, followed by some features such as authentication, request and response specification, and authentication.
After all the basic approaches you will learn how to apply some design and testing patterns such as Base Test Class and Test Data Factory to remove all code duplication. To enable a more robust architecture you will learn how to create abstraction on top of the auto-generated client code, creating a service abstraction to deal with different requests. This will allow you to extend the API test coverage and think about integration tests without mocks!
This will be what you will learn during the workshop:
- Basic Rest-Assured concepts
- Request and Response specifications
- Filters
- How to automate any test given the REST API methods
- How to deal with authentication
- How to build a robust framework for intra-service testing using:
- OpenAPI library to generate the client code
- Abstractions for REST configuration, client definition, and service definition
- Java 17
- RestAssured as the API test library
- AssertJ as the assertion library
- DataFaker as data generation
- a SpringBoot application to test
- Laptop
- JDK 17 installed
- Any IDE
- Partial internet access is required (only to download the libraries for the first time)
- Learn how to test microservices with the possibility of easily extending their coverage
- Have a full workable example to reproduce at work