酒馆中的错误 "Expected only one document in this file but found multiple"
Error "Expected only one document in this file but found multiple" in tavern
我使用 common.yaml 文件共享阶段,但如果我添加多个阶段,它会显示错误 "tavern.util.exceptions.UnexpectedDocumentsError:"。我是否必须为每个阶段添加单独的 yams 文件?
我的 common.yaml 文件
name: Test /order endpoint status code and response
description:
Reusable test stage to get listings
stages:
- id: get_listings
name: Test to get all the listings
request:
url:
method: POST
headers:
Authorization:
---
name: Test /status endpoint to create order
description:
Reusable test stage for order creation
stages:
- id: create_order
name: Test to create an order
skip: False
request:
url:
method: POST
headers:
Authorization:
Testfile.yaml
test_name: Test endpoint
includes:
- !include common.yaml
stages:
- type: ref
id: get_listings
- type: ref1
id: create_order
!include
无法处理包含多个文档的文件,因为它基本上用引用文档的内容替换当前节点,从其根节点开始。由于包含多个文档的文件有多个根节点,因此不清楚 !include
应该在那里做什么。
也就是说,您当然可以在同一文档中简单地定义两个阶段:
# [snip]
stages:
- id: get_listings
name: Test to get all the listings
request:
url:
method: POST
headers:
Authorization:
- id: create_order
name: Test to create an order
skip: False
request:
url:
method: POST
headers:
Authorization:
我使用 common.yaml 文件共享阶段,但如果我添加多个阶段,它会显示错误 "tavern.util.exceptions.UnexpectedDocumentsError:"。我是否必须为每个阶段添加单独的 yams 文件?
我的 common.yaml 文件
name: Test /order endpoint status code and response
description:
Reusable test stage to get listings
stages:
- id: get_listings
name: Test to get all the listings
request:
url:
method: POST
headers:
Authorization:
---
name: Test /status endpoint to create order
description:
Reusable test stage for order creation
stages:
- id: create_order
name: Test to create an order
skip: False
request:
url:
method: POST
headers:
Authorization:
Testfile.yaml
test_name: Test endpoint
includes:
- !include common.yaml
stages:
- type: ref
id: get_listings
- type: ref1
id: create_order
!include
无法处理包含多个文档的文件,因为它基本上用引用文档的内容替换当前节点,从其根节点开始。由于包含多个文档的文件有多个根节点,因此不清楚 !include
应该在那里做什么。
也就是说,您当然可以在同一文档中简单地定义两个阶段:
# [snip]
stages:
- id: get_listings
name: Test to get all the listings
request:
url:
method: POST
headers:
Authorization:
- id: create_order
name: Test to create an order
skip: False
request:
url:
method: POST
headers:
Authorization: