Go to file
Rick 8da089067c
feat: add a HTTP request collector as atest extension (#85)
* feat: add a HTTP request collector as atest extension

* add unit tests for collector

* add unit tests

* support to release atest-collector via goreleaser

---------

Co-authored-by: Rick <linuxsuren@users.noreply.github.com>
2023-06-07 22:59:47 +08:00
.github feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
.vscode fix: cannot find the correct parent test cases (#56) 2023-04-26 21:14:38 +08:00
cmd add unit tests for func cmd (#84) 2023-06-04 14:03:01 +08:00
docs doc: add an introduction about this project (#42) 2023-04-20 17:49:28 +08:00
extensions/collector feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
pkg feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
sample docs: add more test cases of answer (#82) 2023-06-02 08:52:28 +08:00
.gitignore feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
.goreleaser.yaml feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +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: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
README.md feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
action.yml Add goreleaser config file 2022-06-09 11:09:01 +08:00
go.mod feat: support to reference in the request body (#79) 2023-05-30 21:44:22 +08:00
go.sum feat: support to reference in the request body (#79) 2023-05-30 21:44:22 +08:00
go.work feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +08:00
go.work.sum feat: add a HTTP request collector as atest extension (#85) 2023-06-07 22:59:47 +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

Get started

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
  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