A hands-on project for QA engineers to practice setting up a Jenkins pipeline that automatically runs REST API tests on every code push. Tests target the Fake Store API using REST Assured and JUnit 5, with Allure reports and Slack/email notifications.
src/test/java/com/fakestoreapi/
tests/
BaseTest.java # Shared REST Assured setup for all tests
ProductsTest.java # Tests for /products endpoints
CartsTest.java # Tests for /carts endpoints
UsersTest.java # Tests for /users endpoints
AuthTest.java # Tests for /auth/login endpoint
utils/
ApiConfig.java # API base URL and test credentials
Jenkinsfile # CI/CD pipeline definition
Dockerfile # Runs tests in a Docker container
| Class | Endpoints tested |
|---|---|
| ProductsTest | GET all, GET by id, GET with limit/sort, GET categories, GET by category, POST, PUT, DELETE |
| CartsTest | GET all, GET by id, GET with limit, POST, PUT, DELETE |
| UsersTest | GET all, GET by id, GET with limit, POST, PUT, DELETE |
| AuthTest | POST login (valid credentials), POST login (invalid credentials) |
Prerequisites: Java 17 and Maven installed.
# Clone the repo
git clone https://github.com/hasbyQa/jenkins-swag-labs.git
cd jenkins-swag-labs
# Run all tests
mvn test
# View the Allure report
mvn allure:serve
# Build the image
docker build -t fakestore-api-tests .
# Run the tests
docker run --rm fakestore-api-tests
jenkins/jenkins:lts)allure, auto-install)slack-webhook-url containing your Slack webhook URLhttp://<jenkins-url>/github-webhook/ → triggers on push| Stage | What it does |
|---|---|
| Checkout | Pulls latest code from GitHub |
| Build | Compiles the project (mvn compile) |
| Test | Runs the full API test suite (mvn test) |
| Reports | Publishes JUnit + Allure reports, captures test counts |
#builds channel on success, failure, and unstable