Allure REST Assured
Enrich your Allure Report test reports with the detailed information about the HTTP requests performed via REST Assured.
This integration is compatible with all JVM-based adapters of Allure Report, including Allure JUnit 5, Allure Cucumber-JVM, Allure Spock, and more.
To enable the integration in your project:
Make sure you have the Allure Report adapter enabled for the test framework you use.
See the instructions in the adapter's documentation in Frameworks.
Add the Allure REST Assured integration to your project's dependencies.
For every HTTP request you make in your tests, pass an instance of
AllureRestAssured
to the REST Assured'sfilter()
method.The example below shows usage of Allure REST Assured in a JUnit 5 test.
Javaimport io.qameta.allure.restassured.AllureRestAssured; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; class TestMyWebsite { @Test void testSomeRequest() { given() .filter(new AllureRestAssured()) .get("https://jsonplaceholder.typicode.com/todos/1") .then() .body("userId", equalTo(1)); } }
Both the request and the response will be added to the test results as attachments.
Some aspects of the
AllureRestAssured
behavior can be affected via its configuration methods.Run your tests and generate a test report the same way as you would do usually.