Go to file
Rick 7d9a97f46f
feat: support to rename test suite and case (#550)
* feat: support to rename test suite and case

* try to make the e2e be more stable

---------

Co-authored-by: rick <linuxsuren@users.noreply.github.com>
2024-10-25 09:24:36 +08:00
.github refactor: create components of the atest ui (#520) 2024-10-03 22:41:53 +08:00
.vscode fix: cannot find the correct parent test cases (#56) 2023-04-26 21:14:38 +08:00
cmd feat: support to upload random image files (#541) 2024-10-03 17:45:49 +08:00
console feat: support to rename test suite and case (#550) 2024-10-25 09:24:36 +08:00
docs Add JSON schema for mock types (#499) 2024-06-28 08:26:29 +08:00
e2e feat: support to rename test suite and case (#550) 2024-10-25 09:24:36 +08:00
extensions chore: split extensions into seperate repositories (#331) 2023-12-28 14:59:09 +08:00
helm/api-testing feat: add serviceMonitor in the helm chart (#485) 2024-06-13 17:56:01 +08:00
operator feat: add logging support (#389) 2024-04-22 18:15:46 +08:00
pkg feat: support to rename test suite and case (#550) 2024-10-25 09:24:36 +08:00
sample fix: cannot read the query (#317) 2023-12-18 10:56:49 +08:00
tools move auth module into a new project (#522) 2024-08-09 14:28:10 +08:00
.dockerignore feat: add http requests metrics (#495) 2024-06-19 14:43:33 +08:00
.editorconfig feat: support to duplicate test suite and case (#455) 2024-05-27 09:57:23 +08:00
.gitignore feat: improve the desktop system control features (#454) 2024-05-25 21:44:22 +08:00
.gitpod.yml feat: provide the query parameter via swagger (#339) 2024-01-22 11:04:12 +08:00
.goreleaser.yaml chore: split extensions into seperate repositories (#331) 2023-12-28 14:59:09 +08:00
.licenserc.yaml feat: add graphql feature support (#326) 2023-12-21 11:15:12 +08:00
.remarkrc feat: add a new extension: mongodb (#278) 2023-11-18 13:58:34 +08:00
CODE_OF_CONDUCT.md chore: rename CODE_OF_CONDUCT.md (#403) 2024-04-26 10:40:08 +08:00
CONTRIBUTING-ZH.md chore: add docs style guide links (#456) 2024-05-27 17:24:32 +08:00
CONTRIBUTING.md chore: add docs style guide links (#456) 2024-05-27 17:24:32 +08:00
Dockerfile move auth module into a new project (#522) 2024-08-09 14:28:10 +08:00
LICENSE feat: add graphql feature support (#326) 2023-12-21 11:15:12 +08:00
Makefile optimize: optimize makefile and tools (#414) 2024-05-08 21:27:55 +08:00
README-ZH.md chore: add project years badge (#551) 2024-10-24 15:44:39 +08:00
README.md chore: add project years badge (#551) 2024-10-24 15:44:39 +08:00
SECURITY.md chore: add security-related (#391) 2024-04-22 21:37:47 +08:00
action.yml Add goreleaser config file 2022-06-09 11:09:01 +08:00
atest-store-git feat: support to print the progress when oci download (#544) 2024-10-05 15:41:12 +08:00
checklink_config.json feat: add github action to check md link (#258) 2023-10-27 19:48:18 +08:00
go.mod feat: support to run test case in batch mode (#548) 2024-10-15 13:47:18 +08:00
go.sum feat: support to upload random image files (#541) 2024-10-03 17:45:49 +08:00
go.work move auth module into a new project (#522) 2024-08-09 14:28:10 +08:00
go.work.sum feat: support to upload random image files (#541) 2024-10-03 17:45:49 +08:00
main.go fix: the extension might not quit normally (#302) 2023-12-02 19:16:33 +08:00
qodana.yaml feat: support to set the prefix of mock server (#402) (#410) 2024-04-30 14:06:15 +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

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

English | 中文

This is an awesome 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

api-testing-tech@googlegroups.com, Feel free to discuss everything related to API Testing via this mailing list.

GitHub discussion

GitHub Discussion