python+requests+pytest+allure自动化测试框架

news/2024/7/27 11:31:18/文章来源:https://blog.csdn.net/zhangsiyuan1998/article/details/136585785

🍅 视频学习:文末有免费的配套视频可观看

🍅 关注公众号【互联网杂货铺】,回复 1 ,免费获取软件测试全套资料,资料在手,涨薪更快

1、核心库

  1. requests request请求

  2. openpyxl excel文件操作

  3. loggin 日志

  4. smtplib 发送邮件

  5. configparser

  6. unittest.mock mock服务

2、目录结构

  • base

  • utils

  • testDatas

  • conf

  • testCases

  • testReport

  • logs

  • 其他

图片

2.1base

  • base_path.py 存放绝对路径,dos命令或Jenkins执行时,防止报错

  • base_requests.py 封装requests,根据method选择不同的方法执行脚本,同时处理请求异常

2.1.1 base_path.py
import os# 项目根路径
_root_path = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]# 报告路径
report_path = os.path.join(_root_path, 'testReport', 'report.html')# 日志路径
log_path = os.path.join(_root_path, 'logs/')# 配置文件路径
conf_path = os.path.join(_root_path, 'conf', 'auto_test.conf')# 测试数据路径
testdatas_path = os.path.join(_root_path, 'testDatas')# allure 相关配置
_result_path = os.path.join(_root_path, 'testReport', 'result')
_allure_html_path = os.path.join(_root_path, 'testReport', 'allure_html')
allure_command = 'allure generate {} -o {} --clean'.format(_result_path, _allure_html_path)
2.1.2 base_requests.py
import json
import allure
import urllib3
import requests
import warnings
from bs4 import BeautifulSoup
from base.base_path import *
from requests.adapters import HTTPAdapter
from utils.handle_logger import logger
from utils.handle_config import handle_config as hcclass BaseRequests:def __init__(self, case, proxies=None, headers=None, cookies=None, timeout=15, max_retries=3):''':param case: 测试用例:param proxies: The result is displayed in fiddler:{"http": "http://127.0.0.1:8888", "https": "https://127.0.0.1:8888"}:param headers: 请求头:param cookies: cookies:param timeout: 请求默认超时时间15s:param max_retries: 请求超时后默认重试3次'''self.case = caseself.proxies = proxiesself.headers = headersself.cookies = cookiesself.timeout = timeoutself.max_retries = max_retriesself.base_url = hc.operation_config(conf_path, 'BASEURL', 'base_url')def get_response(self):'''获取请求结果'''response = self._run_main()return responsedef _run_main(self):'''发送请求'''method = self.case['method']url = self.base_url + self.case['url']if self.case['parameter']:data = eval(self.case['parameter'])else:data = Nones = requests.session()s.mount('http://', HTTPAdapter(max_retries=self.max_retries))s.mount('https://', HTTPAdapter(max_retries=self.max_retries))urllib3.disable_warnings()  # 忽略浏览器认证(https认证)警告warnings.simplefilter('ignore', ResourceWarning)    # 忽略 ResourceWarning警告res=''if method.upper() == 'POST':try:res = s.request(method='post', url=url, data=data, verify=False, proxies=self.proxies, headers=self.headers, cookies=self.cookies, timeout=self.timeout)except Exception as e:logger.error('POST请求出错,错误信息为:{0}'.format(e))elif method.upper() == 'GET':try:res = s.request(method='get', url=url, params=data, verify=False,proxies=self.proxies, headers=self.headers, cookies=self.cookies, timeout=self.timeout)except Exception as e:logger.error('GET请求出错,错误信息为:{0}'.format(e))else:raise ValueError('method方法为get和post')logger.info(f'请求方法:{method},请求路径:{url}, 请求参数:{data}, 请求头:{self.headers}, cookies:{self.cookies}')# with allure.step('接口请求信息:'):#     allure.attach(f'请求方法:{method},请求路径:{url}, 请求参数:{data}, 请求头:{headers}')# 拓展:是否需要做全量契约验证?响应结果是不同类型时,如何处理响应?return resif __name__ == '__main__':# case = {'method': 'get', 'url': '/article/top/json', 'parameter': ''}case = {'method': 'post', 'url': '/user/login', 'parameter': '{"username": "xbc", "password": "123456"}'}response = BaseRequests(case).get_response()print(response.json())

2.2 utils

(只取核心部分)

  • handle_excel.py
    - excel的操作,框架要求,最终读取的数据需要保存列表嵌套字典的格式[{},{}]
    - 其他操作

  • handle_sendEmail.py
    - python发送邮件使用smtp协议,接收邮件使用pop3
    - 需要开启pop3服务功能,这里的password为授权码,启用服务自行百度

  • handle_logger.py 日志处理

  • handle_config.py
    配置文件处理,这里只将域名可配置化,切换环境时改域名即可

  • handle_allure.py
    allure生成的报告需要调用命令行再打开,这里直接封装命令

  • handle_cookies.py(略)
    在git中补充,处理cookiesJar对象

  • handle_mock.py(略)
    在git中补充,框架未使用到,但是也封装成了方法

  • param_replace(略)
    将常用的参数化操作封装成类

2.2.1 handle_excel.py

import openpyxl
from base.base_path import *class HandleExcel:def __init__(self, file_name=None, sheet_name=None):'''没有传路径时,默认使用 wanadriod接口测试用例.xlsx 文件:param file_name:  用例文件:param sheet_name: 表单名'''if file_name:self.file_path = os.path.join(testdatas_path, file_name)self.sheet_name = sheet_nameelse:self.file_path = os.path.join(testdatas_path, 'wanadriod接口测试用例.xlsx')self.sheet_name = 'case'# 创建工作簿,定位表单self.wb = openpyxl.load_workbook(self.file_path)self.sheet = self.wb[self.sheet_name]# 列总数,行总数self.ncols = self.sheet.max_columnself.nrows = self.sheet.max_rowdef cell_value(self, row=1, column=1):'''获取表中数据,默认取出第一行第一列的值'''return self.sheet.cell(row, column).valuedef _get_title(self):'''私有函数, 返回表头列表'''title = []for column in range(1, self.ncols+1):title.append(self.cell_value(1, column))return titledef get_excel_data(self):''':return: 返回字典套列表的方式 [{title_url:value1, title_method:value1}, {title_url:value2, title_method:value2}...]'''finally_data = []for row in range(2, self.nrows+1):result_dict = {}for column in range(1, self.ncols+1):result_dict[self._get_title()[column-1]] = self.cell_value(row, column)finally_data.append(result_dict)return finally_datadef get_pytestParametrizeData(self):'''选用这种参数方式,需要使用数据格式 列表套列表 @pytest.mark.parametrize('', [[], []]), 如 @pytest.mark.parametrize(*get_pytestParametrizeData)将 finally_data 中的 title 取出,以字符串形式保存,每个title用逗号(,)隔开将 finally_data 中的 value 取出,每行数据保存在一个列表,再集合在一个大列表内:return: title, data'''finally_data = self.get_excel_data()data = []title = ''for i in finally_data:value_list = []key_list = []for key, value in i.items():value_list.append(value)key_list.append(key)title = ','.join(key_list)data.append(value_list)return title, datadef rewrite_value(self, new_value, case_id, title):'''写入excel,存储使用过的数据(参数化后的数据)'''row = self.get_row(case_id)column = self.get_column(title)self.sheet.cell(row, column).value = new_valueself.wb.save(self.file_path)def get_row(self, case_id):'''通过执行的 case_id 获取当前的行号'''for row in range(1, self.nrows+1):if self.cell_value(row, 1) == case_id:return int(row)def get_column(self, title):'''通过表头给定字段,获取表头所在列'''for column in range(1, self.ncols+1):if self.cell_value(1, column) == title:return int(column)if __name__ == '__main__':r = HandleExcel()print(r.get_excel_data())
2.2.2 handle_sendEmail.py
import smtplib
from utils.handle_logger import logger
from email.mime.text import MIMEText    # 专门发送正文邮件
from email.mime.multipart import MIMEMultipart  # 发送正文、附件等
from email.mime.application import MIMEApplication  # 发送附件class HandleSendEmail:def __init__(self, part_text, attachment_list, password, user_list, subject='interface_autoTestReport', smtp_server='smtp.163.com', from_user='hu_chunpu@163.com', filename='unit_test_report.html'):''':param part_text: 正文:param attachment_list: 附件列表:param password: 邮箱服务器第三方密码:param user_list: 收件人列表:param subject: 主题:param smtp_server: 邮箱服务器:param from_user: 发件人:param filename: 附件名称'''self.subject = subjectself.attachment_list = attachment_listself.password = passwordself.user_list = ';'.join(user_list)    # 多个收件人self.part_text = part_textself.smtp_server = smtp_serverself.from_user = from_userself.filename = filenamedef _part(self):'''构建邮件内容'''# 1) 构造邮件集合体:msg = MIMEMultipart()msg['Subject'] = self.subjectmsg['From'] = self.from_usermsg['To'] = self.user_list# 2) 构造邮件正文:text = MIMEText(self.part_text)msg.attach(text)  # 把正文加到邮件体里面# 3) 构造邮件附件:for item in self.attachment_list:with open(item, 'rb+') as file:attachment = MIMEApplication(file.read())# 给附件命名:attachment.add_header('Content-Disposition', 'attachment', filename=item)msg.attach(attachment)# 4) 得到完整的邮件内容:full_text = msg.as_string()return full_textdef send_email(self):'''发送邮件'''# qq邮箱必须加上SSLif self.smtp_server == 'smtp.qq.com':smtp = smtplib.SMTP_SSL(self.smtp_server)else:smtp = smtplib.SMTP(self.smtp_server)# 登录服务器:.login(user=email_address,password=第三方授权码)smtp.login(self.from_user, self.password)logger.info('--------邮件发送中--------')try:logger.info('--------邮件发送成功--------')smtp.sendmail(self.from_user, self.user_list, self._part())except Exception as e:logger.error('发送邮件出错,错误信息为:{0}'.format(e))else:smtp.close()    # 关闭连接if __name__ == '__main__':from base.base_path import *part_text = '附件为自动化测试报告,框架使用了pytest+allure'attachment_list = [report_path]password = ''user_list = ['']HandleSendEmail(part_text, attachment_list, password, user_list).send_email()
2.2.3 handle_logger.py
import sys
import logging
from time import strftime
from base.base_path import *class Logger:def __init__(self):# 日志格式custom_format = '%(asctime)s %(filename)s [line:%(lineno)d] %(levelname)s: %(message)s'# 日期格式date_format = '%a, %d %b %Y %H:%M:%S'self._logger = logging.getLogger()  # 实例化self.filename = '{0}{1}.log'.format(log_path, strftime("%Y-%m-%d")) # 日志文件名self.formatter = logging.Formatter(fmt=custom_format, datefmt=date_format)self._logger.addHandler(self._get_file_handler(self.filename))self._logger.addHandler(self._get_console_handler())self._logger.setLevel(logging.INFO)  # 默认等级def _get_file_handler(self, filename):'''输出到日志文件'''filehandler = logging.FileHandler(filename, encoding="utf-8")filehandler.setFormatter(self.formatter)return filehandlerdef _get_console_handler(self):'''输出到控制台'''console_handler = logging.StreamHandler(sys.stdout)console_handler.setFormatter(self.formatter)return console_handler@propertydef logger(self):return self._logger'''
日志级别:
critical    严重错误,会导致程序退出
error        可控范围内的错误
warning        警告信息
info        提示信息
debug        调试程序时详细输出的记录
'''
# 实例
logger = Logger().loggerif __name__ == '__main__':import datetimelogger.info(u"{}:开始XXX操作".format(datetime.datetime.now()))
2.2.4 handle_config.py
import configparser# 配置文件类
class HandleConfig:def operation_config(self, conf_file, section, option):cf = configparser.ConfigParser()    # 实例化cf.read(conf_file)value = cf.get(section, option)    # 定位return valuehandle_config = HandleConfig()
if __name__ == '__main__':from base.base_path import *base_url = handle_config.operation_config(conf_path, 'BASEURL', 'base_url')print(base_url)
2.2.5 handle_allure.py
import subprocess
from base.base_path import *class HandleAllure(object):def execute_command(self):subprocess.call(allure_command, shell=True)handle_allure = HandleAllure()

2.3testDatas

excel测试用例文件,必须是.xlsx结尾,用例结构如下:

图片

2.4conf

放置配置文件 .conf结尾

2.5 testCases

  • conftest.py
    - fixture功能,用例前置后置操作
    - 构造测试数据
    - 其他高级操作
    - 注意邮件中的password和user_list需要换成自己测试的邮箱及服务密码

  • test_wanAndroid.py 测试用例脚本
    - 参数化: pytest.mark.parametrize('case',[{},{}])
    - 接口关联:
        - 将关联的参数配置成全局变量
       - 在用例执行前使用全局变量替换参数
       - 使用 is_run 参数指明有参数化的用例,并取出,再赋值给全局变量
    - cookies:
       - 和接口关联的处理方式一样处理cookies
    - 步骤
       - 收集用例
       - 执行用例
       - 断言
       - 构造测试报告
       - 发送邮件

2.5.1 conftest.py
import pytest
from base.base_path import *
from utils.handle_logger import logger
from utils.handle_allure import handle_allure
from utils.handle_sendEmail import HandleSendEmail'''
1. 构造测试数据??
2. fixture 替代 setup,teardown
3. 配置 pytest
'''def pytest_collection_modifyitems(items):"""测试用例收集完成时,将收集到的item的name和nodeid的中文显示在控制台上"""for item in items:item.name = item.name.encode("utf-8").decode("unicode_escape")item._nodeid = item.nodeid.encode("utf-8").decode("unicode_escape")# print(item.nodeid)@pytest.fixture(scope='session', autouse=True)
def send_email():logger.info('-----session级,执行wanAndroid测试用例-----')yieldlogger.info('-----session级,wanAndroid用例执行结束,发送邮件:-----')"""执行alllure命令 """handle_allure.execute_command()# 发邮件part_text = '附件为自动化测试报告,框架使用了pytest+allure'attachment_list = [report_path]password = ''user_list = ['']HandleSendEmail(part_text, attachment_list, password, user_list).send_email()
2.5.2 test_wanAndroid.py
import json
import pytest
import allure
from base.base_requests import BaseRequests
from utils.handle_logger import logger
from utils.handle_excel import HandleExcel
from utils.param_replace import pr
from utils.handle_cookies import get_cookieshandle_excel = HandleExcel()
get_excel_data = HandleExcel().get_excel_data()
ID = ''
COOKIES = {}
PAGE = ''class TestWanAndroid:@pytest.mark.parametrize('case', get_excel_data)def test_wanAndroid(self, case):global IDglobal COOKIES# 参数替换case['url'] = pr.relevant_parameter(case['url'], '${collect_id}', str(ID))if case['is_run'].lower() == 'yes':logger.info('------执行用例的id为:{0},用例标题为:{1}------'.format(case['case_id'], case['title']))res = BaseRequests(case, cookies=COOKIES).get_response()res_json = res.json()# 获取登录后的cookiesif case['case_id'] == 3:COOKIES = get_cookies.get_cookies(res)if case['is_depend']:try:ID = res_json['data']['id']# 将使用的参数化后的数据写入excelhandle_excel.rewrite_value('id={}'.format(ID), case['case_id'], 'depend_param')except Exception as e:logger.error(f'获取id失败,错误信息为{e}')ID = 0# 制作 allure 报告allure.dynamic.title(case['title'])allure.dynamic.description('<font color="red">请求URL:</font>{}<br />''<font color="red">期望值:</font>{}'.format(case['url'], case['excepted']))allure.dynamic.feature(case['module'])allure.dynamic.story(case['method'])result=''try:assert eval(case['excepted'])['errorCode'] == res_json['errorCode']result = 'pass'except AssertionError as e:logger.error('Assert Error:{0}'.format(e))result = 'fail'raise efinally:# 将实际结果格式化写入excelhandle_excel.rewrite_value(json.dumps(res_json, ensure_ascii=False, indent=2, sort_keys=True), case['case_id'], 'actual')# 将用例执行结果写入excelhandle_excel.rewrite_value(result, case['case_id'], 'test_result')def test_get_articleList(self):'''翻页,将page参数化'''global PAGEpassdef test_mock_demo(self):'''使用mock服务模拟服务器响应'''passif __name__ == '__main__':pytest.main(['-q', 'test_wanAndroid.py'])

2.6 testReport

  • 存放html测试报告,安装插件pip install pytest-html

  • 存放allure测试报告,插件安装pip install allure-pytest

2.7 logs

存放日志文件

2.8 其他文件

  • run.py 主运行文件

  • pytest.ini 配置pytest的默认行为,运行规则等

  • requirements.txt 依赖环境
    - 自动生成 pip freeze
    - 安装 pip -r install requirements.

3、总结

  1. allure有很多有趣的操作,甚至控制用例执行行为,有兴趣可以拓展

  2. 实现框架的难点在接口依赖

  3. 接口自动化应避免复杂的接口依赖,复杂的依赖只会造成测试的不可控性

  4. 注意频繁的操作excel会消耗性能

  5. 有兴趣可以将本框架集合在Jenkins中

同时,在这我也准备了一份软件测试视频教程(含接口、自动化、性能等),需要的可以直接在下方观看就行,希望对你有所帮助!

7天Python自动化测试速成课,小白也能快速上手(项目实战)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_999590.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何使用 ArcGIS Pro 制作三维地形图

伴随硬件性能的提高和软件算法的优化&#xff0c;三维地图的应用场景会越来越多&#xff0c;这里为大家介绍一下在ArcGIS Pro怎么制作三维地形图&#xff0c;希望能对你有所帮助。 数据来源 教程所使用的数据是从水经微图中下载的DEM和影像数据&#xff0c;除了DEM和影像数据…

【鸿蒙 HarmonyOS 4.0】常用组件:List/Grid/Tabs

一、背景 列表页面&#xff1a;List组件和Grid组件&#xff1b; 页签切换&#xff1a;Tabs组件&#xff1b; 二、列表页面 在我们常用的手机应用中&#xff0c;经常会见到一些数据列表&#xff0c;如设置页面、通讯录、商品列表等。下图中两个页面都包含列表&#xff0c;“…

分库与分表--一起学习吧之架构

分库与分表是数据库架构中用于解决单一数据库或表性能瓶颈问题的两种重要手段。随着数据量的不断膨胀&#xff0c;传统的单一数据库或表可能无法满足应用的需求&#xff0c;这时就需要考虑采用分库或分表的方式来提升性能。 一、定义 分库&#xff1a;是将原本数据量大的数据…

基于H5的旅游攻略平台设计与实现

目 录 摘 要 I Abstract II 引 言 1 1 系统开发相关技术 3 1.1框架技术 3 1.1.1 SSM框架 3 1.1.2 SpringBoot框架 3 1.1.3 Spring框架 3 1.2开发语言 3 1.2.1 HTML 3 1.2.2 JAVA 4 1.2.3 JavaScript 4 1.3数据库 4 1.4本章小结 4 2 系统分析 5 2.1 可行性分析 5 2.2 功能需求分…

开展“3·15”金融消费者权益保护教育宣传活动怎样联系媒体投稿?

在组织“315”金融消费者权益保护教育宣传活动时,传统的方式通常是银行、金融机构或其他主办单位主动联系各类媒体,包括但不限于电视台、广播电台、报纸、杂志、新闻网站、金融专业媒体、社交媒体平台等,通过邮件、电话、传真等方式提供活动新闻稿、宣传材料、现场照片等素材,请…

JavaScript实现记住用户名功能

问题描述&#xff1a;通过JavaScript实现点击复选框将用户名存储到本地中&#xff0c;再次打开页面&#xff0c;输入框中自动输入上次保存的数据。 <body><label for"">用户名</label> <input type"text1" name"" id"…

【深度学习笔记】6_6 通过时间反向传播(back-propagation through time)

注&#xff1a;本文为《动手学深度学习》开源内容&#xff0c;部分标注了个人理解&#xff0c;仅为个人学习记录&#xff0c;无抄袭搬运意图 6.6 通过时间反向传播 在前面两节中&#xff0c;如果不裁剪梯度&#xff0c;模型将无法正常训练。为了深刻理解这一现象&#xff0c;本…

第19章-IPv6基础

1. IPv4的缺陷 2. IPv6的优势 3. 地址格式 3.1 格式 3.2 长度 4. 地址书写压缩 4.1 段内前导0压缩 4.2 全0段压缩 4.3 例子1 4.4 例子 5. 网段划分 5.1 前缀 5.2 接口标识符 5.3 前缀长度 5.4 地址规模分类 6. 地址分类 6.1 单播地址 6.2 组播地址 6.3 任播地址 6.4 例子 …

离线数仓(五) [ 从数据仓库概述到建模 ]

前言 今天开始正式数据仓库的内容了, 前面我们把生产数据 , 数据上传到 HDFS , Kafka 的通道都已经搭建完毕了, 数据也就正式进入数据仓库了, 解下来的数仓建模是重中之重 , 是将来吃饭的家伙 ! 以及 Hive SQL 必须熟练到像喝水一样 ! 第1章 数据仓库概述 1.1 数据仓库概念 数…

MySQL实战:SQL优化及问题排查

有更合适的索引不走&#xff0c;怎么办&#xff1f; MySQL在选取索引时&#xff0c;会参考索引的基数&#xff0c;基数是MySQL估算的&#xff0c;反映这个字段有多少种取值&#xff0c;估算的策略为选取几个页算出取值的平均值&#xff0c;再乘以页数&#xff0c;即为基数 查…

【Qt】四种绘图设备详细使用

绘图设备有4个: **绘图设备是指继承QPainterDevice的子类————**QPixmap QImage QPicture QBitmap(黑白图片) QBitmap——父类QPixmapQPixmap图片类&#xff0c;主要用来显示&#xff0c;它针对于显示器显示做了特殊优化&#xff0c;依赖于平台的&#xff0c;只能在主线程…

鸿蒙实战多媒体运用:【音频组件】

音频组件用于实现音频相关的功能&#xff0c;包括音频播放&#xff0c;录制&#xff0c;音量管理和设备管理。 图 1 音频组件架构图 基本概念 采样 采样是指将连续时域上的模拟信号按照一定的时间间隔采样&#xff0c;获取到离散时域上离散信号的过程。 采样率 采样率为每…

【视频转码】基于ZLMediakit的视频转码技术概述

一、概述 zlmediakit pro版本支持基于ffmpeg的转码能力&#xff0c;在开源版本强大功能的基础上&#xff0c;新增支持如下能力&#xff1a; 1、音视频间任意转码(包括h265/h264/opus/g711/aac等)。2、基于配置文件的转码&#xff0c;支持设置比特率&#xff0c;codec类型等参…

c#触发事件

Demo1 触发事件 <Window x:Class"WPFExample.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"Title"WPF Example" Height"600" Wi…

【性能测试】Jmeter性能压测-阶梯式/波浪式场景总结(详细)

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 1、阶梯式场景&am…

Flink hello world

下载并且解压Flink Downloads | Apache Flink 启动Flink. $ ./bin/start-cluster.sh Starting cluster. Starting standalonesession daemon on host harrydeMacBook-Pro.local. Starting taskexecutor daemon on host harrydeMacBook-Pro.local. 访问localhost:8081 Flin…

分布式数字身份:通往Web3.0世界的个人钥匙

数字化时代&#xff0c;个人身份已不再仅仅局限于传统形式&#xff0c;分布式数字身份&#xff08;Decentralized Identity&#xff0c;简称DID&#xff09;正崭露头角&#xff0c;它允许个人通过数字签名等加密技术&#xff0c;完全掌握和控制自己的身份信息。研究报告显示&am…

VScode+Live Service+Five Service实现php实时调试

VScodeLive ServiceFive Service实现php实时调试 一、VScode插件安装及配置 1.Code Runner settings.json设置&#xff08;打开方式&#xff1a;ctrlp&#xff0c;搜索settings.json&#xff09; 设置php为绝对路径&#xff08;注意路径分隔符为\\或/&#xff09; 2. Live S…

计算机网络——计算机网络的性能

计算机网络——计算机网络的性能 速率带宽吞吐量时延时延宽带积往返时间RTT利用率信道利用率网络利用率 我们今天来看看计算机网络的性能。 速率 速率这个很简单&#xff0c;就是数据的传送速率&#xff0c;也称为数据率&#xff0c;或者比特率&#xff0c;单位为bit/s&#…

DataWhale公开课笔记2:Diffusion Model和Transformer Diffusion

Stable Diffusion和AIGC AIGC是什么 AIGC的全称叫做AI generated content&#xff0c;AlGC (Al-Generated Content&#xff0c;人工智能生产内容)&#xff0c;是利用AI自动生产内容的生产方式。 在传统的内容创作领域中&#xff0c;专业生成内容&#xff08;PGC&#xff09;…