A comprehensive, maintainable API testing framework built with REST Assured, TestNG, and Maven for testing Library Management API endpoints.
- Overview
- Framework Architecture
- Project Structure
- Key Components
- Prerequisites
- Running Tests
- Allure Reports
- CI/CD Integration
- Dependencies
- Test Execution Flow
- Best Practices
This framework provides a robust solution for API testing with the following features:
- REST Assured Integration: Powerful API testing with fluent assertions
- POJO-based Request/Response Handling: Type-safe data models
- JSON Schema Validation: Automatic response structure validation
- Reusable Specifications: Centralized request/response specifications
- Test Data Builders: Dynamic test data generation
- Automatic Retry Mechanism: Failed tests are automatically retried (up to 2 retries)
- Allure Reports: Beautiful, interactive test reports with detailed test execution history
- CI/CD Integration: GitHub Actions workflow for automated test execution
- TestNG Integration: Advanced test execution and reporting
- Maven Build System: Dependency management and test execution
- Add Book:
POST /Library/Addbook.php - Get Book by ID:
GET /Library/GetBook.php?ID={bookId} - Get Book by Author:
GET /Library/GetBook.php?AuthorName={authorName} - Delete Book:
POST /Library/DeleteBook.php
The framework follows a layered architecture pattern for better maintainability and reusability.
graph TB
subgraph "Test Layer"
AT[AddBookTest]
GT[GetBookTest]
DT[DeleteBookTest]
BT[BaseTest]
end
subgraph "Builder Layer"
TDB[TestDatabuilder]
SB[SpecBuilder]
end
subgraph "POJO Layer"
ABR[AddBookRequest]
ABRes[AddBookResponse]
GBR[GetBookByIdResponse]
DBR[DeleteBookRequest]
end
subgraph "Utility Layer"
TU[TestUtils]
end
subgraph "Listeners Layer"
RT[RetryTransformer]
RAnalyzer[RetryAnalyzer]
end
subgraph "Resources"
JSON[JSON Schemas]
end
subgraph "External"
API[Library API]
RA[REST Assured]
end
AT --> BT
GT --> BT
DT --> BT
BT --> SB
AT --> TDB
GT --> TDB
DT --> TDB
TDB --> TU
TDB --> ABR
TDB --> DBR
AT --> ABR
AT --> ABRes
GT --> GBR
DT --> DBR
AT --> JSON
GT --> JSON
AT --> RA
GT --> RA
DT --> RA
RA --> API
SB --> RA
RT --> AT
RT --> GT
RT --> DT
RT --> RAnalyzer
style AT fill:#e1f5ff
style GT fill:#e1f5ff
style DT fill:#e1f5ff
style BT fill:#fff4e1
style TDB fill:#e8f5e9
style SB fill:#e8f5e9
style TU fill:#f3e5f5
style RT fill:#fff9c4
style RAnalyzer fill:#fff9c4
style JSON fill:#fce4ec
- Test Layer: Contains all test classes that extend
BaseTest - Builder Layer: Provides test data builders and request/response specifications
- POJO Layer: Java objects representing API request/response models
- Utility Layer: Helper methods for test data generation
- Listeners Layer: TestNG listeners for retry mechanism and test execution hooks
- Resources: JSON schema files for response validation
RestAssuredSampleFramework/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── org/umangqa/library/
│ │ │ ├── builders/
│ │ │ │ └── TestDatabuilder.java # Test data generation
│ │ │ ├── pojo/
│ │ │ │ ├── addbook/ # Add book request/response POJOs
│ │ │ │ ├── deletebook/ # Delete book request/response POJOs
│ │ │ │ └── getbook/ # Get book response POJOs
│ │ │ ├── listeners/
│ │ │ │ ├── RetryAnalyzer.java # Retry logic implementation
│ │ │ │ └── RetryTransformer.java # TestNG annotation transformer
│ │ │ ├── specs/
│ │ │ │ └── SpecBuilder.java # Request/Response specifications
│ │ │ └── utils/
│ │ │ └── TestUtils.java # Utility methods
│ │ └── resources/
│ │ └── schemas/ # JSON schema validation files
│ │ ├── addBookResponse.json
│ │ └── getBookByIdResponse.json
│ └── test/
│ ├── java/
│ │ └── org/umangqa/library/tests/
│ │ ├── BaseTest.java # Base test class with setup
│ │ ├── AddBookTest.java # Add book test cases
│ │ ├── GetBookTest.java # Get book test cases
│ │ └── DeleteBookTest.java # Delete book test cases
│ └── resources/
│ └── allure.properties # Allure configuration
├── .github/
│ └── workflows/
│ └── library-api-tests.yml # GitHub Actions CI/CD workflow
├── testng.xml # TestNG suite configuration
├── pom.xml # Maven dependencies and configuration
└── README.md # This file
Base class for all test classes that sets up common configuration:
public abstract class BaseTest {
@BeforeClass
public void setup() {
RestAssured.requestSpecification = SpecBuilder.getRequestSpec();
}
}Purpose: Initializes REST Assured with default request specifications before test execution.
Centralized builder for request and response specifications:
- Request Specification: Sets base URI, content type, and headers
- Response Specification: Validates status code and content type
Features:
- Configurable base URL via system property (
baseUrl) - Default base URL:
http://216.10.245.166 - Reusable across all tests
- Allure Integration: Automatically captures HTTP requests and responses for Allure reports via
AllureRestAssuredfilter
Factory class for creating test data objects:
addBookRequestRandomPayload(): Generates random test dataaddBookRequestPayload(): Creates payload with specific valuesdeleteBookRequestPayload(): Creates delete request payload
Utility methods for test data generation:
generateRandomString(): Generates random alphanumeric stringsgenerateRandomNumberString(): Generates random numeric strings
Type-safe Java objects for API requests and responses:
- Request POJOs:
AddBookRequest,DeleteBookRequest - Response POJOs:
AddBookResponse,GetBookByIdResponse,GetBookByAuthorResponse
JSON schema files in src/main/resources/schemas/ validate response structure:
- Ensures response matches expected schema
- Catches API contract violations early
- Provides clear error messages
Automatic retry logic for failed tests using TestNG listeners:
Implements IRetryAnalyzer to control retry behavior:
public class RetryAnalyzer implements IRetryAnalyzer {
private int retryCount = 0;
private static final int maxRetryCount = 2;
@Override
public boolean retry(ITestResult result) {
if (retryCount < maxRetryCount) {
retryCount++;
return true; // Retry the test
}
return false; // No more retries
}
}Features:
- Automatically retries failed tests up to 2 times
- Logs retry attempts for debugging
- Configurable maximum retry count
Implements IAnnotationTransformer to automatically apply retry analyzer to all tests:
public class RetryTransformer implements IAnnotationTransformer {
@Override
public void transform(ITestAnnotation annotation, ...) {
if (annotation.getRetryAnalyzerClass() == null) {
annotation.setRetryAnalyzer(RetryAnalyzer.class);
}
}
}Purpose:
- Automatically applies retry logic to all test methods
- No need to manually add
@Test(retryAnalyzer = RetryAnalyzer.class)to each test - Configured in
testng.xmlas a listener
Before running the tests, ensure you have the following installed:
- Java: JDK 21 or higher (Note: pom.xml uses Java 21)
- Maven: 3.6.0 or higher
- Allure (Optional but recommended): For generating interactive test reports
- IDE: IntelliJ IDEA, Eclipse, or VS Code (optional)
# Check Java version
java -version
# Check Maven version
mvn -version
# Check Allure installation (if installed)
allure --versionAllure is recommended for generating beautiful test reports. See the Allure Reports section for installation instructions.
mvn clean testmvn test -Dtest=AddBookTestmvn test -DbaseUrl=http://your-api-url.commvn clean test
# Reports are generated in: target/surefire-reports/After running tests, generate and serve Allure reports:
# Generate Allure report
mvn allure:report
# Serve Allure report (opens in browser)
mvn allure:serveNote: The allure:serve command will automatically open the report in your default browser. The report will be available at http://localhost:port (default port is usually 4040).
# Generate report without opening browser
mvn allure:report
# View the report later by opening:
# target/site/allure-maven-plugin/index.htmlmvn clean test -DsuiteXmlFile=testng.xml- Right-click on
testng.xmlin your IDE - Select "Run" or "Run As TestNG Suite"
The testng.xml file defines the test suite and configures listeners:
<suite name="Library API Suite">
<listeners>
<listener class-name="org.umangqa.library.listeners.RetryTransformer"/>
<listener class-name="io.qameta.allure.testng.AllureTestNg"/>
</listeners>
<test name="API Tests">
<classes>
<class name="org.umangqa.library.tests.AddBookTest"/>
<class name="org.umangqa.library.tests.GetBookTest"/>
<class name="org.umangqa.library.tests.DeleteBookTest"/>
</classes>
</test>
</suite>Listeners Configuration:
RetryTransformeris registered as a listener to automatically apply retry logic to all testsAllureTestNgis registered as a listener to capture test execution data for Allure reports- Failed tests will be automatically retried up to 2 times before being marked as failed
- Open the test class in your IDE
- Right-click on the test method or class
- Select "Run" or "Run As TestNG Test"
The framework includes a GitHub Actions workflow for continuous integration and continuous deployment (CI/CD). Tests are automatically executed on every push and pull request to the main/master branches.
The workflow file is located at .github/workflows/library-api-tests.yml and includes comprehensive CI/CD with Allure report generation and GitHub Pages deployment.
- Push Events: Triggers on pushes to
mainormasterbranches - Pull Request Events: Triggers on pull requests targeting
mainormasterbranches
graph LR
A[Checkout Code] --> B[Set up Java 21]
B --> C[Cache Maven Dependencies]
C --> D[Run API Tests]
D --> E[Download Allure CLI]
E --> F[Generate Allure Report]
F --> G[Upload Allure Artifact]
F --> H[Deploy to GitHub Pages]
style A fill:#e3f2fd
style B fill:#e3f2fd
style C fill:#fff3e0
style D fill:#e8f5e9
style E fill:#f3e5f5
style F fill:#e1bee7
style G fill:#fff9c4
style H fill:#c8e6c9
- Checkout Code: Checks out the repository code
- Set up Java: Configures Java 21 using Temurin distribution
- Cache Maven Repository: Caches Maven dependencies to speed up builds
- Run API Tests: Executes all tests using Maven with the base URL configuration
- Download Allure CLI: Downloads and installs Allure commandline tool (version 2.27.0)
- Generate Allure Report: Generates interactive Allure reports from test results
- Upload Allure Artifact: Uploads Allure report as a downloadable artifact
- Deploy to GitHub Pages: Publishes Allure report to GitHub Pages for easy access
name: API Automation Tests with Allure Report
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
permissions:
contents: write # needed to push to gh-pages
pages: write
id-token: write
jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
- name: Cache Maven repo
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Run API Tests
run: mvn -B clean test -DbaseUrl=http://216.10.245.166
- name: Download Allure CLI
run: |
ALLURE_VERSION=2.27.0
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/$ALLURE_VERSION/allure-commandline-$ALLURE_VERSION.zip -O allure.zip
unzip allure.zip -d allure-cli
echo "$(pwd)/allure-cli/allure-$ALLURE_VERSION/bin" >> $GITHUB_PATH
- name: Generate Allure Report
run: |
allure --version
allure generate target/allure-results --clean -o allure-report
- name: Upload Allure Report Artifact
uses: actions/upload-artifact@v4
with:
name: allure-report
path: allure-report
- name: Deploy Allure Report to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: allure-report
publish_branch: gh-pages- Navigate to the Actions tab in your GitHub repository
- Click on the workflow run to view detailed execution logs
- Check the status of each step in the workflow
- Download Allure reports from the Artifacts section
After each workflow run, Allure reports are automatically generated and can be accessed in multiple ways:
-
Download as Artifact:
- Location: GitHub Actions → Workflow Run → Artifacts →
allure-report - Contents: Complete interactive Allure HTML report
- Usage: Download, extract, and open
index.htmlin a browser
- Location: GitHub Actions → Workflow Run → Artifacts →
-
GitHub Pages (Recommended):
- Location:
https://umangbhatia786.github.io/RestAssuredAPITestingFramework/ - Automatic: Reports are automatically published to GitHub Pages
- Access: View reports directly in your browser without downloading
- Branch: Reports are published to the
gh-pagesbranch
- Location:
To enable GitHub Pages for your repository:
- Go to Settings → Pages in your GitHub repository
- Under Source, select Deploy from a branch
- Select gh-pages branch and / (root) folder
- Click Save
- Your Allure reports will be available at:
https://umangbhatia786.github.io/RestAssuredAPITestingFramework/
- Automated Testing: Tests run automatically on every code change
- Early Bug Detection: Issues are caught before merging to main branch
- Consistent Environment: Tests run in a clean, standardized environment
- Interactive Allure Reports: Beautiful, detailed reports published to GitHub Pages
- Easy Report Access: Reports accessible via GitHub Pages without downloading
- Test Report Archival: Historical test reports are preserved for analysis
- Build Caching: Maven dependencies are cached to reduce build time
- Pull Request Validation: Ensures code quality before merging
- Public Report Sharing: Share test results with stakeholders via GitHub Pages URL
You can customize the workflow by:
- Changing Java Version: Update
java-versionin the workflow file - Modifying Base URL: Change the
-DbaseUrlparameter or use GitHub Secrets - Allure Version: Update
ALLURE_VERSIONvariable to use a different Allure version - Disabling GitHub Pages: Remove the "Deploy Allure Report to GitHub Pages" step if not needed
- Adding Additional Steps: Include steps for notifications, deployments, etc.
- Running Specific Tests: Modify the Maven command to run specific test classes
- Environment Variables: Add secrets or environment variables for sensitive data
For sensitive configuration (like API keys or different base URLs), use GitHub Secrets:
- Go to Settings → Secrets and variables → Actions
- Add a new secret (e.g.,
API_BASE_URL) - Reference it in the workflow:
- name: Run API tests
run: mvn -B clean test -DbaseUrl=${{ secrets.API_BASE_URL }}Tests are executed in the following order based on TestNG annotations:
graph LR
A[AddBookTest<br/>priority=0] --> B[GetBookByIdTest<br/>priority=1<br/>dependsOn: AddBookTest]
B --> C[GetBookByAuthorTest<br/>priority=2]
C --> D[DeleteBookTest<br/>priority=3<br/>dependsOn: AddBookTest]
style A fill:#4caf50
style B fill:#2196f3
style C fill:#2196f3
style D fill:#f44336
Test Dependencies:
GetBookByIdTestandDeleteBookTestdepend onAddBookTestto create a book firstGetBookByAuthorTestruns independently
sequenceDiagram
participant T as Test Class
participant BT as BaseTest
participant SB as SpecBuilder
participant TDB as TestDatabuilder
participant RA as REST Assured
participant API as Library API
T->>BT: Extends BaseTest
BT->>SB: getRequestSpec()
SB-->>BT: RequestSpecification
BT->>RA: Set requestSpecification
T->>TDB: Generate test data
TDB-->>T: Request POJO
T->>RA: Build request with POJO
RA->>API: Send HTTP request
API-->>RA: HTTP response
T->>SB: getResponseSpec(statusCode)
SB-->>T: ResponseSpecification
T->>RA: Validate response
Note over T,RA: Schema validation<br/>Status code check<br/>Content type check
T->>T: Assert business logic
When a test fails, the retry mechanism automatically attempts to re-run the test:
sequenceDiagram
participant TestNG
participant RT as RetryTransformer
participant RA as RetryAnalyzer
participant Test as Test Method
TestNG->>RT: Transform test annotation
RT->>RA: Set RetryAnalyzer
TestNG->>Test: Execute test
Test-->>TestNG: Test Result (FAILED)
TestNG->>RA: retry(result)
RA->>RA: Check retryCount < maxRetryCount
alt Retry Available
RA-->>TestNG: return true
Note over RA: retryCount++
TestNG->>Test: Re-execute test
Test-->>TestNG: Test Result
alt Still Failing
TestNG->>RA: retry(result)
RA->>RA: Check retryCount < maxRetryCount
alt Final Retry
RA-->>TestNG: return true
TestNG->>Test: Final retry attempt
Test-->>TestNG: Test Result (FAILED)
TestNG->>RA: retry(result)
RA-->>TestNG: return false (max retries reached)
else Max Retries Reached
RA-->>TestNG: return false
end
else Test Passes
Note over TestNG: Test marked as PASSED
end
else Max Retries Reached
RA-->>TestNG: return false
Note over TestNG: Test marked as FAILED
end
Retry Behavior:
- Maximum 2 retry attempts per failed test
- Retries happen automatically without manual intervention
- Each retry attempt is logged for debugging
- Test is marked as failed only after all retries are exhausted
The framework is integrated with Allure TestOps for generating beautiful, interactive test reports. Allure automatically captures test execution details, HTTP requests/responses, and provides comprehensive analytics.
- Interactive Dashboards: Visual representation of test execution results
- HTTP Request/Response Capture: Automatically captures all REST API calls with full request/response details
- Test History: Track test execution trends over time
- Detailed Test Steps: Step-by-step test execution breakdown
- Screenshots & Attachments: Support for attaching additional test artifacts
- Retry Information: Shows retry attempts and results
- Test Categories: Organize tests by severity, features, etc.
The framework includes comprehensive Allure integration:
- Allure TestNG Listener: Configured in both
maven-surefire-pluginandtestng.xmlto capture test execution - Allure REST Assured Filter: Integrated in
SpecBuilderto automatically capture HTTP requests and responses - Allure Properties Configuration:
src/test/resources/allure.propertiesconfigures the results directory
The allure.properties file configures where Allure stores test results:
allure.results.directory=target/allure-resultsThis ensures Allure results are stored in the standard Maven target directory for easy access and CI/CD integration.
// SpecBuilder.java
requestSpec = new RequestSpecBuilder()
.setBaseUri(baseUrl)
.setContentType(ContentType.JSON)
.addFilter(new AllureRestAssured()) // Captures HTTP requests/responses
.addHeader("Accept", "application/json")
.build();macOS (using Homebrew):
brew install allureWindows (using Scoop):
scoop install allureLinux:
# Download and install from: https://github.com/allure-framework/allure2/releases
# Or use package managerManual Installation:
- Download Allure from GitHub Releases
- Extract to a directory
- Add to PATH environment variable
Add the Allure Maven plugin to pom.xml:
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.12.0</version>
</plugin># Step 1: Run tests
mvn clean test
# Step 2: Generate Allure report
allure generate target/allure-results -o target/allure-report --clean
# Step 3: Open report in browser
allure open target/allure-reportIf you've added the allure-maven plugin to pom.xml:
# Generate and serve report (opens in browser automatically)
mvn allure:serve
# Generate report only (without opening browser)
mvn allure:report
# Report will be available at: target/site/allure-maven-plugin/index.htmlAfter generating reports, you'll find:
target/
├── allure-results/ # Raw test results (JSON files)
│ ├── *.json # Test execution data
│ └── ...
└── allure-report/ # Generated HTML report (if using CLI)
└── index.html # Main report page
# OR (if using Maven plugin)
target/site/allure-maven-plugin/
└── index.html # Main report page
-
Using Allure CLI:
allure open target/allure-report
-
Using Maven Plugin:
mvn allure:serve # Opens automatically at http://localhost:4040 -
Direct HTML:
- Navigate to
target/site/allure-maven-plugin/index.html - Open in any web browser
- Navigate to
The GitHub Actions workflow automatically generates and publishes Allure reports:
- Allure CLI Installation: Downloads and installs Allure commandline tool
- Report Generation: Generates Allure reports from test results
- Artifact Upload: Uploads reports as downloadable artifacts
- GitHub Pages Deployment: Publishes reports to GitHub Pages for easy access
See the CI/CD Integration section for complete workflow details.
- Overview: Test execution summary, trends, and statistics
- Suites: Test suites and their execution results
- Behaviors: Tests organized by features and stories
- Packages: Tests organized by package structure
- Graphs: Visual charts showing test execution trends
- Timeline: Chronological view of test execution
- Retries: Information about retried tests
Thanks to the AllureRestAssured filter, each test automatically includes:
- Request Details: Method, URL, headers, body
- Response Details: Status code, headers, body
- Timing Information: Request duration
- Full JSON Payloads: Complete request and response bodies
This makes debugging API test failures much easier!
The framework uses the following key dependencies (defined in pom.xml):
| Dependency | Version | Purpose |
|---|---|---|
rest-assured |
5.5.1 | API testing framework |
testng |
7.11.0 | Test execution framework |
jackson-databind |
2.20.0 | JSON serialization/deserialization |
json-schema-validator |
5.5.6 | JSON schema validation |
json-path |
5.5.6 | JSON path extraction |
hamcrest |
3.0 | Matcher library |
log4j-core |
2.25.1 | Logging |
slf4j-simple |
2.0.9 | Logging facade |
allure-testng |
2.27.0 | Allure TestNG integration for test reporting |
allure-rest-assured |
2.27.0 | Allure REST Assured filter for HTTP request/response capture |
- All test classes extend
BaseTestfor common setup - Use descriptive test method names
- Group related tests in the same class
- Use
TestDatabuilderfor creating test data - Generate random data to avoid conflicts
- Reuse created resources (e.g., book ID) across tests
- Use TestNG assertions for business logic validation
- Leverage JSON schema validation for response structure
- Validate both positive and negative scenarios
- Use
SpecBuilderfor reusable specifications - Centralize base URL configuration
- Set common headers and content types
- Use TestNG
dependsOnMethodsfor test ordering - Share data between tests using static variables
- Clean up test data after execution
- Use
.log().all()for request/response logging during development - Remove or conditionally enable logging in production runs
- Failed tests are automatically retried up to 2 times by default
- Retry logic is applied automatically via
RetryTransformerlistener - Adjust
maxRetryCountinRetryAnalyzerto change retry behavior - Retry attempts are logged for debugging purposes
- Use retries for handling transient failures (network issues, timing problems)
Here's an example of how a test is structured:
@Test(priority = 0)
public void addBookTest() {
// 1. Generate test data
AddBookRequest payload = TestDatabuilder.addBookRequestRandomPayload();
// 2. Send request and validate response
AddBookResponse res = given().log().all()
.body(payload)
.when()
.post("/Library/Addbook.php")
.then().log().all()
.spec(SpecBuilder.getResponseSpec(200))
.body(matchesJsonSchemaInClasspath("schemas/addBookResponse.json"))
.extract().body().as(AddBookResponse.class);
// 3. Assert business logic
Assert.assertEquals(res.getMsg(), "successfully added");
// 4. Save data for dependent tests
createdBookId = res.getID();
}The framework generates multiple types of test reports:
Most comprehensive and interactive reports with HTTP request/response capture.
Generate and View:
# After running tests
mvn clean test
# Generate and open Allure report
allure generate target/allure-results -o target/allure-report --clean
allure open target/allure-reportFeatures:
- Interactive dashboards
- HTTP request/response details
- Test execution history
- Visual charts and graphs
- Retry information
See the Allure Reports section for detailed instructions.
Standard Maven test reports generated automatically.
Location:
- Surefire Reports:
target/surefire-reports/index.html - TestNG Reports:
target/surefire-reports/testng-reports.html
View: Open these HTML files directly in a browser.
When tests run via GitHub Actions, Allure reports are automatically generated and published:
Option 1: GitHub Pages (Recommended)
- Reports are automatically published to GitHub Pages
- Access at:
https://umangbhatia786.github.io/RestAssuredAPITestingFramework/ - No download required - view directly in browser
- See CI/CD Integration section for setup instructions
Option 2: Download Artifact
- Navigate to the Actions tab in your GitHub repository
- Click on the workflow run
- Scroll down to the Artifacts section
- Download the
allure-reportartifact - Extract and open
index.htmlin a browser
Note: Reports are generated and published even if tests fail, allowing you to analyze failures.
-
Tests fail with connection error
- Verify the API is accessible
- Check base URL in
SpecBuilderor system property
-
JSON schema validation fails
- Ensure schema files are in
src/main/resources/schemas/ - Verify schema matches actual API response
- Ensure schema files are in
-
Test dependencies fail
- Ensure dependent tests run in correct order
- Check that shared data (e.g.,
createdBookId) is set
-
Maven build fails
- Run
mvn clean installto refresh dependencies - Verify Java version matches
pom.xmlconfiguration (JDK 22)
- Run
-
Tests retry but still fail
- Check if the failure is due to transient issues (network, timing)
- Review retry logs to see retry attempts
- Adjust
maxRetryCountinRetryAnalyzerif needed - Verify the test logic is correct and not causing consistent failures
-
CI/CD workflow fails
- Check the Actions tab for detailed error logs
- Verify Java version compatibility (workflow uses Java 21)
- Ensure the API base URL is accessible from GitHub Actions runners
- Check if Maven dependencies are resolving correctly
- Review the archived test reports for specific test failures
-
Allure report not generating
- Ensure Allure is installed:
allure --version - Verify
allure-resultsdirectory exists intarget/after test execution - Check that AllureTestNg listener is configured in
pom.xml - Try running
mvn clean testfirst, then generate report - If using Maven plugin, ensure
allure-mavenplugin is added topom.xml
- Ensure Allure is installed:
This is a sample testing framework for educational purposes.
Umang Bhatia
Happy Testing! 🚀