Skip to content

ksarisen/test-automation-case

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Test Automation Case Study

This repository contains an end-to-end test automation case study covering Web UI, Mobile UI, and API layers.

πŸ“Œ Scope

  1. Web UI Automation
  2. Mobile UI Automation
  3. API Automation

Each section is implemented as an independent automation module

πŸ“ Repository Structure

test-automation-case
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ README.md
β”œβ”€β”€ web-ui
β”œβ”€β”€ mobile-ui
└── restful-booker-karate

1️⃣ Web UI Automation Project

This project is a Web UI Test Automation framework developed as part of a technical case study.

πŸ›  Technologies Used

  • Java 21
  • Selenium WebDriver
  • TestNG (parallel execution)
  • Cucumber BDD
  • Maven
  • Docker
  • Selenium Grid 4
  • Jenkins
  • Cucumber Reports (Jenkins Plugin)

πŸ“ Project Structure

web-ui
β”œβ”€β”€ pom.xml
└── src
    └── test
        β”œβ”€β”€ java
        β”‚   └── com
        β”‚       └── vakifbank
        β”‚           β”œβ”€β”€ hooks
        β”‚           β”‚   └── Hooks.java
        β”‚           β”œβ”€β”€ pages
        β”‚           β”‚   β”œβ”€β”€ BasePage.java
        β”‚           β”‚   └── BookStorePage.java
        β”‚           β”œβ”€β”€ runners
        β”‚           β”‚   └── TestRunner.java
        β”‚           β”œβ”€β”€ stepdefinitions
        β”‚           β”‚   β”œβ”€β”€ AlertsSteps.java
        β”‚           β”‚   β”œβ”€β”€ InvalidNavigationSteps.java
        β”‚           β”‚   β”œβ”€β”€ PracticeFormSteps.java
        β”‚           β”‚   └── BookStoreSteps.java
        β”‚           └── utils
        β”‚               └── DriverManager.java
        └── resources
            └── features
                β”œβ”€β”€ alerts.feature
                β”œβ”€β”€ book_store.feature
                β”œβ”€β”€ invalid_navigation.feature
                └── practice_form.feature

βœ… Implemented Test Scenarios

  • Book Store list validation (row count & book details)
  • Practice Form validation
    • Only mandatory fields
    • All fields filled
  • Alert popup validations
  • Invalid menu navigation (negative scenario)

Each scenario includes necessary validations as required by the case.


🧡 Parallel Execution

  • Parallel execution is enabled using TestNG
  • Each scenario runs with its own WebDriver instance via ThreadLocal
  • Fully compatible with Selenium Grid 4

🌐 Selenium Grid 4 (Docker)

Selenium Grid 4 is executed using Docker containers:

  • selenium/hub
  • selenium/node-chrome
  • selenium/node-edge

Tests are executed remotely via RemoteWebDriver.

Browser selection is controlled using a Maven parameter:

mvn verify -Dbrowser=chrome
mvn verify -Dbrowser=edge

πŸ§ͺ Driver Management

  • Centralized DriverManager
  • Uses ThreadLocal for parallel safety
  • Supports Chrome and Edge
  • No usage of Thread.sleep() (explicit waits only)

πŸ“Έ Screenshot on Failure

  • Screenshots are captured automatically for failed scenarios
  • Implemented using a Cucumber @After hook
  • Screenshots are attached directly to the Cucumber scenario
  • Visible inside the Cucumber HTML report in Jenkins

πŸ“ Location in report: Scenario β†’ Hooks β†’ After β†’ Embedded image (png)


πŸ“Š Reporting

Jenkins Cucumber Report

  • Jenkins Cucumber Reports Plugin is used
  • Reports are generated from cucumber-report.json
  • Includes:
    • Scenario status
    • Step details
    • Charts
    • Embedded screenshots for failed scenarios

πŸš€ Jenkins Integration

  • Jenkins Freestyle Job
  • Pulls latest code from GitHub repository
  • Runs tests using Maven (verify phase)
  • Executes tests on Selenium Grid 4
  • Publishes Cucumber HTML reports automatically

▢️ How to Run Locally

  • Prerequisites:
    • Java 21
    • Maven
    • Docker & Docker Compose

Start Selenium Grid

docker-compose up -d

Run Tests

mvn verify -Dbrowser=chrome

πŸ“ Notes

  • All requirements defined in the case study are fully implemented
  • Framework is scalable and easily extendable
  • Clean architecture using Page Object Model
  • CI-ready with Jenkins and Docker-based Grid

2️⃣ Mobile UI Automation

This module covers Mobile UI test automation for an Android application as part of the technical case requirements.

πŸ›  Technologies Used

  • Java 21
  • Appium
  • UiAutomator2
  • Android Emulator
  • Cucumber BDD
  • TestNG
  • Maven
  • Appium Inspector

πŸ“ Project Structure

mobile-ui-automation
β”œβ”€β”€ pom.xml
β”œβ”€β”€ src
β”‚   └── test
β”‚       β”œβ”€β”€ java
β”‚       β”‚   └── com
β”‚       β”‚       └── akakce
β”‚       β”‚           β”œβ”€β”€ driver
β”‚       β”‚           β”‚   └── DriverManager.java
β”‚       β”‚           β”œβ”€β”€ hooks
β”‚       β”‚           β”‚   └── Hooks.java
β”‚       β”‚           β”œβ”€β”€ pages
β”‚       β”‚           β”‚   β”œβ”€β”€ BasePage.java
β”‚       β”‚           β”‚   └── AkakcePage.java
β”‚       β”‚           β”œβ”€β”€ runners
β”‚       β”‚           β”‚   └── TestRunner.java
β”‚       β”‚           └── steps
β”‚       β”‚               └── AkakceSteps.java
β”‚       └── resources
β”‚           └── features
β”‚               └── akakce.feature

πŸ“± Execution Environment

  • Tests were executed on an Android Emulator created via Android Studio
  • Appium Server was started manually before test execution
  • UI element inspection and locator validation were performed using Appium Inspector

βœ… Implemented Scenario

  • Search for a product (Laptop)
  • Apply multiple filters
  • Sort results by lowest price
  • Select a specific product from the list
  • Validate seller button visibility
  • Compare listing price with detail page price (partially implemented)

πŸ“Έ Screenshot on Failure

  • Screenshots are captured automatically for failed scenarios
  • Implemented via Cucumber @After hook
  • Screenshots are embedded directly into the Cucumber report
  • No Thread.sleep() usage (explicit waits only)

▢️ How to Run

Prerequisites:

  • Java 21
  • Maven
  • Android SDK
  • Android Emulator
  • Appium Server

Start Appium Server

appium

Run Tests

mvn clean test

πŸ§ͺ Appium Inspector

Appium Inspector was used extensively to:

  • Inspect dynamic UI hierarchies
  • Identify transient UI containers
  • Analyze scroll behavior and overlay components
  • Validate locator strategies before implementation

⚠️ Known Limitation (Transparent Disclosure)

Due to dynamic UI rendering and price components being split into multiple TextView elements in the product detail screen, a fully reliable price extraction from the detail page could not be finalized within the given time frame.

  • Price digits are rendered across multiple TextViews
  • No unique or stable resource-id available for full price value
  • Multiple similar TextViews exist across the page This limitation is documented intentionally to demonstrate real-world mobile UI automation challenges and decision-making.

🧡 Parallel Execution

  • Parallel execution is supported via TestNG
  • Thread-safe driver management using ThreadLocal
  • Each scenario runs with an isolated Appium session

πŸ“ Notes

  • Project follows clean architecture principles
  • No hard waits (Thread.sleep) are used
  • Explicit waits and robust locators are preferred
  • Known limitations are documented transparently

3️⃣ API Automation

This module covers API Test Automation using the Karate Framework and is designed to validate RESTful services as part of an end-to-end automation strategy.

The project focuses on functional correctness, data integrity, and CI/CD readiness rather than UI-driven validations.


πŸ›  Technologies Used

  • Java 17
  • Karate DSL
  • JUnit 5
  • Maven
  • Docker
  • Jenkins
  • RESTful Booker API (public test API)

πŸ“ Project Structure

restful-booker-karate
└── karate-api
    β”œβ”€β”€ Dockerfile
    β”œβ”€β”€ Jenkinsfile
    β”œβ”€β”€ pom.xml
    └── src
        └── test
            β”œβ”€β”€ java
            β”‚   └── com
            β”‚       └── booking
            β”‚           └── KarateTest.java
            └── resources
                └── features
                    β”œβ”€β”€ create-booking.feature
                    β”œβ”€β”€ get-booking-by-id.feature
                    β”œβ”€β”€ update-booking.feature
                    β”œβ”€β”€ partial-update-booking.feature
                    β”œβ”€β”€ delete-booking.feature
                    └── ping.feature

βœ… Implemented Scenario

  • Health check (/ping)
  • Create booking
  • Get booking by ID
  • Update booking (PUT)
  • Partial update booking (PATCH)
  • Delete booking
  • Response body & schema validations
  • Status code validations
  • Dynamic ID handling between scenarios

Each endpoint is tested independently to ensure statelessness and repeatable execution in CI environments.


πŸ§ͺ Test Design Approach

  • API tests are written using Karate’s declarative DSL
  • No external test data dependencies
  • Assertions cover:
  • HTTP status codes
  • Response payload structure
  • Field-level data validation
  • Tests are designed to be idempotent and CI-safe

πŸ“Š Reporting (Karate Native Report)

  • Karate generates its own HTML test report
  • Reports are located under:
target/karate-reports/karate-summary.html
  • The report includes:
    • Feature-level and scenario-level results
    • Execution duration
    • Step-by-step request/response visibility

⚠️ Jenkins Cucumber plugin is not used for this module, as Karate does not produce standard cucumber-jvm JSON outputs. Karate native reporting is the recommended and supported approach.


πŸš€ Jenkins Integration

  • Implemented using Jenkins Pipeline
  • Pipeline stages:
    • Checkout source code
    • Build Docker image
    • Execute API tests inside Docker container
    • Publish Karate HTML report
    • Jenkins build result reflects actual test execution status

🐳 Docker Execution

  • Tests are executed inside a Docker container
  • Maven dependencies are resolved during image build
  • Ensures:
    • Environment consistency
    • CI/CD portability
    • Zero local setup dependency

▢️ How to Run Locally

Prerequisites:

  • Java 17+
  • Maven
  • Docker

Run tests using Maven:

mvn clean test

Or using Docker:

docker build -t karate-api-tests .
docker run --rm -v target:/app/target karate-api-tests

πŸ“ Notes

  • API tests are fully CI/CD ready -= Framework is lightweight and highly maintainable
  • Clear separation from UI and Mobile automation layers
  • Designed to demonstrate real-world API automation practices
  • Reporting strategy intentionally differs from UI/Mobile modules to align with Karate best practices

πŸ‘€ Author

Kerem SarΔ±sen

About

Comprehensive test automation case study including Web UI, Mobile UI, and API layers using Java, TestNG, Selenium, Docker, Jenkins, Cucumber BDD, Selenium Grid, Appium and Karate.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages