Go to file
Rick 54b1194753
chore: add a badge of LoC (#71)
2023-05-24 19:51:21 +08:00
.github chore: ignore the test report when actor is not linuxsuren (#67) 2023-05-10 18:17:39 +08:00
.vscode fix: cannot find the correct parent test cases (#56) 2023-04-26 21:14:38 +08:00
cmd fix: the data parent directory is missing (#70) 2023-05-24 19:31:24 +08:00
docs doc: add an introduction about this project (#42) 2023-04-20 17:49:28 +08:00
pkg fix: the data parent directory is missing (#70) 2023-05-24 19:31:24 +08:00
sample feat: support running before and after jobs with API request (#69) 2023-05-18 09:51:35 +08:00
.gitignore fix: the service status output is missing (#58) 2023-04-27 09:11:06 +08:00
.goreleaser.yaml feat: support to run a specific test case via grpc (#28) 2023-04-05 18:59:08 +08:00
CONTRIBUTION.md feat: support output the test report (#17) 2023-04-01 19:00:50 +08:00
Dockerfile fix: the code smells from sonarqube (#43) 2023-04-18 12:25:55 +08:00
LICENSE Initial commit 2022-06-08 14:12:05 +08:00
Makefile feat: support verify against Kubernetes resources (#41) 2023-04-15 21:47:50 +08:00
README.md chore: add a badge of LoC (#71) 2023-05-24 19:51:21 +08:00
action.yml Add goreleaser config file 2022-06-09 11:09:01 +08:00
go.mod fix: the data parent directory is missing (#70) 2023-05-24 19:31:24 +08:00
go.sum fix: the data parent directory is missing (#70) 2023-05-24 19:31:24 +08:00
main.go feat: support verify against Kubernetes resources (#41) 2023-04-15 21:47:50 +08:00

README.md

Codacy Badge Codacy Badge GitHub All Releases LinuxSuRen/open-source-best-practice

This is a API testing tool.

Features

  • Response Body fields equation check
  • Response Body eval
  • Verify the Kubernetes resources
  • Validate the response body with JSON schema
  • Pre and post handle with the API request
  • Output reference between TestCase
  • Run in server mode, and provide the gRPC endpoint
  • VS Code extension support

Get started

Install it via hd or download from releases:

hd install atest

see the following usage:

API testing tool

Usage:
  atest [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  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

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

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