首页 > 其他 > 详细

pytest框架中ddt的使用方法

时间:2020-11-05 15:12:49      阅读:192      评论:0      收藏:0      [点我收藏+]
import requests
import pytest

data = [
    (20, 30, 50),
    (0, 0, 0),
    (-2, 3, 1),
]

@pytest.mark.parametrize(a,b,s, data)
def test_add_api(a, b, s):
    url = fhttp://115.28.108.130:5000/add/?a={a}&b={b}
    res = requests.get(url)
    # 期望结果 ‘50‘  实际结果 res.text
    print(响应结果, res.text)
    assert s == res.text


if __name__ == __main__:
    pytest.main([test_add_api.py, -vs])

以上是加法接口用例,pytest中的ddt的使用方法,以及运行方法

pytest框架中ddt的使用方法

原文:https://www.cnblogs.com/guweimeng/p/13931034.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!