This is a Rest API automation test framework built using Java. It provides a simple way to write and run API test cases.
src/test/java/tests
- Contains all the test casessrc/test/java/utils
- Contains utility classes like BaseTestsrc/main/java
- Contains main application codetarget
- Contains generated reports and build artifacts
- Makes HTTP requests to test REST APIs
- Supports GET, POST, PUT, DELETE requests
- Easy configuration using JSON files
- Assertions for status code, headers, body
- Generates HTML test reports
- Parallel test execution
- Extensible framework to add custom code
- Java 17
- Maven
- Clone the repository
- Update
config.json
with the base URL for APIs to test - Add API test cases under
src/test/java/tests
- Run
mvn test
Maven will execute the test cases and generate a test report under target/site/serenity
folder.
- Extend
BaseTest
class to create a test class - Annotate test methods with
@Test
- Use
sendRequest()
methods to make API calls - Use assertions to validate response
@Test public void testCreateUser() {
JSONObject request = new JSONObject(); request.put("name", "John");
Response response = sendRequest("POST", "/users", request.toString());
assertEquals(201, response.statusCode);
JSONObject body = new JSONObject(response.body); assertEquals("John", body.get("name"));
}
- Serenity BDD - Open source library used in the framework
Contributions are welcome! Please create a pull request to contribute to the project.