csv 源码
drillCode,drillName,code,msg
y500,牙轮500,200,操作成功
YL201,牙轮201,500,牙轮编号已存在
运行后报错
E httprunner.exceptions.ValidationFailure: assert body.code equal 200(str) ==> fail
E check_item: body.code
E check_value: 200(int)
E assert_method: equal
E expect_value: 200(str)
c:userslicappdatalocalprogramspythonpython37libsite-packageshttprunner
esponse.py:270: Validat
c:userslicappdatalocalprogramspythonpython37libsite-packageshttprunner
esponse.py:270: ValidationFa
============================================================================== short test summary info ===============================================================================
FAILED test_add_drill_csv.py::TestAddDrill::test_start[param0] - httprunner.exceptions.ValidationFailure: assert body.code equal random.randint(10000000(str) ==> fail
FAILED test_add_drill_csv.py::TestAddDrill::test_start[param1] - httprunner.exceptions.ValidationFailure: assert body.code equal str(500)(str) ==> fail
================================================================================= 2 failed in
这个问题是 检查的类型为int类型,断言返回的是str类型
尝试函数 .tostring(),str(),int()函数 都不好用
后解决方案:
csv参数文件去掉code属性
py文件断言修改:
.assert_contained_by('body.code',[200,500])