Api “错误”;此文件中应仅包含一个文档,但找到多个“文档”;在酒馆里

Api “错误”;此文件中应仅包含一个文档,但找到多个“文档”;在酒馆里,api,yaml,pytest,tavern,Api,Yaml,Pytest,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: g

我使用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
无法处理包含多个文档的文件,因为它基本上是从其根节点开始,用引用文档中的内容替换当前节点。因为一个包含多个文档的文件有多个根节点,所以不清楚什么是
!包含
应该在那里执行

也就是说,您当然可以在同一文档中定义两个阶段:

#[snip]
阶段:
-id:get_列表
name:测试以获取所有列表
请求:
网址:
方法:邮寄
标题:
授权:
-id:创建订单
名称:创建订单的测试
跳过:错
请求:
网址:
方法:邮寄
标题:
授权:

在此处显示代码、配置或日志时,请使用编辑器中提供的格式化工具。支持降价格式。很抱歉。我会记住这一点。谢谢