Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active September 11, 2022 20:29
Show Gist options
  • Select an option

  • Save eliasnogueira/4ab40681e946d0c6e4b19a0279949192 to your computer and use it in GitHub Desktop.

Select an option

Save eliasnogueira/4ab40681e946d0c6e4b19a0279949192 to your computer and use it in GitHub Desktop.
Presentation about Rest-Assured and OpenAPI tools

Title

How to fast generate your API Test with OpenAPI Tools and Rest-Assured

Elevator pitch

API testing is, nowadays, a common activity for any team. Some still use record-and-play or tools that provide an IDE because it accelerates the test creation at the beginning, but in the mid to long term, it does not scale. Most of them have reasons: lack of programming skill, patterns, or simply time to do it.

In this presentation, you will learn how to speed up the API test automation using Java and Rest-Assured while the OpenAPI tools will create all the standard code to deal with the HTTP requests

Description

The creation of API Test Automation using Java and Rest-Assured might be boring because it always follows the same repeated pattern: creating the code to make the HTTP requests, the model classes used in the responses, the object mapping, and the tests.

With the usage of the OpenAPI Tools, we can quickly generate the client code and the test stubs, speeding up the development process.

You will also learn the possible problems during its adoption that can add more maintenance effort and how to solve it with abstractions.

Approaches

You will learn how to use an OpenAPI specification to automatically generate the client code to use in your test, as we will call it basic usage. As the first improvement, you will learn how to use templates and automatically create custom client and test code. And as the ultimate improvement, you will learn how to decrease the maintenance and focus on a more business-driven development by creating abstractions on top of the client code. Everything will be hands-on.

Tools

  • Java 17 as a programming language
  • Rest-Assured as the API automation library
  • JUnit 5 as the testing support tool
  • Maven as a build and dependency management tool

Takeaways

  • Learn how to speed up the API test automation code
  • Learn how to better organize the API test framework by the application of abstraction
  • Have a concrete example that can be easily applied at work in any context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment