测试报告框架 —— Allure2测试报告

news2024/10/5 16:27:55

目录

Allure2测试报告

1、使用 Allure2 运行方式-Python

2、使用 Allure2 运行方式-Java

3、生成测试报告

4、Allure2 报告中添加用例标题

5、allure2报告中添加用例步骤

6、allure2报告中添加用例链接

7、allure2报告中添加用例分类

8、Allure2 报告中添加用例描述

9、Allure2报告中添加用例优先级

10、allure2报告中添加用例支持tags标签

11、allure2报告中支持记录失败重试功能

12、Allure2 报告中添加附件-图片

13、Allure2报告中添加附件-日志

14、allure2报告中添加附件-html

15、Allure2 报告中添加附件-视频

16、Allure2 报告定制

自动化测试学习资源分享

Allure2测试报告

1、使用 Allure2 运行方式-Python

1)--alluredir 参数生成测试报告。

#在测试执行期间收集结果
pytest [测试用例/模块/包] --alluredir=./result/  (—alluredir这个选项 用于指定存储测试结果的路径)

#生成在线的测试报告
allure serve ./result

2、使用 Allure2 运行方式-Java

1)使用 allure:report 参数生成测试报告

# 在测试执行期间收集结果
# mvn命令行使用 maven插件安装
mvn clean test allure:report

# 生成在线的测试报告
# mvn 直接找target/allure-results目录
mvn allure:serve 

2)运行mvn命令对应没有在target下面生成allure-results目录,解决方法

①在src/test/resources路径下配置allure配置文件allure.properties,指名allure报告生成路径。

allure.results.directory=target/allure-resultsa

3)运行mvn命令一直卡在下载中,解决方法·

①在项目下创建.allure文件夹。
②下载allure解压到.allure文件夹下。

3、生成测试报告

1)生成测试报告需要使用命令行工具 allure

2)命令格式:allure [option] [command] [command options]

# 步骤一:在测试执行期间收集结果
# —alluredir这个选项 用于指定存储测试结果的路径
pytest  [测试文件] -s –q --alluredir=./result/
# 如果要清除已经生成的报告的历史记录,可以添加参数--clean-alluredir
pytest  [测试文件] -s –q --alluredir=./result/ --clean-alluredir
# 步骤二:查看测试报告,注意这里的serve书写
allure serve ./result/

3)Allure 报告生成的两种方式

①方式一:在线报告,会直接打开默认浏览器展示当前报告。

# 方式一:测试完成后查看实际报告,在线查看报告,会直接打开默认浏览器展示当前报告。
allure serve ./result/

②方式二:静态资源文件报告(带 index.html、css、js 等文件),需要将报告布署到 web 服务器上。

a.应用场景:如果希望随时打开报告,可以生成一个静态资源文件报告,将这个报告布署到 web 服务器上,启动 web 服务,即可随时随地打开报告。
b.解决方案:使用allure generate 生成带有 index.html 的结果报告。这种方式需要两个步骤:第一步:生成报告。第二步:打开报告。

# 生成报告
allure generate ./result
# 打开报告
allure open ./report/

4)常用参数

①allure generate 可以指定输出路径,也可以清理上次的报告记录。
②-o / –output 输出报告的路径。
③-c / –clean 如果报告路径重复。
④allure open 打开报告。
⑤-h / –host 主机 IP 地址,此主机将用于启动报表的 web 服务器。
⑥-p / –port 主机端口,此端口将用于启动报表的 web 服务器,默认值:0。

# 生成报告,指定输出路径,清理报告。
allure generate ./result -o ./report --clean

# 打开报告,指定IP地址和端口。
allure open -h 127.0.0.1 -p 8883 ./report/

4、Allure2 报告中添加用例标题

(1)通过使用装饰器 @allure.title 可以为测试用例自定义一个可阅读性的标题。allure.title 的三种使用方式:

1)方式一:直接使用装饰器 @allure.title 为测试用例自定义标题。

    import allure
    import pytest

    @allure.title("自定义测试用例标题")
    def test_with_title():
        assert True

2)方式二:@allure.title 支持通过占位符的方式传递参数,可以实现测试用例标题参数化,动态生成测试用例标题。

import allure
import pytest

@allure.title("参数化用例标题:参数一:{param1} ,参数二: {param2}")
@pytest.mark.parametrize("param1, param2, expected", [
    (1, 1, 2),
    (0.1, 0.3, 0.4)
])
def test_with_parametrize_title(param1, param2, expected):
    assert param1 + param2 == expected

3)方式三:allure.dynamic.title 动态更新测试用例标题。

@allure.title("原始标题")
def test_with_dynamic_title():
    assert True
    allure.dynamic.title("更改后的新标题")

5、allure2报告中添加用例步骤

1)方法一:使用装饰器定义一个测试步骤,在测试用例中使用。

# 方法一:使用装饰器定义一个测试步骤,在测试用例中使用
import allure
import pytest

# 定义测试步骤:simple_step1
@allure.step
def simple_step1(step_param1, step_param2 = None):
    '''定义一个测试步骤'''
    print(f"步骤1:打开页面,参数1: {step_param1}, 参数2:{step_param2}")

# 定义测试步骤:simple_step2
@allure.step
def simple_step2(step_param):
    '''定义一个测试步骤'''
    print(f"步骤2:完成搜索 {step_param} 功能")

@pytest.mark.parametrize('param1', ["pytest", "allure"], ids=['search pytest', 'search allure'])
def test_parameterize_with_id(param1):
      simple_step2(param1)         # 调用步骤二


@pytest.mark.parametrize('param1', [True, False])
@pytest.mark.parametrize('param2', ['value 1', 'value 2'])
def test_parametrize_with_two_parameters(param1, param2):
      simple_step1(param1, param2)   # 调用步骤一

@pytest.mark.parametrize('param2', ['pytest', 'unittest'])
@pytest.mark.parametrize('param1,param3', [[1,2]])
def test_parameterize_with_uneven_value_sets(param1, param2, param3):
    simple_step1(param1, param3)    # 调用步骤一
    simple_step2(param2)      # 调用步骤二

2)方法二:使用 with allure.step() 添加测试步骤。

# 方法二:使用 `with allure.step()` 添加测试步骤
@allure.title("搜索用例")
def test_step_in_method():
    with allure.step("测试步骤一:打开页面"):
        print("操作 a")
        print("操作 b")

    with allure.step("测试步骤二:搜索"):
        print("搜索操作 ")

    with allure.step("测试步骤三:断言"):
        assert True

6、allure2报告中添加用例链接

1)应用场景:将报告与 bug 管理系统或测试用例管理系统集成,可以添加链接装饰器 @allure.link、@allure.issue 和@allure.testcase。

①格式 1:@allure.link(url, name) 添加一个普通的 link 链接。
②格式 2:@allure.testcase(url, name) 添加一个用例管理系统链接。
③格式 3:@allure.issue(url, name),添加 bug 管理系统
# 格式1:添加一个普通的link 链接
@allure.link('https://ceshiren.com/t/topic/15860')
def test_with_link():
    pass

# 格式1:添加一个普通的link 链接,添加链接名称
@allure.link('https://ceshiren.com/t/topic/15860', name='这是用例链接地址')
def test_with_named_link():
    pass

# 格式2:添加用例管理系统链接
TEST_CASE_LINK = 'https://github.com/qameta/allure-integrations/issues/8#issuecomment-268313637'

@allure.testcase(TEST_CASE_LINK, '用例管理系统')
def test_with_testcase_link():
    pass

# 格式3:添加bug管理系统链接
# 这个装饰器在展示的时候会带 bug 图标的链接。可以在运行时通过参数 `--allure-link-pattern` 指定一个模板链接,以便将其与提供的问题链接类型链接模板一起使用。执行命令需要指定模板链接:
`--allure-link-pattern=issue:https://abc.com/t/topic/{}`
@allure.issue("15860", 'bug管理系统')
def test_with_issue():
    pass

7、allure2报告中添加用例分类

(1)Allure 分类

1)应用场景:可以为项目,以及项目下的不同模块对用例进行分类管理。也可以运行某个类别下的用例。
2)报告展示:类别会展示在测试报告的 Behaviors 栏目下。
3)Allure 提供了三个装饰器:
    ①@allure.epic:敏捷里面的概念,定义史诗,往下是 feature。
    ②@allure.feature:功能点的描述,理解成模块往下是 story。
    ③@allure.story:故事 story 是 feature 的子集。

(2)Allure 分类 - epic

1)场景:希望在测试报告中看到用例所在的项目,需要用到 epic,相当于定义一个项目的需求,由于粒度比较大,在 epic 下面还要定义略小粒度的用户故事。
2)装饰器:@allure.epic
 
import allure

@allure.epic("需求1")
class TestEpic:
    def test_case1(self):
        print("用例1")

    def test_case2(self):
        print("用例2")

    def test_case3(self):
        print("用例3")

(3)Allure 分类 - feature/story

1)场景: 希望在报告中看到测试功能,子功能或场景。
2)装饰器: @allure.Feature、@allure.story
3)步骤:
    ①功能上加   @allure.feature('功能名称')
    ②子功能上加   @allure.story('子功能名称')
 
import allure

@allure.epic("需求1")
@allure.feature("功能模块1")
class TestEpic:
    @allure.story("子功能1")
    @allure.title("用例1")
    def test_case1(self):
        print("用例1")

    @allure.story("子功能2")
    @allure.title("用例2")
    def test_case2(self):
        print("用例2")

    @allure.story("子功能2")
    @allure.title("用例3")
    def test_case3(self):
        print("用例3")

    @allure.story("子功能1")
    @allure.title("用例4")
    def test_case4(self):
        print("用例4")

4)Allure 运行 feature/story,allure 相关的命令查看 : pytest --help|grep allure

#通过指定命令行参数,运行 epic/feature/story 相关的用例:
pytest 文件名
--allure-epics=EPICS_SET --allure-features=FEATURES_SET --allure-stories=STORIES_SET

# 只运行 epic 名为 "需求1" 的测试用例
pytest --alluredir ./results --clean-alluredir --allure-epics=需求1

# 只运行 feature 名为 "功能模块2" 的测试用例
pytest --alluredir ./results --clean-alluredir --allure-features=功能模块2

# 只运行 story 名为 "子功能1" 的测试用例
pytest --alluredir ./results --clean-alluredir --allure-stories=子功能1

# 运行 story 名为 "子功能1和子功能2" 的测试用例
pytest --alluredir ./results --clean-alluredir --allure-stories=子功能1,子功能2

# 运行 feature + story 的用例(取并集)
pytest --alluredir ./results --clean-alluredir --allure-features=功能模块1 --allure-stories=子功能1,子功能2
Allure epic/feature/story 的关系

5)总结

①epic:敏捷里面的概念,用来定义史诗,相当于定义一个项目。
②feature:相当于一个功能模块,相当于 testsuite,可以管理很多个子分支 story。
③story:相当于对应这个功能或者模块下的不同场景,分支功能。
④epic 与 feature、feature 与 story 类似于父子关系。

8、Allure2 报告中添加用例描述

1)应用场景:Allure 支持往测试报告中对测试用例添加非常详细的描述语,用来描述测试用例详情。

2)Allure 添加描述的四种方式:

①方式一:使用装饰器 @allure.description() 传递一个字符串参数来描述测试用例。

@allure.description("""
多行描述语:<br/>
这是通过传递字符串参数的方式添加的一段描述语,<br/>
使用的是装饰器 @allure.description
""")
def test_description_provide_string():
    assert True

②方式二:使用装饰器 @allure.description_html 传递一段 HTML 文本来描述测试用例。

@allure.description_html("""html代码块""")
def test_description_privide_html():
    assert True

③方式三:直接在测试用例方法中通过编写文档注释的方法来添加描述。

def test_description_docstring():
    """
    直接在测试用例方法中
    通过编写文档注释的方法
    来添加描述。
    :return:
    """
    assert True

④方式四:用例代码内部动态添加描述信息。

import allure

@allure.description("""这个描述将被替换""")
def test_dynamic_description():
    assert 42 == int(6 * 7)
    allure.dynamic.description('这是最终的描述信息')
    # allure.dynamic.description_html(''' html 代码块 ''')

9、Allure2报告中添加用例优先级

1)应用场景:用例执行时,希望按照严重级别执行测试用例。

2)解决:可以为每个用例添加一个等级的装饰器,用法:@allure.severity。

3)Allure 对严重级别的定义分为 5 个级别:

①Blocker级别:中断缺陷(客户端程序无响应,无法执行下一步操作)。
②Critical级别:临界缺陷( 功能点缺失)。
③Normal级别:普通缺陷(数值计算错误)。
④Minor级别:次要缺陷(界面错误与UI需求不符)。
⑤Trivial级别:轻微缺陷(必输项无提示,或者提示不规范)。

4)使用装饰器添加用例方法/类的级别。类上添加的级别,对类中没有添加级别的方法生效。

#运行时添加命令行参数 --allure-severities:
 pytest --alluredir ./results --clean-alluredir --allure-severities normal,blocker
 
import allure
def test_with_no_severity_label():
    pass

@allure.severity(allure.severity_level.TRIVIAL)
def test_with_trivial_severity():
    pass

@allure.severity(allure.severity_level.NORMAL)
def test_with_normal_severity():
    pass

@allure.severity(allure.severity_level.NORMAL)
class TestClassWithNormalSeverity(object):

    def test_inside_the_normal(self):
        pass

    @allure.severity(allure.severity_level.CRITICAL)
    def test_critical_severity(self):
        pass

    @allure.severity(allure.severity_level.BLOCKER)
    def test_blocker_severity(self):
        pass

10、allure2报告中添加用例支持tags标签

(1)Allure2 添加用例标签-xfail、skipif

1)用法:使用装饰器 @pytest.xfail()、@pytest.skipif()

import pytest
# 当用例通过时标注为 xfail
@pytest.mark.xfail(condition=lambda: True, reason='这是一个预期失败的用例')
def test_xfail_expected_failure():
    """this test is a xfail that will be marked as expected failure"""
    assert False

# 当用例通过时标注为 xpass
@pytest.mark.xfail
def test_xfail_unexpected_pass():
    """this test is a xfail that will be marked as unexpected success"""
    assert True

# 跳过用例
@pytest.mark.skipif('2 + 2 != 5', reason='当条件触发时这个用例被跳过 @pytest.mark.skipif')
def test_skip_by_triggered_condition():
    pass

(2)Allure2 添加用例标签-fixture

1)应用场景:fixture 和 finalizer 是分别在测试开始之前和测试结束之后由 Pytest 调用的实用程序函数。Allure 跟踪每个 fixture 的调用,并详细显示调用了哪些方法以及哪些参数,从而保持了调用的正确顺序。

import pytest

@pytest.fixture()
def func(request):
    print("这是一个fixture方法")

    # 定义一个终结器,teardown动作放在终结器中
    def over():
        print("session级别终结器")

    request.addfinalizer(over)

class TestClass(object):
    def test_with_scoped_finalizers(self,func):
        print("测试用例")

11、allure2报告中支持记录失败重试功能

1)Allure 可以收集用例运行期间,重试的用例的结果,以及这段时间重试的历史记录。

2)重试功能可以使用 pytest 相关的插件,例如 pytest-rerunfailures。重试的结果信息,会展示在详情页面的”Retries” 选项卡中。

import pytest
@pytest.mark.flaky(reruns=2, reruns_delay=2)   # reruns重试次数,reruns_delay每次重试间隔时间(秒)
def test_rerun2():
    assert False

12、Allure2 报告中添加附件-图片

(1)应用场景:

在做 UI 自动化测试时,可以将页面截图,或者出错的页面进行截图,将截图添加到测试报告中展示,辅助定位问题。

(2)解决方案:

①Python:使用 allure.attach 或者 allure.attach.file() 添加图片。
②Java:直接通过注解或调用方法添加。

(3)python方法一:

1)语法:allure.attach.file(source, name, attachment_type, extension),
2)参数解释:
    ①source:文件路径,相当于传一个文件。
    ②name:附件名字。
    ③attachment_type:附件类型,是 allure.attachment_type 其中的一种(支持 PNG、JPG、BMP、GIF 等)。
    ④extension:附件的扩展名。
import allure
class TestWithAttach:
    def test_pic(self):
        allure.attach.file("pic.png", name="图片", attachment_type=allure.attachment_type.PNG, extension="png")

(4)python方法二

1)语法:allure.attach(body, name=None, attachment_type=None, extension=None)
2)参数解释:
    ①body:要写入附件的内容
    ②name:附件名字。
    ③attachment_type:附件类型,是 allure.attachment_type 其中的一种(支持 PNG、JPG、BMP、GIF 等)。
    ④extension:附件的扩展名。

(5)裂图的原因以及解决办法

1)图片上传过程中出现了网络中断或者传输过程中出现了错误。
解决方案:重新上传图片。

2)Allure 报告中的图片大小超过了 Allure 的限制。
解决方案:调整图片大小。

3)图片本身存在问题。
解决方案:检查图片格式和文件本身。

13、Allure2报告中添加附件-日志

(1)应用场景:

报告中添加详细的日志信息,有助于分析定位问题。

(2)解决方案:

1)Python:使用 python 自带的 logging 模块生成日志,日志会自动添加到测试报告中。

①日志配置,在测试报告中使用 logger 对象生成对应级别的日志。
 
# 创建一个日志模块: log_util.py
import logging
import os

from logging.handlers import RotatingFileHandler

# 绑定绑定句柄到logger对象
logger = logging.getLogger(__name__)
# 获取当前工具文件所在的路径
root_path = os.path.dirname(os.path.abspath(__file__))
# 拼接当前要输出日志的路径
log_dir_path = os.sep.join([root_path, f'/logs'])
if not os.path.isdir(log_dir_path):
    os.mkdir(log_dir_path)
# 创建日志记录器,指明日志保存路径,每个日志的大小,保存日志的上限
file_log_handler = RotatingFileHandler(os.sep.join([log_dir_path, 'log.log']), maxBytes=1024 * 1024, backupCount=10 , encoding="utf-8")
# 设置日志的格式
date_string = '%Y-%m-%d %H:%M:%S'
formatter = logging.Formatter(
    '[%(asctime)s] [%(levelname)s] [%(filename)s]/[line: %(lineno)d]/[%(funcName)s] %(message)s ', date_string)
# 日志输出到控制台的句柄
stream_handler = logging.StreamHandler()
# 将日志记录器指定日志的格式
file_log_handler.setFormatter(formatter)
stream_handler.setFormatter(formatter)
# 为全局的日志工具对象添加日志记录器
# 绑定绑定句柄到logger对象
logger.addHandler(stream_handler)
logger.addHandler(file_log_handler)
# 设置日志输出级别
logger.setLevel(level=logging.INFO)
②代码输出到用例详情页面。运行用例命令:pytest --alluredir ./results --clean-alluredir(注意不要加-vs)。
import allure
from pytest_test.log_util import logger


@allure.feature("功能模块2")
class TestWithLogger:
    @allure.story("子功能1")
    @allure.title("用例1")
    def test_case1(self):
        logger.info("用例1的 info 级别的日志")
        logger.debug("用例1的 debug 级别的日志")
        logger.warning("用例1的 warning 级别的日志")
        logger.error("用例1的 error 级别的日志")
        logger.fatal("用例1的  fatal 级别的日志")

③日志展示在 Test body 标签下,标签下可展示多个子标签代表不同的日志输出渠道:

    log 子标签:展示日志信息。
    stdout 子标签:展示 print 信息。
    stderr 子标签:展示终端输出的信息。

④禁用日志,可以使用命令行参数控制 --allure-no-capture

    pytest --alluredir ./results --clean-alluredir --allure-no-capture


    -- 日志文件为byte[]类型添加。
public void exampleTest() {
      byte[] contents = Files.readAllBytes(Paths.get("a.txt"));
      attachTextFile(byte[]的文件, "描述信息");
  }

  @Attachment(value = "{attachmentName}", type = "text/plain")
  public byte[] attachTextFile(byte[] contents, String attachmentName) {
      return contents;
  }
②调用方法添加。 

    --String类型添加。 日志文件为String类型

Allure.addAttachment("描述信息", "text/plain", 文件读取为String,"txt");

    --InputStream类型添加。日志文件为InputStream流

Allure.addAttachment("描述信息", "text/plain", Files.newInputStream(文件Path), "txt");

14、allure2报告中添加附件-html

(1)应用场景

可以定制测试报告页面效果,可以将 HTML 类型的附件显示在报告页面上。

(2)解决方案:

1)Python:使用 allure.attach() 添加 html 代码。

①语法:allure.attach(body, name, attachment_type, extension),
②参数解释:
    body:要写入附件的内容(HTML 代码块)。
    name:附件名字。
    attachment_type:附件类型,是 allure.attachment_type 其中的一种。
    extension:附件的扩展名。
import allure
class TestWithAttach:
    def test_html(self):
        allure.attach('<head></head><body> a page </body>',
                      '附件是HTML类型',
                      allure.attachment_type.HTML)
                      
    def test_html_part(self):
        allure.attach('''html代码块''',
                      '附件是HTML类型',
                      allure.attachment_type.HTML)

15、Allure2 报告中添加附件-视频

(1)应用场景:

在做 UI 自动化测试时,可以将页面截图,或者出错的页面进行截图,将截图添加到测试报告中展示,辅助定位问题。

(2)解决方案:

1)Python:使用 allure.attach.file() 添加视频

①语法:allure.attach.file(source, name, attachment_type, extension)
②参数解释:
    source:文件路径,相当于传一个文件。
    name:附件名字。
    attachment_type:附件类型,是 allure.attachment_type 其中的一种。
    extension:附件的扩展名。
import allure


class TestWithAttach:
    def test_video(self):
        allure.attach.file("xxx.mp4", name="视频", attachment_type=allure.attachment_type.MP4, extension="mp4")

16、Allure2 报告定制

应用场景:针对不同的项目可能需要对测试报告展示的效果进行定制,比如修改页面的 logo、修改项目的标题或者添加一些定制的功能等等。

(1)页面 Logo

1)修改allure.yml 文件,在后面添加 logo 插件:custom-logo-plugin(在 allure 安装路径下:/allure-2.21.0/config/allure.yml,可以通过 where allure 或者which allure查看 allure 安装路径)
2)编辑 styles.css 文件,配置 logo 图片(logo图片可以提前准备好放在/custom-logo-plugin/static中)

/* 打开 styles.css 文件,
目录在安装allure时,解压的路径:/xxx/allure-2.21.0/plugins/custom-logo-plugin/static/styles.css,
将内容修改图片logo和相应的大小:*/

.side-nav__brand {
  background: url("logo.jpeg") no-repeat left center !important;
  margin-left: 10px;
  height: 40px;
  background-size: contain !important;
}

(2)页面标题

1)编辑 styles.css 文件,添加修改标题对应的代码。

/* 去掉图片后边 allure 文本 */
.side-nav__brand-text {
  display: none;
}

/* 设置logo 后面的字体样式与字体大小 */
.side-nav__brand:after {
  content: "测试报告";
  margin-left: 18px;
  height: 20px;
  font-family: Arial;
  font-size: 13px;
}

自动化测试学习资源分享

最后: 为了回馈铁杆粉丝们,我给大家整理了完整的软件测试视频学习教程,朋友们如果需要可以自行免费领取 【保证100%免费】

加入我的软件测试交流群:110685036免费获取~(同行大佬一起学术交流,每晚都有大佬直播分享技术知识点)

软件测试面试小程序

被百万人刷爆的软件测试题库!!!谁用谁知道!!!全网最全面试刷题小程序,手机就可以刷题,地铁上公交上,卷起来!

涵盖以下这些面试题板块:

1、软件测试基础理论 ,2、web,app,接口功能测试 ,3、网络 ,4、数据库 ,5、linux

6、web,app,接口自动化 ,7、性能测试 ,8、编程基础,9、hr面试题 ,10、开放性测试题,11、安全测试,12、计算机基础

全套资料获取方式 :

 

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【面试题】前端必修-浏览器的渲染原理

大厂面试题分享 面试题库 前后端面试题库 &#xff08;面试必备&#xff09; 推荐&#xff1a;★★★★★ 地址&#xff1a;前端面试题库 web前端面试题库 VS java后端面试题库大全 1.浏览器的渲染原理 #浏览器是如何渲染页面的 1.什么叫渲染 render 当我们输入一个url地址的…

新书上市 | 从大脑认知开始,全方面提高编程能力,助你摆脱“GPT焦虑症”

目录 一、ChatGPT火爆全网二、《程序员超强大脑》三、本书内容四、本书特色五、作译者简介1、费莉安赫尔曼斯&#xff08;Felienne Hermans&#xff09;2、蒋楠 大家好&#xff0c;我是哪吒。 &#x1f3c6;本文收录于&#xff0c;49天精通Java从入门到就业。 全网最细Java零…

程序人生-Hello’s P2P

摘要 本文讨论了与编程和软件开发相关的几个关键概念和过程。首先介绍了链接的概念和作用&#xff0c;它是将代码和数据片段组合成单一文件的过程&#xff0c;使得分离编译成为可能&#xff0c;从而可以更好地管理和修改模块。接下来探讨了进程的概念和作用&#xff0c;进程是正…

图像数据处理

文章目录 1&#xff1a;TFRecords1-1 将MNIST数据集转换成TFRecord格式1-2 读取TFRecord文件中的数据 2&#xff1a;图像数据的预处理2-1 处理图像编码2-2 调整图像大小2-3 剪裁和填充2-4 按比例剪裁2-5 图像翻转2-6 图像亮度调整2-7 图像对比度调整2-8 图像色相调整2-9 图像饱…

chatgpt赋能Python-python_99乘法

Python编程实现——99乘法表的生成 Python编程语言是一种高级程序设计语言&#xff0c;具有简单易学、可移植性强、功能强大等特点&#xff0c;受到广大开发者的喜爱。Python可以被应用于网站开发、数据分析、人工智能、机器学习等多个领域。而在Python编程中&#xff0c;生成…

《程序员面试金典(第6版)》面试题 02.06. 回文链表(双指针(快慢指针),查找链表中间节点,反转链表)

题目描述 编写一个函数&#xff0c;检查输入的链表是否是回文的。 题目传送门~&#xff1a;面试题 02.06. 回文链表 示例 1&#xff1a; 输入&#xff1a; 1->2 输出&#xff1a; false 示例 2&#xff1a; 输入&#xff1a; 1->2->2->1 输出&#xff1a; true 进…

蓝桥杯单片机串口通信学习提升笔记——部分2

今日继续学习提升蓝桥杯国赛能力水平。 有道是&#xff1a;卜心事、灯花无语&#xff0c;百感孤单&#xff0c;鸳被羞展...... 梦方圆&#xff0c;又丛钟、声声惊断。 诗人杨玉衔孤单影只&#xff0c;偏偏又多遭磨难&#xff0c;一路坎坷...... 正如我近日来学习提升串口通信…

数据结构学习分享之链式二叉树(一)

&#x1f493;博主CSDN主页:杭电码农-NEO&#x1f493;   ⏩专栏分类:数据结构学习分享⏪   &#x1f69a;代码仓库:NEO的学习日记&#x1f69a;   &#x1f339;关注我&#x1faf5;带你了解更多数据结构的知识   &#x1f51d;&#x1f51d; 1. 前言 在学习链式二叉树…

【Linux】shell编程—awk编辑器

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 一、awk编辑器1.工作流程3.常用选项 二、awk的基础用法1.输出文件中的某一列2.根据特定条件筛选数据3.按照分隔符进行切割4.在匹配到特定字符串时执行操作5.BEGIN打…

chatgpt赋能Python-pythonwxpy

Python的wxpy模块&#xff1a;一款强大的微信机器人框架 在当今数字时代&#xff0c;微信已经成为了大家日常生活中不可缺少的应用。wxpy是一款使用Python语言的微信机器人框架&#xff0c;可以帮助用户实现诸如自动回复、消息提醒、定时发送消息等自动化操作。它的易用性、强…

(5)---STM32 的时钟系统

目录 1.时钟基本概念 时钟源常见振荡器 振荡电路 晶体振荡器 RC振荡器 2.G030时钟源 3.时钟树 4.STM32CubeMX时钟树配置 1.时钟基本概念 1&#xff09; 时钟是嵌入式系统的脉搏&#xff0c;处理器内核在时钟驱动下完成指令执行&#xff0c;状态变换等动作&#xff0c; 外设部件…

基于redis客户端缓存机制实现本地缓存

文章目录 前言一、本地缓存和分布式缓存二、redis客户端缓存机制1.客户端缓存实现原理普通模式广播模式重定向模式redirect 2.优势和误区3.客户端缓存机制请求流程 三、项目实战1.引入依赖2.redis连接属性配置3.开启客户端缓存4.使用本地缓存5.测试 总结 前言 采用缓存一直是我…

VMware ESXi 6.0 U3 Final - ESXi 6 系列最终版下载

VMware ESXi 6.0 U3 Final - ESXi 6 系列最终版下载 VMware ESXi 6 Standard 请访问原文链接&#xff1a;https://sysin.org/blog/vmware-esxi-6/&#xff0c;查看最新版。原创作品&#xff0c;转载请保留出处。 作者主页&#xff1a;sysin.org VersionRelease NameRelease …

RLHF中的PPO算法原理及其实现

RLHF中的PPO算法原理及其实现 ChatGPT是基于InstructGPT实现的多轮对话生成式大模型。ChatGPT主要涉及到的技术包括&#xff1a; 指令微调&#xff08;Instruction-tuning&#xff09;&#xff1b;因果推断&#xff08;Causal Language Modeling&#xff09;&#xff1b;人类…

从零开始Vue3+Element Plus后台管理系统(十五)——多语言国际化vue I18n

i18n国际化的内容比较多&#xff0c;写文章的时间也用得比较长&#xff0c;从上周五开始到本周一&#xff0c;断断续续完成了。 虽然实际工作中很多项目都不需要国际化&#xff0c;但是了解国际化的用法还是很有必要的。 i18n Vue I18n 是 Vue.js 的国际化插件。它可以轻松地…

PFC-FLAC3D Coupling Examples

目录 PFC-FLAC3D Coupling Examples Punch Indentation of a Bonded Material Sleeved Triaxial Test of a Bonded Material 命令流 结果 PFC-FLAC3D Coupling Examples Punch Indentation of a Bonded Material 这个例子展示了一个粘合颗粒模型&#xff08;BPM&#xff0…

项目经历该如何写?

大家好&#xff0c;我是帅地。 这不春招来了吗&#xff0c;帮训练营的帅友们修改了很多简&#xff0c;其中问题最多的就是项目经历 专业技能这块了&#xff0c;特别是项目经历这块&#xff0c;很多人写了一大堆描述功能描述&#xff0c;但是自己具体干了什么却没怎么写&#…

研发工程师玩转Kubernetes——使用Deployment进行多副本维护

多副本维护是指&#xff0c;对一组在任何时候都处于运行状态的 Pod 副本的稳定集合进行维护。说的直白点&#xff0c;就是保证某种的Pod数量会被自动维持——增加了该类Pod会自动删除多余的&#xff0c;减少了该类Pod会自动新增以弥补&#xff0c;以保证Pod数量不变。 Kubernet…

day37_Tomcat_Maven

今日内容 一、Maven 二、Tomcat 一、Maven 1.1 引言 项目管理问题 项目中jar包资源越来越多&#xff0c;jar包的管理越来越沉重。 繁琐 要为每个项目手动导入所需的jar&#xff0c;需要搜集全部jar 复杂 项目中的jar如果需要版本升级&#xff0c;就需要再重新搜集jar 冗余 相…

基于Spring-动态调整线程池阻塞队列长度

最近在做一个动态线程池的组件&#xff0c;遇到了关于阻塞队列长度刷新的问题,所以记录下来&#xff0c;很有意思 我们都知道常用线程池分为二类&#xff0c;Spring-ThreadPoolTaskExecutor和JDK-ThreadPoolExecutor的&#xff0c;当然了Spring也是基于JDK做一步封装&#xff0…