当前位置:网站首页>Pytest interface automation test framework | Interface Association
Pytest interface automation test framework | Interface Association
2022-07-18 23:41:00 【COCOgsta】
Video source :B standing 《 Risking your life to upload !pytest Interface automation test framework ( From basic theory to project practice and secondary development ) Teaching video 【 software test 】》
Organize the teacher's course content and test notes while studying , And share it with you , Infringement is deleted , Thank you for your support !
For some operations , It requires the data returned by the previous interface as the request data of the current interface , At this time, parameter association is required . A Interface A certain content B Interface
How to do Interface Association ?
step :
- Extract the data we want
- Save to a variable
- Use directly when using
import requests
# Login interface
url = 'http://39.98.138.157:5000/api/login'
data = {"password": "123456", "username": "admin"}
res = requests.post(url, json=data)
print(res.json())
# Take out the work card value Put it in a variable When the next interface is used Take variables directly
# Value It turns into a dictionary How does the dictionary take values Key value pair Get the key and get the value
token = res.json()['token']
print(token)
# Zhang San logs in Three cards Li Si logs in Li Sigong
# Interface of personal information
url = 'http://39.98.138.157:5000/api/getuserinfo'
header = {'token': token}
res = requests.get(url, headers=header)
print(res.json())Running results :
C:\Users\guoliang\AppData\Local\Programs\Python\Python36\python.exe D:/SynologyDrive/SourceCode/pytest/apitest/test.py
{'adress': {'city': 'changsha'}, 'httpstatus': 200, 'info': {'age': 18, 'name': 'admin'}, 'msg': 'success', 'token': '23657DGYUSGD126731638712GE18271H'}
23657DGYUSGD126731638712GE18271H
{'data': [{'nikename': ' The breeze pure Yang ', 'openid': 'UEHUXUXU78272SDSassDD', 'userbalance': 5678.9, 'userid': 17890, 'username': 'admin', 'userpoints': 4321}], 'httpstatus': 200}
Process finished with exit code 0
边栏推荐
- Hibench generates benchmark data sets [wordcount as an example]
- nodeJS编译环境下使用yarn工具的安装与使用方法
- Chapter IV instruction system
- Design of DHT11 temperature and humidity sensor based on stm32
- Offer gifts in July. Buy a cloud plate and give it to the super grade Guiqi. It's only limited to 2 months. If you want to buy it, hurry up
- pytest接口自动化测试框架 | 项目实战(pytest+allure+数据驱动)
- res.cc的使用
- Programming examples of stm32f1 and stm32cubeide-w25q-spi-flash and FatFs migration
- 7、常见的垃圾回收器
- How is your MySQL server? More than 3.6 million units worldwide have been exposed to the Internet...
猜你喜欢
![[technology fragment] rename suffix of duplicate files based on exponential diffusion binary search](/img/1c/19fe2d9df5e075b903058aa0b9b521.png)
[technology fragment] rename suffix of duplicate files based on exponential diffusion binary search

Mysql的锁机制

10.10:VectorDraw C# VS VectorDraw WEB/Crack-VectorDraw

Basic knowledge of common amplifiers (I)

每日一题:合并两个排序的链表(剑指offer25)

nodeJS编译环境下使用yarn工具的安装与使用方法

用cmd命令进行磁盘清理(主要是系统盘)

Google icons 库 Compose就可以直接用。

Send papers! AI, machine learning, CV boss scientific research project enrollment!

JVM-SANDBOX导致目标服务JVM Metaspace OOM的调查始末
随机推荐
OSPF comprehensive experiment
Recent software test interview questions encountered by group Friends
【STL】模拟实现vector
解决windbg无法加载ntdll符号的问题
Clean the disk with CMD command (mainly the system disk)
Send papers! AI, machine learning, CV boss scientific research project enrollment!
Lifeguard certificate examination
nodejs不支持ES6模块化规范的解决方案
第四章 指令系统
在安装虚拟机时,”intel vt-x 处于禁用状态“ 如何解决
Mysql索引的使用
Jvm-sandbox leads to the investigation of the target service JVM Metaspace oom
验证两个字符串一致
2022-07-15 study notes of group 5 self-cultivation class (every day)
星巴克不使用两阶段提交
Compose carousel
相对于坐标位置,使用 GTID 配置复制时都具备哪些优势
搭建夜莺集群监测系统
Buffer Pool 核心原理
Nodejs joi module validation