Giter Site home page Giter Site logo

costip-api's Introduction

costip-api

The following codes are example to demostrate API testing, including Load testing.

Prepare

  1. Install NodeJS LTS or NodeJS Portable
  2. Download this project (either clone or by ZIP)
  3. Start example server (in the directory of the downloaded project)
    npm install
    npm start

API testing

For API testing, we are using Postman. The portable version of it can be downloaded here: postman-portable.

Prepare

  1. Install Postman or Postman portable

Tasks

Based on the api-automation-webinar create API tests in Postman for JSON Placeholder.

N Method URL Parameters Expected
1 POST /posts Body: {"title": "Test post", "body": "This is a nice post", "userId": 1} Code: 200; Response contains id
2 GET /posts/{id} Path: id is the ID of the previously added post Code: 200; Response contains title, body, id and userId or previously added post
3 POST /posts Body: {"id": {id}, "title": "Test post", "body": "This is a nice post", "userId": 1} where id is the ID of the previously added post Code: 500

Load testing

For Load testing, we are using NodeJS and the loadtest tool.

Prepare

  1. Install loadtest package:
    npm install -g loadtest

Tasks

  1. Start simple load test

    • on GET http://localhost:3456/load
    • with 10 concurrent users
    • with 10 requests per second
    • send 500 requests
    loadtest http://localhost:3456/load -c 10 --rps 10 -n 500
  2. Start other load test

    • on GET http://localhost:3456/huge
    • with 10 concurrent users
    • with 10 requests per second
    • send 500 requests
    loadtest http://localhost:3456/huge -c 10 --rps 10 -n 500

costip-api's People

Contributors

szikszail avatar

Watchers

Katona Ádám avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.