Skip to content

An attempt to learn API automation using Serenity, Rest Assured and Cucumber and build a CI pipeline using GitLab

Notifications You must be signed in to change notification settings

sreesl/automation-serenity

Repository files navigation

Automating NYTimes Books API Validation

API automation using Serenity, Rest Assured and Cucumber for the Books endpoint of New York Times.

📦 How do I set up

Pre-requisite:

These should be installed in your local machine.
* Java 11
* Gradle 7
  • Clone the project using git into your local directory
git clone https://gitlab.com/sreesl/automation-serenity

🏗 Build

Go to the project's root directory(automation-serenity) and Run

gradle build -x test

✅ Test

Run the tests using the command as below or use 'Run' function in your IDE on testapi.feature

gradle test

📈 Reports

Inorder to generate report, run the command and respective report will be available in target/site/serenity/ as index.html and serenity-summary.html

gradle report

💚 Gitlab Integration

  • The tests are set to run in the pipeline in GitLab for every checkin.

  • Add Gitlab config file .gitlab-ci.yml

    • Add task to run your build script
    • Add task to run your test
    • Add task to generate report
  • You can trigger the pipeline by clicking on "Run Pipeline" in the UI.

  • HTML reports are saved as artifacts in the gitlab.com/{username}/automation-serenity/-/jobs/{job_number}/artifacts/browse for each job run.

    Refer Sample INDEX HTML Report.

    Refer Sample Single Page HTML Report.

🥒 Extending Tests

  • Add new test scenarios in the feature file testapi.feature
  • Add corresponding steps for the new scenarios in the stepDefinitions file stepDefinition

Refer further Cucumber Documentation

About

An attempt to learn API automation using Serenity, Rest Assured and Cucumber and build a CI pipeline using GitLab

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published