|
1 | | -[](https://cla-assistant.io/LinuxSuRen/api-testing) |
2 | | -[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) |
3 | | -[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) |
4 | | -[](https://tooomm.github.io/github-release-stats/?username=linuxsuren&repository=api-testing) |
5 | | -[](https://hub.docker.com/r/linuxsuren/api-testing) |
6 | | -[](https://github.com/LinuxSuRen/open-source-best-practice) |
7 | | - |
8 | | - |
9 | | -> English | [中文](README-ZH.md) |
10 | | -
|
11 | | -This is an awesome API testing tool. 🚀 |
12 | | - |
13 | | -## Features |
14 | | - |
15 | | -* Supported protocols: HTTP, gRPC, tRPC |
16 | | -* Multiple test report formats: Markdown, HTML, PDF, Stdout |
17 | | -* Mock Server in simple configuration, and Open API support |
18 | | -* Support converting to [JMeter](https://jmeter.apache.org/) files |
19 | | -* Response Body fields equation check or [eval](https://expr.medv.io/) |
20 | | -* Validate the response body with [JSON schema](https://json-schema.org/) |
21 | | -* Pre and post handle with the API request |
22 | | -* Run in server mode, and provide the [gRPC](pkg/server/server.proto) and HTTP endpoint |
23 | | -* [VS Code extension](https://github.com/LinuxSuRen/vscode-api-testing) support |
24 | | -* Multiple storage backends supported(Local, ORM Database, S3, Git, Etcd, etc.) |
25 | | -* [HTTP API record](https://github.com/LinuxSuRen/atest-ext-collector) |
26 | | -* Install in multiple use cases(CLI, Container, Native-Service, [Operator](https://github.com/LinuxSuRen/atest-operator), Helm, etc.) |
27 | | -* Monitoring integration with Prometheus, SkyWalking |
28 | | - |
29 | | -## Get started |
30 | | - |
31 | | -[](http://play-with-docker.com?stack=https://raw.githubusercontent.com/LinuxSuRen/api-testing/master/docs/manifests/docker-compose.yml) |
32 | | - |
33 | | -Install it via [hd](https://github.com/LinuxSuRen/http-downloader) or download from [releases](https://github.com/LinuxSuRen/api-testing/releases): |
34 | | - |
35 | | -```shell |
36 | | -hd install atest |
37 | | -``` |
38 | | - |
39 | | -or, you can install it in Kubernetes. See also the [manifests](docs/manifests/kubernetes/default/manifest.yaml). |
40 | | - |
41 | | -see the following usage: |
42 | | - |
43 | | -```shell |
44 | | -API testing tool |
45 | | - |
46 | | -Usage: |
47 | | - atest [command] |
48 | | - |
49 | | -Available Commands: |
50 | | - completion Generate the autocompletion script for the specified shell |
51 | | - func Print all the supported functions |
52 | | - help Help about any command |
53 | | - json Print the JSON schema of the test suites struct |
54 | | - run Run the test suite |
55 | | - sample Generate a sample test case YAML file |
56 | | - server Run as a server mode |
57 | | - service Install atest as a Linux service |
58 | | - |
59 | | -Flags: |
60 | | - -h, --help help for atest |
61 | | - -v, --version version for atest |
62 | | - |
63 | | -Use "atest [command] --help" for more information about a command. |
64 | | -``` |
65 | | -
|
66 | | -below is an example of the usage, and you could see the report as well: |
67 | | -
|
68 | | -`atest run -p sample/testsuite-gitlab.yaml --duration 1m --thread 3 --report md` |
69 | | -
|
70 | | -| API | Average | Max | Min | Count | Error | |
71 | | -|---|---|---|---|---|---| |
72 | | -| GET https://gitlab.com/api/v4/projects | 1.152777167s | 2.108680194s | 814.928496ms | 99 | 0 | |
73 | | -| GET https://gitlab.com/api/v4/projects/45088772 | 840.761064ms | 1.487285371s | 492.583066ms | 10 | 0 | |
74 | | -consume: 1m2.153686448s |
75 | | -
|
76 | | -## Use in Docker |
77 | | -
|
78 | | -Use `atest` as server mode in Docker, then you could visit the UI from `8080`: |
79 | | -
|
80 | | -```bash |
81 | | -docker run --pull always -p 8080:8080 ghcr.io/linuxsuren/api-testing:master |
82 | | -``` |
83 | | -
|
84 | | -Use `atest-collector` in Docker: |
85 | | -
|
86 | | -```bash |
87 | | -docker run -p 1234:8080 -v /var/tmp:/var/tmp \ |
88 | | - ghcr.io/linuxsuren/api-testing atest-collector \ |
89 | | - --filter-path /api \ |
90 | | - -o /var/tmp/sample.yaml |
91 | | -# you could find the test cases file from /var/tmp/sample |
92 | | -# cat /var/tmp/sample |
93 | | -``` |
94 | | -
|
95 | | -## Template |
96 | | -
|
97 | | -The following fields are templated with [sprig](https://masterminds.github.io/sprig/): |
98 | | -
|
99 | | -* API |
100 | | -* Request Body |
101 | | -* Request Header |
102 | | -
|
103 | | -### Functions |
104 | | -
|
105 | | -You could use all the common functions which comes from [sprig](https://masterminds.github.io/sprig/). Besides some specific functions are available: |
106 | | -
|
107 | | -| Name | Usage | |
108 | | -|---|---| |
109 | | -| `randomKubernetesName` | `{{randomKubernetesName}}` to generate Kubernetes resource name randomly, the name will have 8 chars | |
110 | | -| `sleep` | `{{sleep(1)}}` in the pre and post request handle | |
111 | | -
|
112 | | -## Verify against Kubernetes |
113 | | -
|
114 | | -It could verify any kinds of Kubernetes resources. Please set the environment variables before using it: |
115 | | -
|
116 | | -* `KUBERNETES_SERVER` |
117 | | -* `KUBERNETES_TOKEN` |
118 | | -
|
119 | | -See also the [example](sample/kubernetes.yaml). |
120 | | -
|
121 | | -## TODO |
122 | | -
|
123 | | -* Reduce the size of context. |
124 | | -* Support customized context. |
125 | | -
|
126 | | -## Limit |
127 | | -
|
128 | | -* Only support to parse the response body when it's a map or array. |
129 | | -
|
130 | | -## Community Exchange |
131 | | -
|
132 | | -Feel free to talk to us about any questions you may have about API Testing in the following ways. |
133 | | -
|
134 | | -### Mailing List |
135 | | -
|
136 | | -`[email protected]`, Feel free to discuss everything related to API Testing via this mailing list. |
137 | | -
|
138 | | -### `GitHub` discussion |
139 | | -
|
140 | | -[GitHub Discussion](https://github.com/LinuxSuRen/api-testing/discussions/new/choose) |
| 1 | +[](https://cla-assistant.io/LinuxSuRen/api-testing) |
| 2 | +[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) |
| 3 | +[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) |
| 4 | +[](https://tooomm.github.io/github-release-stats/?username=linuxsuren&repository=api-testing) |
| 5 | +[](https://hub.docker.com/r/linuxsuren/api-testing) |
| 6 | +[](https://github.com/LinuxSuRen/open-source-best-practice) |
| 7 | + |
| 8 | + |
| 9 | +> English | [中文](README-ZH.md) |
| 10 | +
|
| 11 | +This is an awesome API testing tool. 🚀 |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +* Supported protocols: HTTP, gRPC, tRPC |
| 16 | +* Multiple test report formats: Markdown, HTML, PDF, Stdout |
| 17 | +* Mock Server in simple configuration, and Open API support |
| 18 | +* Support converting to [JMeter](https://jmeter.apache.org/) files |
| 19 | +* Response Body fields equation check or [eval](https://expr.medv.io/) |
| 20 | +* Validate the response body with [JSON schema](https://json-schema.org/) |
| 21 | +* Pre and post handle with the API request |
| 22 | +* Run in server mode, and provide the [gRPC](pkg/server/server.proto) and HTTP endpoint |
| 23 | +* [VS Code extension](https://github.com/LinuxSuRen/vscode-api-testing) support |
| 24 | +* Multiple storage backends supported(Local, ORM Database, S3, Git, Etcd, etc.) |
| 25 | +* [HTTP API record](https://github.com/LinuxSuRen/atest-ext-collector) |
| 26 | +* Install in multiple use cases(CLI, Container, Native-Service, [Operator](https://github.com/LinuxSuRen/atest-operator), Helm, etc.) |
| 27 | +* Monitoring integration with Prometheus, SkyWalking |
| 28 | + |
| 29 | +## Get started |
| 30 | + |
| 31 | +[](http://play-with-docker.com?stack=https://raw.githubusercontent.com/LinuxSuRen/api-testing/master/docs/manifests/docker-compose.yml) |
| 32 | + |
| 33 | +Install it via [hd](https://github.com/LinuxSuRen/http-downloader) or download from [releases](https://github.com/LinuxSuRen/api-testing/releases): |
| 34 | + |
| 35 | +```shell |
| 36 | +hd install atest |
| 37 | +``` |
| 38 | + |
| 39 | +or, you can install it in Kubernetes. See also the [manifests](docs/manifests/kubernetes/default/manifest.yaml). |
| 40 | + |
| 41 | +see the following usage: |
| 42 | + |
| 43 | +```shell |
| 44 | +API testing tool |
| 45 | + |
| 46 | +Usage: |
| 47 | + atest [command] |
| 48 | + |
| 49 | +Available Commands: |
| 50 | + completion Generate the autocompletion script for the specified shell |
| 51 | + func Print all the supported functions |
| 52 | + help Help about any command |
| 53 | + json Print the JSON schema of the test suites struct |
| 54 | + run Run the test suite |
| 55 | + sample Generate a sample test case YAML file |
| 56 | + server Run as a server mode |
| 57 | + service Install atest as a Linux service |
| 58 | + |
| 59 | +Flags: |
| 60 | + -h, --help help for atest |
| 61 | + -v, --version version for atest |
| 62 | + |
| 63 | +Use "atest [command] --help" for more information about a command. |
| 64 | +``` |
| 65 | +
|
| 66 | +below is an example of the usage, and you could see the report as well: |
| 67 | +
|
| 68 | +`atest run -p sample/testsuite-gitlab.yaml --duration 1m --thread 3 --report md` |
| 69 | +
|
| 70 | +| API | Average | Max | Min | Count | Error | |
| 71 | +|---|---|---|---|---|---| |
| 72 | +| GET https://gitlab.com/api/v4/projects | 1.152777167s | 2.108680194s | 814.928496ms | 99 | 0 | |
| 73 | +| GET https://gitlab.com/api/v4/projects/45088772 | 840.761064ms | 1.487285371s | 492.583066ms | 10 | 0 | |
| 74 | +consume: 1m2.153686448s |
| 75 | +
|
| 76 | +## Use in Docker |
| 77 | +
|
| 78 | +Use `atest` as server mode in Docker, then you could visit the UI from `8080`: |
| 79 | +
|
| 80 | +```bash |
| 81 | +docker run --pull always -p 8080:8080 ghcr.io/linuxsuren/api-testing:master |
| 82 | +``` |
| 83 | +
|
| 84 | +Use `atest-collector` in Docker: |
| 85 | +
|
| 86 | +```bash |
| 87 | +docker run -p 1234:8080 -v /var/tmp:/var/tmp \ |
| 88 | + ghcr.io/linuxsuren/api-testing atest-collector \ |
| 89 | + --filter-path /api \ |
| 90 | + -o /var/tmp/sample.yaml |
| 91 | +# you could find the test cases file from /var/tmp/sample |
| 92 | +# cat /var/tmp/sample |
| 93 | +``` |
| 94 | +
|
| 95 | +## Template |
| 96 | +
|
| 97 | +The following fields are templated with [sprig](https://masterminds.github.io/sprig/): |
| 98 | +
|
| 99 | +* API |
| 100 | +* Request Body |
| 101 | +* Request Header |
| 102 | +
|
| 103 | +### Functions |
| 104 | +
|
| 105 | +You could use all the common functions which comes from [sprig](https://masterminds.github.io/sprig/). Besides some specific functions are available: |
| 106 | +
|
| 107 | +| Name | Usage | |
| 108 | +|---|---| |
| 109 | +| `randomKubernetesName` | `{{randomKubernetesName}}` to generate Kubernetes resource name randomly, the name will have 8 chars | |
| 110 | +| `sleep` | `{{sleep(1)}}` in the pre and post request handle | |
| 111 | +
|
| 112 | +## Verify against Kubernetes |
| 113 | +
|
| 114 | +It could verify any kinds of Kubernetes resources. Please set the environment variables before using it: |
| 115 | +
|
| 116 | +* `KUBERNETES_SERVER` |
| 117 | +* `KUBERNETES_TOKEN` |
| 118 | +
|
| 119 | +See also the [example](sample/kubernetes.yaml). |
| 120 | +
|
| 121 | +## TODO |
| 122 | +
|
| 123 | +* Reduce the size of context. |
| 124 | +* Support customized context. |
| 125 | +
|
| 126 | +## Limit |
| 127 | +
|
| 128 | +* Only support to parse the response body when it's a map or array. |
| 129 | +
|
| 130 | +## Community Exchange |
| 131 | +
|
| 132 | +Feel free to talk to us about any questions you may have about API Testing in the following ways. |
| 133 | +
|
| 134 | +### Mailing List |
| 135 | +
|
| 136 | +`[email protected]`, Feel free to discuss everything related to API Testing via this mailing list. |
| 137 | +
|
| 138 | +### `GitHub` discussion |
| 139 | +
|
| 140 | +[GitHub Discussion](https://github.com/LinuxSuRen/api-testing/discussions/new/choose) |
0 commit comments