/js-rest-api-tests-sample

Sample project to demonstrate REST API testing via JavaScript.

Primary LanguageJavaScript

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
  2. ✅ 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.
  3. 💻 Open code editor
    • Go to Code panel
    • Click . (dot symbol) on your keyboard
    • Effect: Visual Studio Code Editor opened with EXPLORER panel on left
  4. 🖐️ 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 ...
  5. 🚀 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)
  6. 🏃‍♂️ 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
  7. 👀 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/