-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the shell, python generator is incorrect (#601)
* fix: the shell, python generator is incorrect * update go.sum * update the end-of-line * remove go.work.sum --------- Co-authored-by: rick <[email protected]>
- Loading branch information
1 parent
768b79f
commit 664451e
Showing
12 changed files
with
210 additions
and
2,600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,140 +1,140 @@ | ||
[](https://cla-assistant.io/LinuxSuRen/api-testing) | ||
[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | ||
[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | ||
[](https://tooomm.github.io/github-release-stats/?username=linuxsuren&repository=api-testing) | ||
[](https://hub.docker.com/r/linuxsuren/api-testing) | ||
[](https://github.com/LinuxSuRen/open-source-best-practice) | ||
 | ||
|
||
> English | [中文](README-ZH.md) | ||
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](https://jmeter.apache.org/) files | ||
* Response Body fields equation check or [eval](https://expr.medv.io/) | ||
* Validate the response body with [JSON schema](https://json-schema.org/) | ||
* Pre and post handle with the API request | ||
* Run in server mode, and provide the [gRPC](pkg/server/server.proto) and HTTP endpoint | ||
* [VS Code extension](https://github.com/LinuxSuRen/vscode-api-testing) support | ||
* Multiple storage backends supported(Local, ORM Database, S3, Git, Etcd, etc.) | ||
* [HTTP API record](https://github.com/LinuxSuRen/atest-ext-collector) | ||
* Install in multiple use cases(CLI, Container, Native-Service, [Operator](https://github.com/LinuxSuRen/atest-operator), Helm, etc.) | ||
* Monitoring integration with Prometheus, SkyWalking | ||
|
||
## Get started | ||
|
||
[](http://play-with-docker.com?stack=https://raw.githubusercontent.com/LinuxSuRen/api-testing/master/docs/manifests/docker-compose.yml) | ||
|
||
Install it via [hd](https://github.com/LinuxSuRen/http-downloader) or download from [releases](https://github.com/LinuxSuRen/api-testing/releases): | ||
|
||
```shell | ||
hd install atest | ||
``` | ||
|
||
or, you can install it in Kubernetes. See also the [manifests](docs/manifests/kubernetes/default/manifest.yaml). | ||
|
||
see the following usage: | ||
|
||
```shell | ||
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`: | ||
```bash | ||
docker run --pull always -p 8080:8080 ghcr.io/linuxsuren/api-testing:master | ||
``` | ||
Use `atest-collector` in Docker: | ||
```bash | ||
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](https://masterminds.github.io/sprig/): | ||
* API | ||
* Request Body | ||
* Request Header | ||
### Functions | ||
You could use all the common functions which comes from [sprig](https://masterminds.github.io/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](sample/kubernetes.yaml). | ||
## 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 | ||
`[email protected]`, Feel free to discuss everything related to API Testing via this mailing list. | ||
### `GitHub` discussion | ||
[GitHub Discussion](https://github.com/LinuxSuRen/api-testing/discussions/new/choose) | ||
[](https://cla-assistant.io/LinuxSuRen/api-testing) | ||
[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | ||
[](https://app.codacy.com/gh/LinuxSuRen/api-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | ||
[](https://tooomm.github.io/github-release-stats/?username=linuxsuren&repository=api-testing) | ||
[](https://hub.docker.com/r/linuxsuren/api-testing) | ||
[](https://github.com/LinuxSuRen/open-source-best-practice) | ||
 | ||
|
||
> English | [中文](README-ZH.md) | ||
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](https://jmeter.apache.org/) files | ||
* Response Body fields equation check or [eval](https://expr.medv.io/) | ||
* Validate the response body with [JSON schema](https://json-schema.org/) | ||
* Pre and post handle with the API request | ||
* Run in server mode, and provide the [gRPC](pkg/server/server.proto) and HTTP endpoint | ||
* [VS Code extension](https://github.com/LinuxSuRen/vscode-api-testing) support | ||
* Multiple storage backends supported(Local, ORM Database, S3, Git, Etcd, etc.) | ||
* [HTTP API record](https://github.com/LinuxSuRen/atest-ext-collector) | ||
* Install in multiple use cases(CLI, Container, Native-Service, [Operator](https://github.com/LinuxSuRen/atest-operator), Helm, etc.) | ||
* Monitoring integration with Prometheus, SkyWalking | ||
|
||
## Get started | ||
|
||
[](http://play-with-docker.com?stack=https://raw.githubusercontent.com/LinuxSuRen/api-testing/master/docs/manifests/docker-compose.yml) | ||
|
||
Install it via [hd](https://github.com/LinuxSuRen/http-downloader) or download from [releases](https://github.com/LinuxSuRen/api-testing/releases): | ||
|
||
```shell | ||
hd install atest | ||
``` | ||
|
||
or, you can install it in Kubernetes. See also the [manifests](docs/manifests/kubernetes/default/manifest.yaml). | ||
|
||
see the following usage: | ||
|
||
```shell | ||
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`: | ||
```bash | ||
docker run --pull always -p 8080:8080 ghcr.io/linuxsuren/api-testing:master | ||
``` | ||
Use `atest-collector` in Docker: | ||
```bash | ||
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](https://masterminds.github.io/sprig/): | ||
* API | ||
* Request Body | ||
* Request Header | ||
### Functions | ||
You could use all the common functions which comes from [sprig](https://masterminds.github.io/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](sample/kubernetes.yaml). | ||
## 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 | ||
`[email protected]`, Feel free to discuss everything related to API Testing via this mailing list. | ||
### `GitHub` discussion | ||
[GitHub Discussion](https://github.com/LinuxSuRen/api-testing/discussions/new/choose) |
Oops, something went wrong.