We should learn Rest Assured since it is one of the most popular tools for testing of REST web services in the modern software development world. There are a few main benefits which its usage on the project gives to you.
First, you should not write much redundant code for project setup. Let’s imagine a case that a new project is started, and you need to set up API automated testing process. In this case, you will need to select tools for this purpose. The best choice will be a well-debugged and tested technology recommended to different testers from all the world. Rest Assured will be the best choice here, since you should not create some template code representing HTTP Connection, request sending logic, and parsing of response.
Second, it is a BDD-like stile library. In this case, the syntax sugar that surrounds HTTP requests and responses with the help of this library makes your code more readable and understandable to different members of your project. From BDD it takes the following keywords such as Given, When, and Then, where given represents preconditions for your test, when represents test actions by themselves, while then shows the expected results for your tests. So, you can clearly understand which part of your code is responsible for HTTP request setup, and which one will represent test asserts.
Finally, Rest Assured may be easily integrated into CI-CD pipelines. This library is written in Java programming language, where JUnit, and TestNG are the main test runners. In its turn, Rest Assured perfectly matches these runners, and doesn’t require some additional setup. Most of the modern CI services such as Jenkins, TeamCity, etc. can easily retrieve test results generated by Java, and one of the test runners, which makes it possible to make Rest Assured tests a part of your CI pipeline.
