项目作者: irfanalinoor

项目描述 :
Api Test Automation implemented in JavaScript (Mocha) integrated with CircleCI
高级语言: HTML
项目地址: git://github.com/irfanalinoor/javascript-api-mocha.git
创建时间: 2018-10-21T03:01:44Z
项目社区:https://github.com/irfanalinoor/javascript-api-mocha

开源协议:MIT License

下载


API JavaScript Test Automation Framework CircleCI

Overview

  • This is simple project to showcase Api Test Automation Framework in JavaScript using mocha.
  • Project uses free Countries RESTApi & World Weather Api
  • Skills: Api Test Automation, Modular Design
  • Languages: JavaScript/ Node.JS
  • SCM: Git
  • Build/Dependency Management: npm, Request-Promise
  • API Testing Frameworks: Mocha, REST Api, Data-Driven (Json)
  • Assertion Lib: Chai, Expect, Should
  • CI/CD: Integration with CircleCI

Setup

Sample Test Scenarios - Test Report Summary

  1. Current Weather Data API - Test Suite
  2. Basic Shakedown Tests
  3. Verify 'Current Weather By GPS Coordinates' Api response is OK (1157ms)
  4. Functional (Data-Driven) Tests
  5. Verify STATE CODE is displayed in response of 'Current Weather By GPS Coordinates' Api (1120ms)
  6. Forecast Weather Data API - Test Suite
  7. Basic Shakedown Tests
  8. Verify 'Forecast - 3 Hourly Data' Api response is OK
  9. Functional (Data-Driven) Tests
  10. Verify response of 'Forecast Weather By Postal Code' Api have value of TIMESTAMP UTC (1226ms)
  11. Verify response of 'Forecast Weather By Postal Code' Api have value of WEATHER (1505ms)
  12. Performance Test Suite
  13. Expected Response Time per Api Request Call = 3500 ms
  14. Verify Response Time less than 3500 ms per API call when both APIs are called 10times (23901ms)
  15. Rest Countries API - Test Suite
  16. Basic Shakedown Tests
  17. Verify 'Name' Api response is OK (3784ms)
  18. Verify 'Code' Api response is OK (1862ms)
  19. Verify 'Capital' Api response is OK (2333ms)
  20. Verify 'Region' Api response is OK (3624ms)
  21. Functional Tests
  22. Verify CAPITAL NAME in 'Name Api' using 'Capital Api' (5214ms)
  23. Verify POPULATION value is same in 'Name + Code + Capital' Api responses (5835ms)
  24. Verify AREA value is same in 'Name + Code + Capital' Api responses (5358ms)

CI/CD Run

  • Change InputData to run tests on CircleCI

  • CircleCI - Config.yml

    1. version: 2
    2. jobs:
    3. build:
    4. working_directory: ~/JavaScriptApiAutomation
    5. docker:
    6. - image: circleci/node:8.0
    7. - image: mongo:3.4.4
    8. steps:
    9. - run:
    10. name: "Checking NodeJs + NPM Version"
    11. command: |
    12. node --version
    13. npm --version
    14. - checkout
    15. - restore_cache:
    16. key: dependency-cache-{{ checksum "package.json" }}
    17. - run:
    18. name: Install Mocha
    19. command: 'sudo npm i -g mocha'
    20. - run:
    21. name: Run API Tests
    22. command: 'npm test'