Skip to content

API automation framework using Java, RestAssured, TestNG etc.

Notifications You must be signed in to change notification settings

shashankgumte/api-automation-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

API Testing Framework

Description This is a Java-based API testing framework designed to automate testing of RESTful APIs. It utilizes TestNG for test execution, Rest Assured for API requests, and Allure for reporting.

Features

  • Supports various HTTP methods (GET, POST, PUT, DELETE).
  • Provides request/response validation.
  • Enables data-driven testing.
  • Generates comprehensive test reports using Allure.
  • Integrates seamlessly with CI/CD pipelines.
  • Highly customizable and extensible.

Setup Instructions

  1. Prerequisites:
  • Java JDK 8 or higher installed.
  • Maven installed.
  • IDE (e.g., IntelliJ IDEA, Eclipse).
  1. Installation:
  • Clone the repository to your local machine. git clone https://github.com/shashankgumte/api-automation-framework.git
  1. Configuration:
  • Modify the config.properties file to specify base URLs, authentication details, or any other configuration parameters.
  1. Dependencies:
  • Add required dependencies in the pom.xml file.
  1. Build:
  • Build the project using Maven. mvn clean install

Usage

  1. Writing Tests:
  • First Add helper method(GET,POST) e.g like findPetsByStatus() in com/example/api/helpers/petstore/PetServiceHelpers.java
  • Add assertion methods in related file like e.g. assertStatusCode() in com/example/api/helpers/petstore/PetServiceHelpers.java
  • Add test cases at src/test/java by calling api and assertion methods present in related helper file e.g. com/example/api/tests/petstore/TestPetStoreAPIs.java
  1. Executing Tests: Run tests using Maven or your IDE. mvn test

  2. Generating Reports: Generate Allure reports after test execution. allure generate --clean && allure open

Best Practices

  • Write clear and descriptive test cases.
  • Use meaningful test data and avoid hardcoding values.
  • Maintain a consistent project structure.
  • Handle errors gracefully and provide informative error messages.
  • Regularly review and refactor test code for readability and maintainability.

Contributing

  • Report any bugs or issues through GitHub's issue tracker.
  • Submit feature requests or enhancements.
  • Contribute code improvements or fixes via pull requests.

Acknowledgements

API_Testing_Framework Tree Structure:

├───src
│   ├───main
│   │   └───java
│   │       └───com
│   │           └───example
│   │               └───api
│   │                   ├───constants {for maintaing constants}
│   │                   ├───utils {for maintaing utility methods}
│   │                   ├───helpers {for adding helper methods for APIs}
│   │                   └───model {pojo for more better assertions}
│   │                        └───petstore   
│   │                           ├───Category.java
│   │                           ├───Pet.java
│   │                           └───Tag.java
│   │                    
│   └───test
│       ├───java
│       │    └───com
│       │        └───example
│       │            └───api
│       │               └───tests
│       │                       └───TestPetStoreAPIs.java {actual test}
│       │ 
│       ├───resources
│              └───petstore
│                    └───Response_FindPetByStatus  
├───resource
│   └───config.properties { properties file}
├───pom.xml 
├───allure-results { allure reports}
└───README.md

About

API automation framework using Java, RestAssured, TestNG etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages