Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/site/content/zh/latest/tasks/code-generator.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "代码生成"
weight = 103
+++

`atest` 支持把测试用例生成多种开发语言的代码:
Expand Down
20 changes: 13 additions & 7 deletions docs/site/content/zh/latest/tasks/extension.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
+++
title = "插件"
weight = 900
+++

`atest` 会把非核心、可扩展的功能以插件(extension)的形式实现。下面介绍有哪些插件,以及如何使用:

> 在不同的系统中,插件有着不同的表述,例如:extension、plugin 等。

| 类型 | 名称 | 描述 |
|------|------|------|
| 存储 | [orm](https://github.com/LinuxSuRen/atest-ext-store-orm) | 保存数据到关系型数据库中,例如:MySQL |
| 存储 | [s3](https://github.com/LinuxSuRen/atest-ext-store-s3) | 保存数据到对象存储中 |
| 存储 | [etcd](https://github.com/LinuxSuRen/atest-ext-store-etcd) | 保存数据到 Etcd 数据库中 |
| 存储 | [git](https://github.com/LinuxSuRen/atest-ext-store-git) | 保存数据到 Git 仓库中 |
| 存储 | [mongodb](https://github.com/LinuxSuRen/atest-ext-store-mongodb) | 保存数据到 MongDB 中 |
| 类型 | 名称 | 描述 |
|-------|------|----------------------------------|
| 存储 | [orm](https://github.com/LinuxSuRen/atest-ext-store-orm) | 保存数据到关系型数据库中,例如:MySQL、Postgres 等 |
| 存储 | [mongodb](https://github.com/LinuxSuRen/atest-ext-store-mongodb) | 保存数据到 MongDB 中 |
| 存储 | [etcd](https://github.com/LinuxSuRen/atest-ext-store-etcd) | 保存数据到 Etcd 数据库中 |
| 存储 | [iotdb](https://github.com/LinuxSuRen/atest-ext-store-iotdb) | 支持通过 Web UI 查询 IoTDB 数据 |
| 存储 | [Cassandra](https://github.com/LinuxSuRen/atest-ext-store-cassandra) | 支持通过 Web UI 查询 Cassandra 数据 |
| 存储 | [Elasticsearch](https://github.com/LinuxSuRen/atest-ext-store-elasticsearch) | 支持通过 Web UI 查询 Elasticsearch 数据 |
| 存储 | [redis](https://github.com/LinuxSuRen/atest-ext-store-redis) | |
| 存储 | [s3](https://github.com/LinuxSuRen/atest-ext-store-s3) | 保存数据到对象存储中 |
| 存储 | [git](https://github.com/LinuxSuRen/atest-ext-store-git) | 保存数据到 Git 仓库中 |
| 数据 | [Swagger](https://github.com/LinuxSuRen/atest-ext-data-swagger) | |

> `atest` 也是唯一支持如此丰富的存储的接口开发、测试的开源工具。

Expand Down
1 change: 1 addition & 0 deletions docs/site/content/zh/latest/tasks/grpc-TLS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "gRPC TLS verification"
weight = 201
+++

If you want to enable gRPC TLS, you need to generate your certificates in the workspace, or you can use an absolute path
Expand Down
3 changes: 2 additions & 1 deletion docs/site/content/zh/latest/tasks/grpc-manual.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "gRPC测试用例编写指南"
weight = 200
+++

本文档将介绍如何编写`api-testing`的 gRPC API 的测试用例。
Expand Down Expand Up @@ -117,4 +118,4 @@ expect:

请注意,对于服务端流和双向流模式,服务器发送多条消息的情况下,此处的`data`字段内的填写的目标数组,需同时满足与待验证数组长度相,两个数组同一下标的内容完全相同。

`gRPC API``verify`功能与`HTTP API`保持一致,此处不再赘述。
`gRPC API``verify` 功能与 `HTTP API` 保持一致,此处不再赘述。
30 changes: 30 additions & 0 deletions docs/site/content/zh/latest/tasks/job.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
+++
title = "任务"
weight = 101
+++

在特定情况下,执行接口测试用例前需要执行相应的任务,例如:数据初始化、等待服务就绪等等。 `atest` 的任务功能,就是为了满足这类场景而设计的。

> 任务的执行引擎为 [expr](https://expr.medv.io),如果当前页面给出的示例无法满足你的需求,可以查阅相关的官方文档。

## 等待接口响应码为 200

以下的例子会每隔一秒请求一次指定的接口,并检查响应码(Status Code)是否为 200,如果不是的话,则最多会重试 3 次:

```yaml
name: demo
api: http://localhost
items:
- name: login
before:
items:
- httpReady("http://localhost/health", 3)
request:
api: /demo
```

如果希望检查响应体的话,则可以用下面的表达式:

```
httpReady("http://localhost:17001/actuator/health", 3, 'components.discoveryComposite.components.eureka.details.applications["AUTH"] == 1')
```
1 change: 1 addition & 0 deletions docs/site/content/zh/latest/tasks/mock.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "Mock 服务"
weight = 104
+++

Mock 服务在前后端并行开发、系统对接、设备对接场景下能起到非常好的作用,可以极大地降低团队之间、系统之间的耦合度。
Expand Down
1 change: 1 addition & 0 deletions docs/site/content/zh/latest/tasks/secure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "关于安全"
weight = 8
+++

通常在不使用 TLS 证书认证时,gRPC 客户端与服务端之间进行的是明文通信,信息易被第三方监听或篡改。所以大多数情况下均推荐使用 SSL/TLS 保护 gRPC 服务。目前`atest`已实现服务端 TLS,双向 TLS(mTLS) 需等待后续实现。
Expand Down
7 changes: 7 additions & 0 deletions docs/site/content/zh/latest/tasks/template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "用例模板"
weight = 100
+++

`atest` 采用 [sprig](https://masterminds.github.io/sprig/) 作为测试用例的模板引擎。通过模板函数可以生成很多随机数据:
Expand Down Expand Up @@ -28,6 +29,12 @@ title = "用例模板"
{{ now.Format "2006-01-02T15:04:05Z07:00" }}
```

如果想要获取其他时间,则可以参考如下写法:

```gotemplate
{{(now | date_modify "2h") | date "2006-01-02T15:04:05"}}
```

## 环境变量

下面的代码可以获取环境变量 `SHELL` 的值,在需要使用一个全局变量的时候,可以使用这个模板函数:
Expand Down
1 change: 1 addition & 0 deletions docs/site/content/zh/latest/tasks/verify.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
title = "测试用例验证"
weight = 102
+++

`atest` 采用 https://expr.medv.io 对 HTTP 请求响应的验证,比如:返回的数据列表长度验证、具体值的验证等等。下面给出一些例子:
Expand Down
Loading