Skip to content

Repository files navigation

api_test_catapi


Exercising Web automation testing with API backend.

The project was created to exercise and learn automation testing using catAPI's backend, using Playwright and JavaScript.

The testcases in "testsuite_catapi.spec.js" are using the "ApiFunctions.js" file to access all the requests.

Input certain values to testcases to vary the test coverage (Search based on query parameters, Create negative tests with expected "bad" response, Extract/Write data, Assert with status code and response text ..)

Current available Requests: GET, POST, DELETE

Requirements:

  • Use a terminal to download the following packages to the projects root:

Playwright


npm init playwright@latest

  • Choose JavaScript
  • end-to-end tests folder: tests
  • Leave everything else on default (Don't override config!)
  • Playwright will create an example test file called: "example.spec.js" you can delete it if you wish.

dotenv


npm install dotenv

Authentication and Authorization

.envExample

  • Create a .env file in the project's root folder with the following lines:


API_KEY=

BASE_URL=

  • Input the base API url found at the documentation. (Make sure that it ends with a /)
  • Input your unique API key requested from the website.

Run testcases

Open a terminal inside your IDE

  • Use the following command to run all the tests:
    npx playwright test
  • Use the following command to open the Playwright UI:
    npx playwright test --ui
  • Use the following command to run test based on "Projects" declared in Playwright config:
    npx playwright test --project=chromium

About

Exercising API Test

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages