Go to file
dependabot[bot] 82e91207e9
chore(deps-dev): bump @babel/traverse in /console/atest-ui (#245)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.5 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 17:40:46 +08:00
.github fix: the helm app version is incorrect (#238) 2023-10-13 21:24:47 +08:00
.vscode fix: cannot find the correct parent test cases (#56) 2023-04-26 21:14:38 +08:00
cmd fix: the helm app version is incorrect (#238) 2023-10-13 21:24:47 +08:00
console/atest-ui chore(deps-dev): bump @babel/traverse in /console/atest-ui (#245) 2023-10-19 17:40:46 +08:00
docs chore: correct the Helm image path in helm.md (#240) 2023-10-16 14:06:29 +08:00
extensions chore(deps): bump golang.org/x/net in /extensions/store-etcd (#231) 2023-10-15 08:24:57 +08:00
helm/api-testing feat: add pvc setting into the helm chart (#244) 2023-10-19 17:36:44 +08:00
operator chore(deps): bump golang.org/x/net from 0.7.0 to 0.17.0 in /operator (#230) 2023-10-15 08:24:47 +08:00
pkg feat: add pvc setting into the helm chart (#244) 2023-10-19 17:36:44 +08:00
sample feat: add an expr function httpReady (#214) 2023-09-12 18:20:02 +08:00
.dockerignore chore: add argocd manifest files (#137) 2023-07-21 18:47:11 +08:00
.gitignore feat: support releasing api-testing as a Helm chart (#235) 2023-10-13 17:41:48 +08:00
.gitpod.yml feat: support add multiple stores (#147) 2023-07-29 22:14:58 +08:00
.goreleaser.yaml fix: goreleaser build without embed UI (#176) 2023-08-22 09:46:42 +08:00
.licenserc.yaml Using apache/skywalking-eye to do the license checking work (#207) 2023-09-06 15:27:19 +08:00
CONTRIBUTION.md feat: support integrating with skywalking (#219) 2023-09-26 07:29:10 +08:00
Dockerfile feat: add pvc setting into the helm chart (#244) 2023-10-19 17:36:44 +08:00
LICENSE feat: support verify the store (#157) 2023-08-03 17:06:38 +08:00
Makefile feat: add pvc setting into the helm chart (#244) 2023-10-19 17:36:44 +08:00
README.md feat: support integrating with skywalking (#219) 2023-09-26 07:29:10 +08:00
action.yml Add goreleaser config file 2022-06-09 11:09:01 +08:00
go.mod fix: cannot get correct value when the header consist mutiple values (#234) 2023-10-13 16:13:06 +08:00
go.sum fix: the helm app version is incorrect (#238) 2023-10-13 21:24:47 +08:00
go.work feat: add git as the store extension (#165) 2023-08-15 10:18:08 +08:00
go.work.sum fix: remove redundant empty items from slice and map (#242) 2023-10-17 14:00:30 +08:00
main.go feat: support integrating with skywalking (#219) 2023-09-26 07:29:10 +08:00
sonar-project.properties feat: add gRPC loader for reading and writeing test suites (#120) 2023-07-10 17:03:55 +08:00

README.md

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

This is a API testing tool.

Features

  • Multiple test report formats: Markdown, HTML, PDF, Stdout
  • Support converting to JMeter files
  • Response Body fields equation check or 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 and HTTP endpoint
  • VS Code extension support
  • Multiple storage backends supported(Local, ORM Database, S3, Git, etc)
  • HTTP API record
  • Install in mutiple use cases(CLI, Container, Native-Service, Operator, etc)
  • Monitoring integration with Prometheus, Skywalking

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