我有两个yaml文件用于测试,common.yaml
和test.yaml
。在common.yaml
中定义了一些变量:
name: Common test information
description: Common data used by test cases
variables:
url: http://localhost:8080/v2
timeout: 30
在测试文件中:
includes:
- !include common.yaml
stages:
- name: test
request:
url: "{url:s}/test"
method: GET
timeout: "{timeout:d}"
response:
status_code: 200
它使用在common
文件上定义的timeout
。运行测试时出现以下错误:
tavern.util.exceptions.BadSchemaError: 'timeout' must be either a float/int or a 2-tuple of floats/ints - got '{timeout:d}' (type <class 'str'>)
似乎酒馆不认识timeout
的类型。我已经指定了最后的类型是d
,但是为什么它没有出现。你知道吗
使用超时:!“内景”{超时:d}““
或超时:!“浮动”{超时:f}““
从字符串转换类型
相关问题 更多 >
编程相关推荐