An open API service indexing awesome lists of open source software.

https://github.com/jaktestowac/js-rest-api-tests-sample

Sample project to demonstrate REST API testing via JavaScript.
https://github.com/jaktestowac/js-rest-api-tests-sample

api-rest automation continuous-integration github-actions javascript mocha-chai mocha-tests test-automation

Last synced: about 2 months ago
JSON representation

Sample project to demonstrate REST API testing via JavaScript.

Awesome Lists containing this project

README

          

Start your journey in REST API Automation Tests in 5 minutes 😎

# What we will test:
API call to: https://httpbin.org/#/Anything/get_anything

# Prerequesties
**GitHub** account

# 7 Easy Steps to run your first Automated API Test!

1. ✨ Get your own copy of this repository
- Click `Fork` button on the top right corner
- **Effect:** repository cloned to your GitHub account
1. ✅ Enable GitHub Actions CI
- Go to `Actions` panel
- Click `I understand my worflows, go ahead and enable them`
- **Effect:** Actions unlocked but shows `There are no workflow runs yet.`
1. 💻 Open code editor
- Go to `Code` panel
- Click `.` (dot symbol) on your keyboard
- **Effect:** Visual Studio Code Editor opened with EXPLORER panel on left
1. 🖐️ Start coding
- On left chose `test` folder and click `get-resources.spec.js`
- DELETE `.skip` phrase (with dot) from first test (starting in line `3`)
- **Effect:** your tests starts with `it("should return status code 200 ...`
1. 🚀 Apply changes to repository
- Use keyboard shortcut `Ctrl + Shift + G` to open SOURCE CONTROL panel on left
- Enter changes message `Removed skip from first test`
- Click ✔ (tick button) on top menu in SOURCE CONTROL panel
- **Effect:** All changes applied to your repository! (this is called `pushed commit`)
1. 🏃‍♂️ Go back to repository
- Go to top left hamburger menu and clik it
- Use last option `Go to repository`
- **Effect:** Repository opened in new tab
1. 👀 See tests in Action!
- Go to `Actions` panel and click `Removed skip from first test` workflow
- Scroll to the bottom of the page and check results
- **Effect:** Test run with success!🎉🎉🎉
| ---------------- | Tests | Passed ✅ | Skipped ↪️ | Failed ❌ |
| ---------------- | ----- | --------- | ----------- | --------- |
|JUnit Test Report | 2 run | 1 passed | 1 skipped | 0 failed |

## 👨‍💻 Your turn:
- Remove skip from next test,
- Make `commit`
- See how it fail in `Actions`
- ...and then fix it!

# What next
See https://jaktestowac.pl/api/