Thanks you providing me an opportunity to work on this assignment. I built a RestApi Framework to test these apis.
- Set Up Application Under Test
- Tech Stack Used in Framework
- Overview On Framework
- How to run the tests
- Continuous Integration
- Reporting
Refer this ReadME to setup the application to test the APIs.
Framework is built on Java and below are the requirements to run the tests
- Java 1.8
- Maven 3.5.0 or more
- RestAssured 4.4.0
- TestNG 6.14.3
- AssertJ 3.11.1
- Java Faker 1.0.2
- Lombok 1.18.6
- Jackson 2.9.8
- Snakeyaml 1.26
- Api Testing Framework is built on RestAssured
- Frameworks provides flexibility to invoke any kind of API(POST, PUT, PATCH, GET, DELETE etc) inside test using RestBuilder.
- Framework creates the log file puts in folder /logs under the root of the project which can be used for debugging.
- Framework supports parallel test execution as we use TestNG as testing framework
- Supports for Data Driven Testing (TestNG Supports Data Driven Testing Using dataProviders)
- Uses Snakeyaml to load the configuration
- Uses AssertJ as assertion library which provides powerful features and allows us to construct fluent assertions
- In future, if underlying rest framework will be changed, it will have no impact on tests
- Go to root folder of the project
- From the command line execute command
mvn test -Pe2e -DautEnvironment=DEV -DenableLogs=true
[enableLogs flag is to enable rest assured logs for API request and response] - If you want to run multiple tests in parallel, please change thread count in testng.xml file.
- Jenkins
- Github Actions:
- Code is intergrated with Github actions
- When the merge request is created or pushed code to master, it set up the dev environment (APIs will be available to hit) and tests run against them
- Allure reports will be created and published to github pages here
- Once the you run the tests, under root folder, you will see a folder with name
target/surefire-reports
will be generated. In the foldersurefire-reports
you will see emailable-report.html and index.html which tells you about the overall test run status. - Allure reports will be generated and published to github pages.