Skip to content

lynix28/api-mochai-example

Repository files navigation

mochai-example

CircleCI codecov

API automation test example project

  • Inside the Project

    • MochaJS
    • Chai
    • Supertest
    • Mochawesome
  • Install Dependencies

    • npm install
    • npm set-script test "mocha ./api --recursive --reporter mochawesome --reporter-options reportDir=reports/ --timeout 30000"
  • Run The Test

    • Run all test
      • npm run test
    • Run test by Tag
      • npm run -- --grep "@Positive"
  • Run With Docker

    • Build Docker image with Dockerfile
      • docker build -t "ImageName" .
    • Run Docker container
      • docker run --name "ContainerName" -itd ImageName:Tag
    • Copy test project to /app/ directory with docker copy command
      • docker cp api/ ContainerName@/app/
      • docker cp connector/ ContainerName@/app/
      • docker cp helpers/ ContainerName@/app/
      • docker cp testcases/ ContainerName@/app/
    • Access the Docker Container
      • docker exec -it ContainerName /bin/bash
    • Run test file inside docker container
      • npm run test

About

API automation test example with Mocha JS, Supertest, and Chai

Topics

Resources

Stars

Watchers

Forks