当前位置: 首页 > news >正文

Pytest学习笔记

Pytest学习笔记

1、介绍

1.1、单元测试

单元测试是指在软件开发当中,针对软件的最小单位(函数,方法)进行正确性的检查测试

1.2、单元测试框架

  • 测试发现:从多个py文件里面去找到我们测试用例
  • 测试执行:按照一定的顺序和规则去执行。并生成结果
  • 测试判断:通过断言判断预期结果和实际结果的差异
  • 测试报告:统计测试进度,耗时,通过率,生成测试报告

1.3、自动化测试框架

针对一个项目开发的一个代码框架,这个框架封装了很多的基础模块,报告模块等等

1.4、Pytest

pytest可以和selenium,requests,appium结合实现web自动化,接口自动化,app自动化

pytest可以实现测试用例的跳过以及reruns失败用例重试

pytest可以和allure生成非常美观的测试报告

pytest可以和Jenkins持续集成

pytest有很多非常强大的插件,并且这些插件能够实现很多的实用的操作

  • pytest pytest-xdist 测试用例分布式执行,多CPU分发
  • pytest-ordering 用于改变测试用例的执行顺序(从上到下)
  • pytest-rerunfailures 用例失败后重跑 pytest-html (生成html格式的自动化测试报告)
  • allure-pytest 用于生成美观的测试报告

2、快速入门

2.1、Pytest约定

模块名必须以test_开头或者_test结尾

测试类必须以Test开头,并且不能有init方法

测试方法必须以test开头

pytest
pytest-xdist
pytest-ordering
pytest-rerunfailures
pytest-html
allure-pytest
requests

在这里插入图片描述

2.2、安装依赖

在这里插入图片描述

安装插件时可以通过将要安装的插件卸载requirements.txt中进行快速进行安装

2.3、运行方式

main.py

import pytestif __name__ == '__main__':# pytest.main()

test_demo1.py

class Test_Demo1_C1:def test_01(self):print("hello world!")

test_demo2.py

class Test_Demo1_C2:def test_02(self):print("hello world!2")

test_demo3.py

class Test_Demo1_C3:def test_03(self):print("hello world!3")

test_demo4.py

class Test_Demo1_C4:def test_04(self):print("hello world!4")

test_demo5.py

class Test_Demo1_C4:def test_05(self):print("hello world!5")

test_demo7.py

import timeclass Test_Demo1_C6:def test_06(self):time.sleep(5)print("hello world!6")class Test_Demo1_C7:def test_07(self):time.sleep(5)print("hello world!7")

test_demo8.py

import timeclass Test_Demo1_C8:def test_08(self):time.sleep(5)print("hello world!8")

test_demo9.py

class Test_Demo1_C9:def test_09(self):print("hello world!9")def test_10(self):print("hello world!10")def test_11(self):print("hello world11")assert 1 != 1def test_12(self):print("hello world12")

在这里插入图片描述

1、主函数模式

运行所有

import pytestif __name__ == '__main__':pytest.main()

指定包运行

import pytestif __name__ == '__main__':pytest.main(["./pytest-demo"])  # 运行指定包

指定模块运行

import pytestif __name__ == '__main__':pytest.main(["./pytest-demo1/test_demo3.py"])  # 运行指定模块pytest.main(["./pytest-demo1/test_demo3.py","./pytest-demo1/test_demo4.py"])

指定nodeid运行

import pytestif __name__ == '__main__':pytest.main(["./pytest-demo1/test_demo5.py::Test_Demo1_C5::test_05"])  # 运行指定nodeid

2、命令行模式

运行所有

pytest

指定包运行

pytest ./pytest-demo

指定模块运行

pytest ./pytest-demo/test_demo3.py
pytest ./pytest-demo/test_demo3.py ./pytest-demo1/test_demo4.py

指定nodeid运行

pytest ./pytest-demo1/test_demo5.py::Test_Demo1_C5::test_05

3、配置文件模式

读取pytest.ini全局配置文件运行

pytest.ini(需要时ANSI编码或者GBK)

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./pytest_demo# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test

4、参数详解

-s:输出调试信息,包括print打印的信息

-v:详细的信息

-vs:详细的信息,输出调试信息,包括print打印的信息

-n:多线程(在命令行中-n参数分割符为空格,主函数中-n参数分隔符为=)

在这里插入图片描述

–reruns:失败重试(在命令行中–reruns参数分割符为空格,主函数中–reruns参数分隔符为=)

在这里插入图片描述

-k:运行带指定关键字的

在这里插入图片描述

2.4、执行顺序

默认执行顺序:从上到下,依次执行

可以使用@pytest.mark.run(order=x)改变执行顺序,数字越小越先执行

test_demo13.py

import pytestclass Test_Demo1_C13:@pytest.mark.run(order=1)def test_013(self):print("hello world!13")@pytest.mark.run(order=4)def test_14(self):print("hello world!14")@pytest.mark.run(order=2)def test_15(self):print("hello world15")@pytest.mark.run(order=3)def test_16(self):print("hello world16")

2.5、冒烟测试

1、单组

test_demo14.py

import pytestclass Test_Demo1_C14:@pytest.mark.smokedef test_017(self):print("hello world!17")@pytest.mark.xumengdef test_18(self):print("hello world!18")def test_19(self):print("hello world19")def test_20(self):print("hello world20")

test_demo15.py

import pytestclass Test_Demo1_C15:@pytest.mark.smokedef test_017(self):print("hello world!17")@pytest.mark.xumengdef test_18(self):print("hello world!18")def test_19(self):print("hello world19")def test_20(self):print("hello world20")

pytest.ini

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs -m="smoke"# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./pytest-demo5# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test# 冒烟测试
markers =smoke:冒烟测试

2、多组

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs -m="smoke or xumeng"# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./pytest-demo5# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test# 冒烟测试
markers =smoke:冒烟测试xumeng:测试

2.6、跳过用例

1、无条件跳过

test_demo16.py

import pytestclass Test_Demo1_C16:age = 18@pytest.mark.skip(reason="任性")def test_021(self):print("hello world!21")def test_22(self):print("hello world!22")def test_23(self):print("hello world23")

pytest.ini

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./pytest-demo6# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test

2、有条件跳过

test_demo16.py

import pytestclass Test_Demo1_C16:age = 18@pytest.mark.skip(reason="任性")def test_021(self):print("hello world!21")@pytest.mark.skipif(age != 18, reason="任性")def test_22(self):print("hello world!22")@pytest.mark.skipif(age == 18, reason="任性")def test_23(self):print("hello world23")

pytest.ini

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./pytest-demo6# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test

2.7、生成报告

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs --html ./report/report.html# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./pytest-demo6# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test

在这里插入图片描述

3、前后置处理(固件,夹具)

3.1、基本用法

def setup_module(self):print("测试模块运行前执行一次")def teardown_module(self):print("测试模块运行后执行一次")class Test_Demo:def setup_class(self):print("测试类运行前执行一次")def setup_method(self):print("测试函数运行前执行一次")def test_demo1(self):print("hello ")def test_demo2(self):print("world ")def teardown_method(self):print("测试函数运行后执行一次")def teardown_class(self):print("测试类运行后执行一次")class Test_Demo1:def setup_class(self):print("测试类运行前执行一次1")def setup_method(self):print("测试函数运行前执行一次1")def test_demo1(self):print("hello ")def test_demo2(self):print("world ")def teardown_method(self):print("测试函数运行后执行一次1")def teardown_class(self):print("测试类运行后执行一次1")

在这里插入图片描述

3.2、装饰器

@pytest.fixture(scope=“”,params=“”,autouse=Boolean,ids=“”,name=“”)

1、基础使用(scope、autouse)

scope也支持session

import pytest@pytest.fixture(scope="module", autouse=True)
def module_fixture():print("测试模块运行前执行一次")yieldprint("测试模块运行后执行一次")@pytest.fixture(scope="class", autouse=True)
def class_fixture():print("测试类运行前执行一次")yieldprint("测试类运行后执行一次")@pytest.fixture(scope="function", autouse=True)
def function_fixture():print("测试函数运行前执行一次")yieldprint("测试函数运行后执行一次")class Test_Demo:def test_demo1(self):print("hello")def test_demo2(self):print("world")class Test_Demo1:def test_demo3(self):print("HELLO")def test_demo4(self):print("WORLD")

在这里插入图片描述

2、参数化(params、ids)

import pytest@pytest.fixture(scope="function", params=["T1", "T2", "T3"])
def function_fixture(request):print("测试函数运行前执行一次")yield request.paramprint("测试函数运行后执行一次")class Test_Demo:def test_demo1(self):print("hello")def test_demo2(self, function_fixture):print("WORLD", function_fixture)

在这里插入图片描述

import pytest@pytest.fixture(scope="function", params=["T1", "T2", "T3"], ids=["t1", "t2", "t3"])
def function_fixture(request):print("测试函数运行前执行一次")yield request.paramprint("测试函数运行后执行一次")class Test_Demo:def test_demo1(self):print("hello")def test_demo2(self, function_fixture):print("WORLD", function_fixture)

在这里插入图片描述

3、别名

import pytest@pytest.fixture(scope="function", params=["T1", "T2", "T3"], ids=["t1", "t2", "t3"],name="GGC")
def function_fixture(request):print("测试函数运行前执行一次")yield request.paramprint("测试函数运行后执行一次")class Test_Demo:def test_demo1(self):print("hello")def test_demo2(self, GGC):print("WORLD", GGC)

在这里插入图片描述

4、conftest.py

conftest.py文件是单独存放的一个夹具配置文件,名称是不能更改

可以在不同的py文件中使用同一个fixture函数

原则上conftest.py需要和运行的用例放到同一层,但是其实可以访问上层的conftest.py

conftest.py的fixture函数使用时也是有先后顺序的

在这里插入图片描述

4、接口测试

支持HTTP连接保持和连接池

支持使用cookie保持会话

支持文件上传

支持自动确定响应内容的编码

支持国际化的 URL 和 POST 数据自动编码

4.1、request

1、get

requests.get(url, params=None, **kwargs)

url:接口地址

params:传参(通过url之后以?传参,多个参数之间用&分隔)

**kwargs:可变长度的字典

import pytest
import requestsclass TestDemo1:access_token = ""# 获取tokendef test_1(self):data = {"grant_type": "client_credential","appid": "wx4a3a215280b8f14a","secret": "2609941fb2b5d8aaea637a1d430cab222"}response = requests.get("https://api.weixin.qq.com/cgi-bin/token", data)print(response.json())TestDemo1.access_token = response.json()["access_token"]print(TestDemo1.access_token)

2、post

requests.post(url, data=None, json=None, **kwargs)

url:接口地址

data:表单

json:json数据

files:文件上传

import osimport pytest
import requestsclass TestDemo1:access_token = ""# 获取tokendef test_1(self):data = {"grant_type": "client_credential","appid": "wx4a3a215280b8f14a","secret": "2609941fbb5d8aaea637a1d430cab222"}response = requests.get("https://api.weixin.qq.com/cgi-bin/token", data)print(response.json())TestDemo1.access_token = response.json()["access_token"]print(TestDemo1.access_token)# 创建标签@pytest.mark.skipdef test_2(self):json = {"tag": {"name": "xumeng"}}response = requests.post("https://api.weixin.qq.com/cgi-bin/tags/create?access_token=" + TestDemo1.access_token,json=json)print(response.json())# 获取所有标签def test_3(self):json = {"tag": {"name": "xumeng"}}response = requests.post("https://api.weixin.qq.com/cgi-bin/tags/get?access_token=" + TestDemo1.access_token,json=json)print(response.json())# 上传文件def test_4(self):# print(os.getcwd())files = {"media": open("./Luoyang.jpg", "rb")  # 路径起点为项目根目录}response = requests.post("https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=" + TestDemo1.access_token,files=files)print(response.json())

3、put

requests.put(url, data=None, **kwargs)

url:接口地址

data:表单

4、delete

requests.delete(url, **kwargs)

url:接口地址

5、request

requests.request(method, url, **kwargs)

method:请求方式

url:请求路径

**kwargs:

  • params:get请求传参
  • data:post请求传参
  • headers:请求头
  • cookies:cookie
  • files:文件
  • auth:授权
  • timeout=None
  • allow_redirects=True
  • proxies:代理
  • hooks=None
  • stream=None
  • verify:SSL证书检验
  • cert=None
  • json:post请求传参

4.2、response

res.text:返回字符串的响应数据

res.content:返回字节响应数据bytes

res.json():返回字典格式的响应数据

res.status_code:返回状态码

res.reason:返回状态信息

res.cookies:返回cookie信息

res.encoding:返回编码格式

res.headers:返回响应头

res.request.url:返回请求路径

res.request.headers:返回请求头

res.request.body:返回请求数据

res.request.method:返回请求方式

4.3、cookie

4.4、session

5、allure

生成pytest测试报告

下载地址:https://github.com/allure-framework/allure2/releases

验证是否成功allure --version

5.1、临时报告

[pytest]
# 命令行参数,用空格进行分隔
addopts = -vs --alluredir=./report --clean-alluredir# 测试用例的路径 ./为pytest.ini当前目录下的同级文件夹
testpaths =./request-demo# 模块名的规则,配置测试搜索的模块文件名称
python_files = test_*.py
# 类名的规则,配置测试搜索的测试类名
python_classes = Test*
# 方法名的规则,配置测试搜索的测试函数名
python_functions = test

在这里插入图片描述

5.2、正式报告

import os
import timeimport pytestif __name__ == '__main__':pytest.main()time.sleep(3)os.system("allure generate ./temp -o ./report --clean")

在这里插入图片描述

6、数据驱动

6.1、基础使用

import pytestclass TestDemo1:@pytest.mark.parametrize("team", ["T1", "RNG", "LNG", "FPX", "UP", "FNC", "C9"])def test_1(self, team):print("我喜欢的英雄联盟队伍", team)

在这里插入图片描述

import pytestclass TestDemo1:@pytest.mark.parametrize("team", [{"teamName":"T1","teamMember":"Faker"}, {"teamName":"RNG","teamMember":"UZI"}])def test_1(self, team):print("我喜欢"+str(team["teamName"])+"队伍的"+str(team["teamMember"]))

在这里插入图片描述

import pytestclass TestDemo1:@pytest.mark.parametrize("teamMember1,teamMember2", [["faker", "宙斯"], ["UZI", "Ming"]])def test_1(self, teamMember1, teamMember2):print("我喜欢的选手:" + str(teamMember1) + "和" + str(teamMember2))

在这里插入图片描述

6.2、yaml

yaml详解:https://blog.csdn.net/gyfghh/article/details/119465409

1、yaml读取

yaml

-name: zhangsanage: 20money: 123.5hobbies: baskball,football,volleyballbooks:- book1- book2- book3lotteries: [lottery1,lottery2,lottery3]bankcards: {ICBC: 123456789,ABC: 987654321}pet:name: huahuaage: 2
-name: lisiage: 20money: 123.5hobbies: baskball,football,volleyballbooks:- book1- book2- book3lotteries: [lottery1,lottery2,lottery3]bankcards: {ICBC: 123456789,ABC: 987654321}pet:name: huahuaage: 2

安装依赖

pip install pyyaml

load_yaml.py

import yamldef load_yaml(path):with open(path, mode="r", encoding="utf-8") as file:return yaml.load(stream=file, Loader=yaml.FullLoader)

test_demo1.py

import load_yamlclass TestDemo1:def test_1(self):print(load_yaml.load_yaml("./request-demo/data.yaml"))

6.3、yaml配合parametrize

-name: zhangsanage: 20money: 123.5hobbies: baskball,football,volleyballbooks:- book1- book2- book3lotteries: [lottery1,lottery2,lottery3]bankcards: {ICBC: 123456789,ABC: 987654321}pet:name: huahuaage: 2
-name: lisiage: 20money: 123.5hobbies: baskball,football,volleyballbooks:- book1- book2- book3lotteries: [lottery1,lottery2,lottery3]bankcards: {ICBC: 123456789,ABC: 987654321}pet:name: huahuaage: 2
import pytest
import load_yamlclass TestDemo1:@pytest.mark.parametrize("person", load_yaml.load_yaml("./request-demo/data.yaml"))def test_2(self, person):print("我的名字", person["name"])

在这里插入图片描述

相关文章:

Pytest学习笔记

Pytest学习笔记 1、介绍 1.1、单元测试 单元测试是指在软件开发当中,针对软件的最小单位(函数,方法)进行正确性的检查测试 1.2、单元测试框架 测试发现:从多个py文件里面去找到我们测试用例测试执行:按…...

Fuzz概述

文章目录AFL一些概念插桩与覆盖率边和块覆盖率afl自实现劫持汇编器clang内置覆盖率反馈与引导变异遗传算法fork server机制AFL调试准备AFL一些概念 插桩与覆盖率 边和块 首先,要明白边和块的定义 正方形的就是块,箭头表示边,边表示程序执行…...

区块链知识系列 - 系统学习EVM(四)-zkEVM

区块链知识系列 - 系统学习EVM(一) 区块链知识系列 - 系统学习EVM(二) 区块链知识系列 - 系统学习EVM(三) 今天我们来聊聊 zkEVM、EVM 兼容性 和 Rollup 是什么? 1. 什么是 Rollup rollup顾名思义,就是把一堆交易卷(rollup)起来…...

Leetcode.2341 数组能形成多少数对

题目链接 Leetcode.2341 数组能形成多少数对 Rating : 1185 题目描述 给你一个下标从 0 开始的整数数组 nums。在一步操作中,你可以执行以下步骤: 从 nums选出 两个 相等的 整数从 nums中移除这两个整数,形成一个 数对 请你在 nums上多次执…...

C++复习笔记10

1. list是可以在常数范围内在任意位置进行插入和删除的序列式容器,并且该容器可以前后双向迭代。 2. list的底层是双向链表结构,双向链表中每个元素存储在互不相关的独立节点中,在节点中通过指针指向其前一个元素和后一个元素。 3. list与for…...

leaflet 纯CSS的marker标记,不用图片来表示(072)

第072个 点击查看专栏目录 本示例的目的是介绍演示如何在vue+leaflet中使用纯CSS来打造marker的标记。这里用到的是L.divIcon来引用CSS来构造新icon,然后在marker的属性中引用。 这里必须要注意的是css需要是全局性质的,不能被scoped转义为其他随机的css。 直接复制下面的 v…...

Elasticsearch:使用 intervals query - 根据匹配项的顺序和接近度返回文档

Intervals query 根据匹配项的顺序和接近度返回文档。Intervals 查询使用匹配规则,由一小组定义构成。 然后将这些规则应用于指定字段中的术语。 这些定义产生跨越文本正文中的术语的最小间隔序列。 这些间隔可以通过父源进一步组合和过滤。 上述描述有点费解。我…...

无法决定博客主题的人必看!如何选择类型和推荐的 5 种选择

是否有人不能迈出第一步,因为博客的类型还没有决定?有些人在出发时应该行动,而不是思考,但让我们冷静下来,仔细想想。博客的难度因流派而异,这在很大程度上决定了随后的发展。因此,在选择博客流…...

数字化转型的成功模版,珠宝龙头曼卡龙做对了什么?

2月11日,曼卡龙(300945.SZ)发布2022年业绩快报,报告期内,公司实现营业收入16.11亿元,同比增长28.63%。来源:曼卡龙2022年度业绩快报曼卡龙能在2022年实现营收增长尤为不易。2022年受疫情影响&am…...

转换矩阵、平移矩阵、旋转矩阵关系以及python实现旋转矩阵、四元数、欧拉角之间转换

文章目录1. 转换矩阵、平移矩阵、旋转矩阵之间的关系2. 缩放变换、平移变换和旋转变换2. python实现旋转矩阵、四元数、欧拉角互相转化由于在平时总是或多或少的遇到平移旋转的问题,每次都是现查资料,然后查了忘,忘了继续查,这次弄…...

中国地图航线图(echarjs)

1、以上为效果图 需要jq、echarjs、china.json三个文件支持。以上 2、具体代码 DOM部分 <!-- 服务范围 GO--> <div class"m-maps"><div id"main" style"width:1400px;height: 800px; margin: 0 auto;"> </div> <!-…...

Python正则表达式中group与groups的用法详解

本文主要介绍了Python正则表达式中group与groups的用法详解&#xff0c;文中通过示例代码介绍的非常详细&#xff0c;对大家的学习或者工作具有一定的参考学习价值&#xff0c;需要的朋友们下面随着小编来一起学习学习吧目录在Python中&#xff0c;正则表达式的group和groups方…...

c++练习题7

1&#xff0e;下列运算符中优先级最高的是 A&#xff09;> B&#xff09; C&#xff09; && D&#xff09;! 2&#xff0e;以下关于运算符优先级的描述中&#xff0c;正确的是 。 A&#xff09;!&#xff08;逻辑非&#x…...

MySQL学习

目录1、数据库定义基本语句&#xff08;1&#xff09;数据库操作&#xff08;2&#xff09;数据表操作2.数据库操作SQL语句&#xff08;1&#xff09;插入数据&#xff08;2&#xff09;更新语句&#xff08;3&#xff09;删除数据3.数据库查询语句&#xff08;1&#xff09;基…...

C语言(强制类型转换)

一.类型转换原则 1.升级&#xff1a;当类型转换出现在表达式时&#xff0c;无论时unsigned还是signed的char和short都会被自动转换成int&#xff0c;如有必要会被转换成unsigned int(如果short与int的大小相同&#xff0c;unsigned short就比int大。这种情况下&#xff0c;uns…...

搭建hadoop高可用集群(二)

搭建hadoop高可用集群&#xff08;一&#xff09;配置hadoophadoop-env.shworkerscore-site.xmlhdfs-site.xmlmapred-site.xmlyarn-site.xml/etc/profile拷贝集群首次启动1、先启动zk集群&#xff08;自动化脚本&#xff09;2、在hadoop151,hadoop152,hadoop153启动JournalNode…...

CentOS升级内核-- CentOS9 Stream/CentOS8 Stream/CentOS7

官方文档在此 升级原因 当我们安装一些软件(对,我说的就是Kubernetes),可能需要新内核的支持,而CentOS又比较保守,不太升级,所以需要我们手工升级. # 看下目前是什么版本内核 uname -a# 安装公钥 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org# 添加仓库,如果…...

【基础篇】一文掌握css的盒子模型(margin、padding)

1、CSS 盒子模型(Box Model) 所有HTML元素可以看作盒子,在CSS中,"box model"这一术语是用来设计和布局时使用。CSS盒模型本质上是一个盒子,封装周围的HTML元素,它包括:边距,边框,填充,和实际内容。盒模型允许我们在其它元素和周围元素边框之间的空间放置元素…...

重生之我是赏金猎人-漏洞挖掘(十一)-某SRC储存XSS多次BypassWAF挖掘

0x01&#xff1a;利用编辑器的超链接组件导致存储XSS 鄙人太菜了&#xff0c;没啥高质量的洞呀&#xff0c;随便水一篇文章吧。 在月黑风高的夜晚&#xff0c;某骇客喊我起床挖洞&#xff0c;偷瞄了一下发现平台正好出活动了&#xff0c;想着小牛试刀吧 首先信息收集了一下&a…...

Wails简介

https://wails.io/zh-Hans/docs/introduction 简介 Wails 是一个可让您使用 Go 和 Web 技术编写桌面应用的项目。 将它看作为 Go 的快并且轻量的 Electron 替代品。 您可以使用 Go 的灵活性和强大功能&#xff0c;结合丰富的现代前端&#xff0c;轻松的构建应用程序。 功能…...

接口测试中缓存处理策略

在接口测试中&#xff0c;缓存处理策略是一个关键环节&#xff0c;直接影响测试结果的准确性和可靠性。合理的缓存处理策略能够确保测试环境的一致性&#xff0c;避免因缓存数据导致的测试偏差。以下是接口测试中常见的缓存处理策略及其详细说明&#xff1a; 一、缓存处理的核…...

微信小程序之bind和catch

这两个呢&#xff0c;都是绑定事件用的&#xff0c;具体使用有些小区别。 官方文档&#xff1a; 事件冒泡处理不同 bind&#xff1a;绑定的事件会向上冒泡&#xff0c;即触发当前组件的事件后&#xff0c;还会继续触发父组件的相同事件。例如&#xff0c;有一个子视图绑定了b…...

DockerHub与私有镜像仓库在容器化中的应用与管理

哈喽&#xff0c;大家好&#xff0c;我是左手python&#xff01; Docker Hub的应用与管理 Docker Hub的基本概念与使用方法 Docker Hub是Docker官方提供的一个公共镜像仓库&#xff0c;用户可以在其中找到各种操作系统、软件和应用的镜像。开发者可以通过Docker Hub轻松获取所…...

【机器视觉】单目测距——运动结构恢复

ps&#xff1a;图是随便找的&#xff0c;为了凑个封面 前言 在前面对光流法进行进一步改进&#xff0c;希望将2D光流推广至3D场景流时&#xff0c;发现2D转3D过程中存在尺度歧义问题&#xff0c;需要补全摄像头拍摄图像中缺失的深度信息&#xff0c;否则解空间不收敛&#xf…...

Matlab | matlab常用命令总结

常用命令 一、 基础操作与环境二、 矩阵与数组操作(核心)三、 绘图与可视化四、 编程与控制流五、 符号计算 (Symbolic Math Toolbox)六、 文件与数据 I/O七、 常用函数类别重要提示这是一份 MATLAB 常用命令和功能的总结,涵盖了基础操作、矩阵运算、绘图、编程和文件处理等…...

多种风格导航菜单 HTML 实现(附源码)

下面我将为您展示 6 种不同风格的导航菜单实现&#xff0c;每种都包含完整 HTML、CSS 和 JavaScript 代码。 1. 简约水平导航栏 <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport&qu…...

基于SpringBoot在线拍卖系统的设计和实现

摘 要 随着社会的发展&#xff0c;社会的各行各业都在利用信息化时代的优势。计算机的优势和普及使得各种信息系统的开发成为必需。 在线拍卖系统&#xff0c;主要的模块包括管理员&#xff1b;首页、个人中心、用户管理、商品类型管理、拍卖商品管理、历史竞拍管理、竞拍订单…...

【JVM面试篇】高频八股汇总——类加载和类加载器

目录 1. 讲一下类加载过程&#xff1f; 2. Java创建对象的过程&#xff1f; 3. 对象的生命周期&#xff1f; 4. 类加载器有哪些&#xff1f; 5. 双亲委派模型的作用&#xff08;好处&#xff09;&#xff1f; 6. 讲一下类的加载和双亲委派原则&#xff1f; 7. 双亲委派模…...

接口自动化测试:HttpRunner基础

相关文档 HttpRunner V3.x中文文档 HttpRunner 用户指南 使用HttpRunner 3.x实现接口自动化测试 HttpRunner介绍 HttpRunner 是一个开源的 API 测试工具&#xff0c;支持 HTTP(S)/HTTP2/WebSocket/RPC 等网络协议&#xff0c;涵盖接口测试、性能测试、数字体验监测等测试类型…...

python爬虫——气象数据爬取

一、导入库与全局配置 python 运行 import json import datetime import time import requests from sqlalchemy import create_engine import csv import pandas as pd作用&#xff1a; 引入数据解析、网络请求、时间处理、数据库操作等所需库。requests&#xff1a;发送 …...