Giter Site home page Giter Site logo

agility6 / api-testing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linuxsuren/api-testing

0.0 0.0 0.0 2.67 MB

YAML based API testing tool. 开源接口调试、测试工具。

Home Page: https://linuxsuren.github.io/api-testing/

License: Apache License 2.0

Shell 0.61% JavaScript 1.61% Go 75.72% TypeScript 4.98% CSS 0.24% Makefile 4.37% PureBasic 0.17% HTML 0.49% Smarty 1.49% Vue 9.74% Dockerfile 0.58%

api-testing's Introduction

CLA assistant Codacy Badge Codacy Badge GitHub All Releases Docker Pulls LinuxSuRen/open-source-best-practice

English | 中文

This is a API testing tool. 🚀

Features

  • Supported protocols: HTTP, gRPC, tRPC
  • Multiple test report formats: Markdown, HTML, PDF, Stdout
  • Mock Server in simple configuration, and Open API support
  • Support converting to JMeter files
  • Response Body fields equation check or eval
  • Validate the response body with JSON schema
  • Pre and post handle with the API request
  • Run in server mode, and provide the gRPC and HTTP endpoint
  • VS Code extension support
  • Multiple storage backends supported(Local, ORM Database, S3, Git, Etcd, etc.)
  • HTTP API record
  • Install in multiple use cases(CLI, Container, Native-Service, Operator, Helm, etc.)
  • Monitoring integration with Prometheus, SkyWalking

Get started

Try in PWD

Install it via hd or download from releases:

hd install atest

or, you can install it in Kubernetes. See also the manifests.

see the following usage:

API testing tool

Usage:
  atest [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  func        Print all the supported functions
  help        Help about any command
  json        Print the JSON schema of the test suites struct
  run         Run the test suite
  sample      Generate a sample test case YAML file
  server      Run as a server mode
  service     Install atest as a Linux service

Flags:
  -h, --help      help for atest
  -v, --version   version for atest

Use "atest [command] --help" for more information about a command.

below is an example of the usage, and you could see the report as well:

atest run -p sample/testsuite-gitlab.yaml --duration 1m --thread 3 --report md

API Average Max Min Count Error
GET https://gitlab.com/api/v4/projects 1.152777167s 2.108680194s 814.928496ms 99 0
GET https://gitlab.com/api/v4/projects/45088772 840.761064ms 1.487285371s 492.583066ms 10 0
consume: 1m2.153686448s

Use in Docker

Use atest as server mode in Docker, then you could visit the UI from 8080:

docker run --pull always -p 8080:8080 ghcr.io/linuxsuren/api-testing:master

Use atest-collector in Docker:

docker run -p 1234:8080 -v /var/tmp:/var/tmp \
  ghcr.io/linuxsuren/api-testing atest-collector \
  --filter-path /api \
  -o /var/tmp/sample.yaml
# you could find the test cases file from /var/tmp/sample
# cat /var/tmp/sample

Template

The following fields are templated with sprig:

  • API
  • Request Body
  • Request Header

Functions

You could use all the common functions which comes from sprig. Besides some specific functions are available:

Name Usage
randomKubernetesName {{randomKubernetesName}} to generate Kubernetes resource name randomly, the name will have 8 chars
sleep {{sleep(1)}} in the pre and post request handle

Verify against Kubernetes

It could verify any kinds of Kubernetes resources. Please set the environment variables before using it:

  • KUBERNETES_SERVER
  • KUBERNETES_TOKEN

See also the example.

TODO

  • Reduce the size of context.
  • Support customized context.

Limit

  • Only support to parse the response body when it's a map or array.

Community Exchange

Feel free to talk to us about any questions you may have about API Testing in the following ways.

Mailing List

[email protected], Feel free to discuss everything related to API Testing via this mailing list.

GitHub discussion

GitHub Discussion

api-testing's People

Contributors

acceleratorssr avatar agility6 avatar chan158 avatar dependabot[bot] avatar dshyjtdes8888 avatar dwj-squirtle avatar hahahashen avatar haiker2011 avatar hellojukay avatar im-jinxinwang avatar ink-33 avatar kuv2707 avatar linuxsuren avatar lizzy-0323 avatar samysf avatar setcy avatar slowdowno avatar wjsvec avatar wongearl avatar wt-goodluck avatar yjuns avatar yukicoco avatar yuluo-yx avatar zhouzhou1017 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.