基于pytest的BMC测试

 2022-06-24 11:06

论文总字数:36673字

摘 要

随着UPS(Uninterruptible Power System,不间断电源)系统市场竞争越来越激烈,产品迭代速度越来越快,给研发团队带来了很大的压力。为了跟上研发进度,研发团队需要更多的策略或工具帮助团队提高开发和测试效率。为了缩短UPS系统中BMC模块(Battery Management Controller,电池管理控制器)的集成测试时间,节约人力资源,提高效率,本毕业设计提出一种采用自动化测试代替原来手动测试的方式。在本毕业设计进行了嵌入式软件测试、自动化测试、持续集成的相关研究,根据现有的研究成果设计了BMC测试的整体架构,利用PCAN设备连接主机(PC)和目标板(BMC)使PC能够接入BMC和外部设备或模块进行通信的CAN网络,从而控制和获取BMC模块的运行状态,进行BMC的集成测试。为了实现上述架构,设计并编写代码实现了CAN通信功能,在Pytest测试框架的基础上设计了BMC自动化测试系统以及BMC集成测试用例。通过验证,该自动化测试系统能够成功运行并执行测试工作,能产生测试结果以及生成以网页形式展示的测试报告。最后,在Jenkins中配置了BMC的自动化测试,完善了目前的持续集成流程。本毕业设计中所设计的基于Pytest的BMC自动化测试应用到了实际的开发项目中,有效缩短了原来的测试时间,提高了测试效率和开发效率。

关键词:嵌入式软件测试,自动化测试,持续集成,UPS系统测试,CAN总线

Abstract

With the increasingly fierce competition in the UPS (Uninterruptible Power System) market, the speed of product iteration is getting faster and faster. It has brought great pressure to the R amp; D team, and more strategies or tools are needed to help the team improve the efficiency of development and testing to keep up with the progress. In order to shorten the integration test time of BMC module (Battery Management Controller) in UPS system, save human resources and improve efficiency, automation test takes the place of manual test. In this subject, the relevant research on embedded software testing, automation test and continuous integration is carried out. The overall architecture of BMC testing is designed. In this architecture, PCAN device is used to connect the host (PC) and target(BMC) to enable PC to access BMC, which can communicate with the external devices or modules through CAN network, so as to carry out the integration test of BMC by controlling and getting the running state of BMC. In order to realize this architecture, the CAN communication function is realized by Python Language. Based on the Pytest testing framework, the BMC automation test system and the BMC integration test cases are designed. Through validation, the automated test system can run successfully and do test work. It can also produce test results and generate test reports displayed in the form of a web page. Finally, the automation test of BMC is configured in Jenkins to improve the current continuous integration process. The Pytest based BMC automation test has been applied to the actual projects, effectively shortening the original test time and improving the efficiency of the test.

KEY WORDS: Embedded software testing, Automation test, Continuous integration, UPS test, CAN BUS

目录

摘要 I

Abstract II

第一章 绪论 3

1.1 研究背景和意义 3

1.2 国内外研究现状 2

1.2.1 嵌入式软件测试的相关研究 2

1.2.2 自动化软件测试的相关研究 3

1.2.3 持续集成的发展和相关研究 4

1.3 本文的主要工作 5

1.4 论文组织与结构 5

第二章 BMC测试相关技术介绍 7

2.1 UPS系统 7

2.2 CAN总线 8

2.3 Pytest测试框架 9

2.4 持续集成实践 10

2.4.1 持续集成流程 10

2.4.2 持续集成平台Jenkins 10

2.5 本章小结 12

第三章 BMC测试需求与总体方案 13

3.1 总体需求概述 13

3.2 测试的目的与意义 13

3.3 测试对象与内容 14

3.4 BMC测试总体方案 14

3.4.1 BMC测试总体架构 14

3.4.2 CAN通信模块 15

3.4.3 测试管理控制模块 15

3.4.4 测试用例模块 16

3.5 本章小结 16

第四章 BMC测试详细设计与实现 17

4.1 BMC测试环境建立 17

4.2 CAN通信设计与实现 18

4.2.1 CAN通信功能设计与实现 18

4.2.2 CAN通信数据格式设计 20

4.2.3 CAN报文详细设计 21

4.3 测试管理控制设计与实现 25

4.4 测试用例设计与测试脚本实现 26

4.4.1 电池状态led灯测试 27

4.4.2 软件版本测试 28

4.4.3 软件升级测试 29

4.4.4 BMC状态测试 30

4.4.5 电池状态测试 30

4.5 自动化测试应用实例 31

4.6 Jenkins持续集成环境配置 33

4.6.1 创建持续集成环境 33

4.6.2 创建测试任务 34

4.6.3 执行测试 35

4.6.4 测试结果和测试报告 36

4.7 本章小结 36

第五章 总结和展望 37

5.1 总结 37

5.2 展望 37

致谢 38

参考文献 39

绪论

研究背景和意义

随着计算机技术的发展,嵌入式软件技术也得到了很大的进步,能够实现更多复杂而强大的功能。但是,随着软件在嵌入式系统中所占的比例越来越大,由软件失效造成的系统故障比例也在上升。系统故障不仅会对企业或机构造成不良影响,甚至会带来人员伤害等危险。

为了提高嵌入式软件质量,降低风险,开发团队开始重视嵌入式软件测试工作。但是,传统的手动测试重复性高,有很多机械化、非创造性的工作,并且效率较低。而当前,测试工作量非常大,完全手动测试已经渐渐无法满足需求了。例如,,在市场竞争日益激烈的情况下,产品迭代速度快、发布频繁,回归测试的频率也越来越高。由于测试人员则要经常性地进行重复的测试内容,回归测试在软件测试过程中占了很大的工作量,且对测试人员来说是很大的消耗。如果将这些重复性的工作由机器完成,则能够节省很多的人力资源和成本。因此,很多团队开始采用自动化测试的方式,以此来缩短测试时间,控制开发成本,提高测试效率。

剩余内容已隐藏,请支付后下载全文,论文总字数:36673字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;