https://github.com/lynix28/api-mochai-example
API automation test example with Mocha JS, Supertest, and Chai
https://github.com/lynix28/api-mochai-example
api-testing automated-testing javascript mocha-chai mocha-tests mochajs
Last synced: 6 months ago
JSON representation
API automation test example with Mocha JS, Supertest, and Chai
- Host: GitHub
- URL: https://github.com/lynix28/api-mochai-example
- Owner: lynix28
- Created: 2022-04-01T13:57:26.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-13T07:27:39.000Z (over 2 years ago)
- Last Synced: 2025-02-08T14:13:19.717Z (8 months ago)
- Topics: api-testing, automated-testing, javascript, mocha-chai, mocha-tests, mochajs
- Language: JavaScript
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mochai-example
[](https://circleci.com/gh/lynix28/api-mochai-example/tree/master)
[](https://codecov.io/gh/lynix28/api-mochai-example)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`