Coder Social home page Coder Social logo

api-test-framework's Introduction

api-test-framework

Api test framework for test-api

BA— Why need api test?


Api(Restful api) is always the interface between backend and frontend.

Main Reasons for API Testing:

  1. Ensure Functionality and Reliability:
    • Verifies that the API meets its functional requirements and performs as intended.
    • Identifies and addresses bugs, errors, or inconsistencies that could affect the API's reliability and availability.
  2. Validate Data Integrity:
    • Checks the accuracy, consistency, and completeness of data exchanged through the API.
    • Ensures that data is not corrupted or manipulated during transmission and processing.
  3. Test Performance and Scalability:
    • Evaluates the API's performance under various load conditions and scenarios.
    • Identifies bottlenecks and optimizes the API to handle increased usage and maintain acceptable response times and throughput.

When in development, at the minimum cost to identify Design vs. Implementation Differences automatically.

Solution.


Untitled

*.test file format

#定义API接口 URL
API_URL = "http://47.115.214.0:5555"

#定义测试用例
TEST_CASES = [
    {
        "method": "GET",
        "url": "/hello",
        "params": "",
        "expected_response": {
            "code": 200,
            "body": {
              "Hello":"ERROR"
            }
        }
    }
]

Dockerfile

Untitled

Main Points:

  • Each test file only has 1 API_URL(Fixed name) and multipul TEST_CASES. (TEST_CASES can rename).
  • Method: support GET, POST now.
  • Check code and body consistency.
  • Should easy to test, can be test in any folder with the same file structure.
  • Dockfile is necessary.

CICD


github:

https://github.com/KingsVolvo/api-test-framework.git

PS: “dosubot bot ” can be used in personal project

image registry address

Aliyun:  
registry.cn-hangzhou.aliyuncs.com/kinghuang/api-test-framework:1158

AWS:
477069922492.dkr.ecr.cn-northwest-1.amazonaws.com.cn/api-test-framework

JFrog:
(waiting for permission)

Test


  1. docker build -t api-test-img .

  2. docker run api-test-img

  3. sh get_testapi_result.sh

api-test-framework's People

Contributors

kingsvolvo avatar

Watchers

 avatar

api-test-framework's Issues

add feature: support chain of testcase

Right now only support one http request to one result, would you support example like this:

first request return token , second request add the token into head and get result.

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.