DaryaAndreyuk / PetStoreAPITesting

API Testing portfolio project
https://petstore.swagger.io/#/
1 stars 0 forks source link

Add Allure support #6

Open topsycreed opened 6 days ago

topsycreed commented 6 days ago

1) You need to add Allure dependency + Allure rest assured dependency (to automatically save request/response to Allure attachments). Example https://github.com/topsycreed/superheroApi/blob/master/build.gradle.kts 2) Add annotations for tests and for steps (methods inside controller). See examples: https://github.com/topsycreed/superheroApi/blob/master/src/test/java/controller/SimpleController.java and https://github.com/topsycreed/superheroApi/blob/master/src/test/java/FluentApiWithAllureTests.java 3) Now you will probably need to have your custom assert methods to be able to add @Step annotation as well to see what you are asserting in the test. Example: https://github.com/topsycreed/superheroApi/blob/master/src/test/java/controller/HttpResponse.java 4) Add filter inside controller to save request/response to Allure attachments. public SimpleController() { RestAssured.defaultParser = Parser.JSON; this.requestSpecification.contentType(ContentType.JSON); this.requestSpecification.baseUri(configProperties.getBaseUrl()); this.requestSpecification.filter(new AllureRestAssured()); } 5) Remove prettyPrint() from code since now you can get data from Allure.

DaryaAndreyuk commented 5 hours ago

https://github.com/DaryaAndreyuk/PetStoreAPITesting/pull/7