20230525_接口自动化测试_作业

数据2102王梦熙20230525_接口自动化测试_作业

数据2101王俞媛1 test: pytest - Gitee.com

数据2101王庆洋

数据2101郭然然接口自动化:test.课堂练习: pytest以及自动化练习

数据2101张云鹤 525: zuoye - Gitee.com

信计2002王玮

1 个赞

数据2102游晨阳0525作业

信计2001王耀祥 future: .................

信计2001韩涛

数据2102赖烨伟:https://gitee.com/Yoyi-illidan/testpet.git

5-25数据2102-朱垚:test: 作业1111111111111111111

https://gitee.com/lsc__666/525lsc-warehouse.git

5.25作业 数据2101丁雪杨 · 3c63b37 · 未来future/ccd - Gitee.com

import requests
import allure

@allure.feature(‘宠物商店宠物信息接口测试’)
class TestPetStoreAPI:
@allure.title(‘冒烟测试1’)
def test_add_pet(self):
with allure.step(‘准备新增宠物请求数据’):
headers = {‘Content-Type’: ‘application/json’}
data = {“ID”: 10,“NAME”: “tiger”,“status”: “not for sale”}
with allure.step(‘发送新增宠物请求’):
r = requests.post(‘https://petstore.swagger.io/v2/pet’, headers=headers, json=data)
with allure.step(‘检查新增宠物请求响应状态码’):
assert r.status_code == 200

@allure.title('冒烟测试2')
def test_find_pet_by_status(self):
    with allure.step('准备宠物请求数据'):
        p = {'status': 'not for sale'}
    with allure.step('发送宠物请求'):
        r = requests.get('https://petstore.swagger.io/v2/pet/findByStatus', params=p)
    with allure.step('检查查询宠物请求响应状态码'):
        assert r.status_code == 200

ttps://gitee.com/chen-hanjie-data-2101/

import requests
import allure

@allure.feature(‘宠物商店宠物信息接口测试’)
class TestPetStoreAPI:
@allure.title(‘冒烟测试1’)
def test_add(self):
with allure.step(‘准备新增宠物请求数据’):
headers = {‘Content-Type’: ‘application/json’}
data = {“ID”: 10,“NAME”: “tiger”,“status”: “not for sale”}
with allure.step(‘发送新增宠物请求’):
r = requests.post(‘https://petstore.swagger.io/v2/pet’, headers=headers, json=data)
with allure.step(‘检查新增宠物请求响应状态码’):
assert r.status_code == 200

@allure.title(‘冒烟测试2’)
def test_status(self):
with allure.step(‘准备宠物请求数据’):
p = {‘status’: ‘not for sale’}
with allure.step(‘发送宠物请求’):
r = requests.get(‘https://petstore.swagger.io/v2/pet/findByStatus’, params=p)
with allure.step(‘检查查询宠物请求响应状态码’):
assert r.status_code == 200