Git Product home page Git Product logo

lupinus's Introduction

API Server Testing Tool


I know there are many API testing tools that seem easy to use at first glance, but I honestly don't trust them because they store OpenAPI specifications and authentication information in some online storage without permission ๐Ÿคข

But what lupinus does is really simple, so please try it ๐Ÿ˜˜

Architecture

lupinus is an API server testing tool. lupinus reads the OpenAPI specification, calls the APIs in the order described in the test cases, and verifies the normality of their responses. The response is verified for correctness. The verification results can be output to standard output or to an arbitrary file.

Install

npm install lupinus

Setting

API Specification

Use the tool of your choice to create an OpenAPI specification and output it somewhere in YAML or JSON.

Test cases

In the test case, write in YAML or JSON what order to call the paths described in the OpenAPI specification. Also, write down the expected response.

For example, if you write that you expect HTTP status code 200, lupinus will verify that the data model written in the OpenAPI 200 response is returned.

The string inside the wave brackets will be replaced; the wave brackets in the Authentication header will be Base64-encoded with the user ID and password between the colons. In addition, context in the brackets stores the response of the path executed in the previous step. For example, context[2] is the response of the third executed path.

testCases: 
  - title: "Example"
    contextPath: "https://example.com/path/to"
    sequence: 
      - path: /auth/token
        method: POST
        spec: oauth2.ClientCredentials
        request:
          headers: 
            accept: application/json
            content-type: application/x-www-form-urlencoded
            authorization: Basic {user1:pass1>}
          body:
            grant_type: client_credentials
        response:
          status: 200
      - path: /business/data
        method: GET
        request:
          headers: 
            authorization: Bearer {context[0].access_token}
        response:
          status: 200

Log setting

By default, lupinus will output test results to standard output. If you want to output to a file, write the file path in the output attribute.

threshold: info
output: result.log
errorOutput: error-result.log

Test

npx lupinus --spec oas.yaml --testcase testcases.yaml --log log.yaml

License

MIT

Developers

Takuro Okada


ยฉ Takuro Okada

lupinus's People

Contributors

mill6-plat6aux avatar

Watchers

 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.