Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(api-test): add multi-stage demo for api-test 2.0 #47

Merged
merged 1 commit into from
Jul 9, 2024
Merged
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
57 changes: 37 additions & 20 deletions actions/api-test/2.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,41 @@

#### 使用

推荐通过图形化界面进行编辑。

通过声明出参,可以将接口返回的数据传递给下游 action,例如下例中的 `a-cookie`。

```yaml
api-test:
version: 2.0
params:
name: 访问 Dice 官网
url: https://dice.terminus.io
method: GET
params:
- key: p1
value: v1
- key: p2
value: v2
headers:
- key: h1
value: v1
- key: h2
value: v2
body:
type: application/json
content: '{"name":"dice"}'
```
version: "1.1"
stages:
- stage:
- api-test:
description: 执行单个接口测试。上层可以通过 pipeline.yml 编排一组接口测试的执行顺序。
version: "2.0"
params:
asserts:
- arg: a-cookie
operator: not_empty
body:
type: none
method: GET
out_params:
- expression: Set-Cookie
key: a-cookie
source: header
url: https://www.erda.cloud/api/users/me
timeout: 3600
- stage:
- custom-script:
alias: cookie-printer
description: 运行自定义命令
version: "2.0"
commands:
- |-
c="${{ outputs.api-test.a-cookie }}"
echo "I got a cookie: $c"
- 'echo "action meta: b-cookie=$c"'
resources:
cpu: 0.1
mem: 256
```
Loading