Skip to content

"A repository containing API testing examples using the Cypress framework, providing a quick and easy approach to testing APIs with a focus on simplicity and ease of use."

License

Notifications You must be signed in to change notification settings

ashikkumar23/api-testing-cypress

Folders and files

NameName
Last commit message
Last commit date
Jan 6, 2023
Dec 30, 2022
Apr 16, 2025
Jan 21, 2023
Jan 6, 2023
Dec 27, 2022
Dec 28, 2022
Apr 16, 2025
Apr 16, 2025
Dec 27, 2022

Repository files navigation

Cypress REST API Test Framework

Actions Status Actions Status Actions Status

API Testing Framework using Cypress with GitHub Actions workflow for generating and publishing test report

πŸš€ Description:

Automated CRUD (i.e., POST, GET, PUT, DELETE) operations using Cypress

πŸš€ Prerequisites:

πŸš€ Installation Steps:

  • Fork and Clone the repository api-testing-cypress
  • Move to the api-testing-cypress directory:
cd api-testing-cypress
  • Set up a new npm package:
npm init
  • Install cypress:
npm install cypress
  • Add the following lines to the package.json file, "scripts" section:
  "scripts": {
    "cypress:open": "./node_modules/.bin/cypress open",
    "cypress:run": "./node_modules/.bin/cypress run --spec **/*.cy.js"
  }

πŸš€ Test Execution:

  • To run the tests on your terminal:
npm run cypress:run
npm run cypress:open
  • On Cypress Test Runner:
    • Select E2E Testing
    • Choose a browser: Chrome or Electron
    • Click on Start E2E Testing in {browser}
    • Once the test runner has loaded, click on the spec file i.e., test_crud.cy.js to run the test

πŸš€ Reporting:

npm install --save-dev mocha cypress-multi-reporters mochawesome
npm install --save-dev mochawesome-merge
npm install --save-dev mochawesome-report-generator
  • Add the following lines to the package.json file, "scripts" section:
  "scripts": {
    "report:merge": "mochawesome-merge cypress/reports/json/*.json > index.json",
    "report:generate": "marge index.json --reportDir public --assetsDir public/assets --reportPageTitle index.html"
  }

πŸš€ Notes:

  • .github/workflows/package_update.yml workflow would ensure the dependencies are up-to-date
  • Tests are always run on the latest dependencies βœ