2023 National Vocational College Skills Competition-Software Testing Questions Set 7- GZ034 Software Testing

Table of contents

The 7th set of software test questions in the 2023 National Vocational College Skills Competition

Task 1 environment construction and system deployment

Task 2 unit test

Task Three Test Documentation

Task Four Functional Test

Task five automated testing

Task six performance test

Task seven interface test


 

The 7th set of software test questions in the 2023 National Vocational College Skills Competition

Event Name:             Software Testing            

English name: Software Testing                   

Competition No.: GZ034                         

Belonging industry:          electronics and information category          

Competition category:           Higher Vocational Education          

Main content of the competition:

Task

serial number

skill competition

module name

Content of skill competition

Weights

Proportion

competition

time

task 1

Environment construction and

system deployment

According to the requirements of the software testing competition project, build and configure the test environment, install and deploy the application system.

5%

480

minute

task 2

unit test

According to the requirements of the software testing competition project, write the application program, design the test data and obtain the test results, and write the unit test report.

10%

task 3

test document

According to the requirements of software testing competition projects, develop test plan documents and test summary report documents.

10%

task 4

function test

According to the requirements of the software testing competition project, design functional test cases, and submit defect reports after execution.

25%

task 5

automated test

Write and execute automated test scripts according to the requirements of software automated testing.

20%

task 6

Performance Testing

According to the requirements of software performance testing, execute

Performance Testing

18%

task 7

interface test

According to the requirements of the software interface test, execute

interface test

7%

Professionalism

The competition team has a clear and reasonable division of labor, standard operation, civilized competition, and enterprise "5S" (organization, rectification, cleaning, cleanliness and quality) and other content.

5%


Task 1 environment construction and system deployment

1. Task requirements

1. Use the CentOS system in VirtualBox (Note: The system is not a pure system, there may be situations such as port occupation) to install related software and solve problems encountered during installation. All operations must be completed using the command interface.

2. The root account password of CentOS system is: 123456.

3. The relevant deployment files provided are stored in the /opt directory of the CentOS system.

4. Install and configure JDK:

  • In the CentOS system, use the provided JDK installation package to install JDK;
  • After the installation is successful, check the JDK version information;
  • Screenshot requirements: There are 2 pictures in total, which are: ①JDK environment variable configuration screenshot; ②View JDK version information screenshot.

5. Install and configure MySQL:

  • In the CentOS system, use the provided MySQL installation package to install MySQL;
  • Change the root account password of MySql to: root;
  • After MySQL is successfully installed, initialize the human resources comprehensive service system database (suthr.sql);
  • Screenshot requirements: 2 pictures in total: ①Screenshot of the root account successfully logging in to MySQL; ②Screenshot of the command to initialize the database of the human resources comprehensive service system.

6. Install and configure Tomcat:

  • In the CentOS system, use the provided Tomcat installation package to install Tomcat;
  • After Tomcat is successfully installed, visit the Tomcat homepage through the browser of the host machine;
  • Screenshot requirements: 2 pictures in total: ①Screenshot of successfully starting Tomcat service; ②Screenshot of Tomcat homepage accessed through a browser.

7. Application system deployment:

  • Deploy the HR system (suthr.war) to Tomcat;
  • After the deployment is successful, access the system login page through the browser of the host machine;
  • Screenshot requirements: 2 pictures in total, which are: ① After the system is successfully deployed, a screenshot of the webapps directory; ②A screenshot of the login page of the system accessed through a browser.

2. Report writing

According to the environment construction situation, refer to the environment construction and system deployment report template, intercept the screenshots of the environment construction process and results as required and paste them into the template, and complete the environment construction and system deployment report.

Task 2 unit test

1. Task requirements

Topic 1: Randomly input 2 positive integer values ​​and store them in x and y respectively, and complete the following analysis accordingly: if x≤0 or y≤0, it will prompt: "The input does not meet the requirements."; if the 2 values ​​are the same, If 2<|xy|≤5, it will prompt "ellipse can be constructed"; if |xy|>5, it will prompt "rectangle can be constructed"; if 0<|xy|≤ 2, Prompt "can build a rectangle". Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the statement coverage test, and write a test method in the test class for each test data. Use assertEquals to determine whether the expected result value of the input data test method is consistent with the actual return value.

Topic 2: Determine the number of days in a month based on the input year and month. If the month is not within the valid range, it should prompt: "The month input is incorrect.". If the month is not February, output the corresponding number of days in the month according to the input month. If the month is February, according to the year judgment, if it is an ordinary leap year, output the correct number of days in February; if it is a century leap year, output the correct number of days in February; if it is not a leap year, output the correct number of days in February. The returned result format: "The number of days in year and month is days." year and month are the values ​​passed in, and days is the value of days obtained from the judgment. The variables year and month must be positive integers. Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the statement coverage test, and write a test method in the test class for each test data. Use the equalTo assertion in assertThat to determine whether the expected result is consistent with the actual return.

Topic 3: Email address and password are required for email registration. Among them, the email format is required to be "login [email protected] name", the login name is 5 letters, the host name is fixed to the following two 163 and 126, and the domain name is com or com.cn. The password is composed of more than 6 (including 6) numbers. If it is filled in correctly, it will prompt "information is correct", otherwise it will prompt "** does not meet the requirements" according to the actual situation (** is the email address or password). Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the statement coverage test, and write a test method in the test class for each test data. Use the equalTo assertion in assertThat to judge whether the expected result value of the output text is consistent with the actual return value.

Question 4: Enter a lowercase string. If the string prefix starts with ab, then replace the prefix ab with ef and print out the replaced string, and return the text "The string after replacing the prefix is:" and the value of the replaced string; if the suffix is ​​cd and the prefix is ​​not ab, replace all cd in the string with gh and print out the replaced string, return the text "The string after replacing cd is:" and the string value after replacement; otherwise output all letters in uppercase, return the text "Characters of uppercase letters The string is: " and the converted string value. Write the program code, use the JUnit framework to write the test class to test the written program code, design the least test data in the test class to meet the conditional coverage test, and use the parameterized test (@Parameters) to complete the test in the test class. Use assertEquals to determine whether the expected result value is consistent with the actual return value.

2. Report writing

According to the unit test situation, refer to the unit test report template, paste the written java source code, test class related code and relevant screenshots into the template as required, and complete the unit test report.

Task Three Test Documentation

1. Test plan

1. Overview

1.1 Project background

[Explain the overall background of the test project]

1.2 Purpose of writing

[Explain the purpose of writing the test plan document]

2. Test tasks

2.1 Test purpose

[Respectively explain the purpose of functional testing, automated testing, performance testing, and interface testing]

2.2 Test reference documents

[Reference documents used to explain the test process]

2.3 Test scope

[Respectively explain what tests are used for functional testing, automated testing, performance testing, and interface testing , and the specific test content]

3. Test resources

3.1 Software configuration

[Respectively explain the test environment and tools used in the process of functional testing, automated testing, performance testing, and interface testing]

test type

Test environment and tools

3.2 Hardware configuration

[Speaking about the relevant hardware configuration of the client and mobile terminal]

equipment item

quantity

configuration

client

mobile terminal

3.3 Human resource allocation

[Explain the role, responsibilities and final output of testers]

personnel

(station number)

Role

main duty

output

4. Test plan

4.1 Overall test schedule planning

[Explain the time and personnel arrangement of each test stage]

testing phase

Schedule

Staffing

4.2 Functional test plan

[Explain the goal, scope, technology, steps, start and end criteria of functional testing]

test target

Test Range

Application Technology

Steps

start criteria

Completion standard

4.3 Automated Test Plan

[Explain the goal, scope, technology, steps, start and end criteria of automated testing]

test target

Test Range

Application Technology

Steps

start criteria

Completion standard

4.4 Performance Test Plan

[Explain the objectives, scope, techniques, steps, start and end criteria of performance testing]

test target

Test Range

Application Technology

Steps

start criteria

Completion standard

4.5 Interface Test Plan

[Explain the objectives, scope, techniques, steps, start and end criteria of interface testing]

test target

Test Range

Application Technology

Steps

start criteria

Completion standard

5. Publishing Standards

【说明功能测试、性能测试、接口测试、文档的测试完毕可发布标准】

测试类型

发布标准

6. 相关风险

【说明测试过程中的假定风险以及如何应对】

风险类型

风险详述

应对措施

二、测试报告

1. 概述

1.1 项目背景

【说明测试项目的整体背景】

1.2 编写目的

【说明测试报告的编写目的】

2. 测试结果文档

【说明测试结果产出的文档】

3. 测试设计

3.1 功能测试方法设计介绍

【说明功能测试过程中所使用到的方法】

3.2 自动化测试方法设计介绍

【说明自动化测试过程中所使用到的方法】

3.3 性能测试方法设计介绍

【说明性能测试过程中所使用到的方法】

3.4 接口测试方法设计介绍

【说明接口测试过程中所使用到的方法】

4. 测试回顾

4.1 功能测试过程回顾

【说明功能测试的整体流程及结果】

4.2 自动化测试过程回顾

【说明自动化测试的整体流程及结果】

4.3 性能测试过程回顾

【说明性能测试的整体流程及结果】

4.4 接口测试过程回顾

【说明接口测试的整体流程及结果】

5. 用例汇总

【说明测试用例汇总统计情况】

设备端

功能模块

测试用例数

用例编写人

(工位号)

执行人

(工位号)

用例合计(个)

6. Bug汇总

【说明缺陷Bug汇总统计情况】

设备端

功能模块

Bug严重程度

Bug类型

严重

很高

合计

功能

UI

建议性

合计

合计(个)

7. 测试结论

【说明测试结果总结、过程问题统计、系统质量评价及团队经验教训】

任务 功能测试

一、测试用例

 

二、Bug清单

 

任务五 自动化测试

一、任务要求

题目1:按照以下步骤在PyCharm中进行自动化测试脚本编写并执行。

1. 设置智能时间等待5秒并将浏览器窗口最大化;

2. 引入By方法类;

3. 引入ActionChains方法类;

4. 通过ID属性定位用户名输入框,并输入用户名XTGLY;

5. 通过NAME属性定位密码输入框,并输入密码123456;

6. 定义变量login_button,通过TAG_NAME属性定位登录按钮;

7. 通过ActionChains方法点击登录按钮;

8. 通过ID定位商品管理页面的查询条件中的“请输入商品编号/名称查询”输入框并输入test001;

9. 通过ActionChains方法双击输入框中的“test001”;

10. 使用get_screenshot_as_file对页面进行截图操作(命名为test_ActionChains01.png,存放在D盘根目录下)。

题目2:按照以下步骤在PyCharm中进行自动化测试脚本编写并执行。

1. 搭建unittest框架;

2. 引入By方法类;

3. 定义setUp方法启动浏览器,增加3秒的智能等待,将浏览器窗口最大化;

4. 定义tearDown方法关闭浏览器;

5. 定义test_denglu01方法进入系统登录页面,通过NAME方法定位用户名输入框,通过CLASS_NAME方法复数形式定位密码输入框并输入账号和密码(XTGLY/123456),通过XPATH方法定位并点击登录按钮;

6. 定义test_denglu02方法进入系统登录页面,通过ID方法定位用户名输入框,通过CLASS_NAME方法定位密码输入框并输入账号和密码(XTGLY/123456),通过TAG_NAME定位登录按钮并点击,通过LINK_TEXT方法定位并点击“供应商信息”按钮,通过TAG_NAME方法复数形式定位并点击第一条信息的禁用按钮,使用dismiss方法关闭第一个警告弹窗;

7. 通过unittest.main()方法执行测试用例。

题目3:按照以下步骤在PyCharm中进行自动化测试脚本编写并执行。

测试数据:

商品单位名称

预期结果

商品单位名称必填,请重新输入。

步骤1:新建csv格式的测试数据testdata.csv,并编写csvv.py脚本读取csv中的测试数据。

步骤2:新建test01.py:

1. 引入步骤1中的写好的数据读取的方法以及ddt方法类;

2. 引入By方法类;

3. 搭建unittest框架;

4. 在setUp中打开谷歌浏览器,增加5秒的智能时间等待,将浏览器窗口最大化;

5. 在tearDown中退出浏览器;

6. 新建测试用例,通过NAME属性定位用户名输入框,并输入用户名XTGLY;

7. 通过CLASS_NAME属性定位密码输入框,并输入密码123456;

8. 查看登录页面中的登录按钮元素,通过ID方法定位登录按钮,使用click()方法点击登录按钮进入系统首页;

9. 通过LINK_TEXT方法进行定位,使用click()方法点击“商品单位”按钮;

10. 通过TAG_NAME的复数形式定位并点击“新增”按钮;

11. 通过CLASS_NAME方法定位商品单位名称输入框并使用数据驱动输入“商品单位名称”;

12. 通过XPATH方法定位并点击“保存”按钮;

13. 通过CLASS_NAME方法定位并获取提示信息文字,通过assertEqual断言方法来验证预期结果和实际结果是否一致,如果不一致使用get_screenshot_as_file对页面进行截图操作;

14. 通过unittest.main()方法执行测试用例。

题目4:按照以下步骤在PyCharm中进行自动化测试脚本编写并执行。

根据测试用例编写脚本:

 

1. 新建EPR_PO文件夹;

2. 在EPR_PO文件夹下新建driver文件夹和Website文件夹;

3. 在driver文件夹下新建driver.py文件存放浏览器驱动;

4. 在Website文件夹下新建test_case文件夹、test_report文件夹、test_data文件夹;

5. 在test_case文件夹下新建model文件夹和page_object文件夹;

6. 在model文件夹下新建function.py文件封装截图、数据驱动读取等方法;

7. 在model文件夹下新建myunit.py文件封装unittest框架中的Setup(添加5秒的智能等待和浏览器窗口最大化)和tearDown(退出浏览器)等方法;

8. 在test_report文件夹下新建BasePage.py文件封装selenium的基础操作类方法(get、find_element等);

9. 在test_report文件夹下新建LogingPage.py文件,引入BasePage.py中封装好的方法,引入By方法类,封装登录用例页面元素位置和操作(使用CLASS_NAME方法封装用户名输入框,使用NAME方法封装密码输入框、使用ID方法封装登录按钮位置,封装输入用户名、密码、点击登录按钮等操作);

10. 在test_report文件夹下新建AddPage.py文件,引入BasePage.py中封装好的方法,引入By方法类,封装好商品分类添加页面元素(使用PARTIAL_LINK_TEXT方法封装商品分类按钮,使用CSS方法封装新增按钮,使用XPATH方法封装商品分类名称输入框,使用CSS方法封装保存按钮,封装点击商品分类按钮、点击新增按钮、输入商品分类名称、点击保存按钮等操作),封装添加成功以及添加失败的提示信息文字;

11. 在test_report文件夹新建srceenshot文件夹存放测试截图;

12. 在test_data文件夹新建test_csv.csv文件存放测试数据;

13. 在test_report文件夹下新建test_add.py文件,引入unittest、ddt以及之前封装好的model,LoginPage,AddPage中的方法类,根据用例编写6条测试用例脚本,创建data参数来接收测试数据,并使用数据驱动输入用户名和密码(XTGLY/123456),使用数据驱动输入商品分类名称,然后进行截图操作,最后对每一条测试用例进行assertIn断言操作,对比提示信息是否和预期一致;

14. 在Website文件夹下新建run_test.py文件使用discover方法执行test_add.py测试用例并引入HTMLTestRunner方法生成html测试报告(测试报告title名为:Test Report,description内容为erp test)。

二、报告编写

根据自动化测试情况,参考自动化测试报告模版,按要求编写自动化测试脚本并将全部脚本粘贴到模板中,完成自动化测试报告。

任务六 性能测试

一、任务要求

题目1:使用LoadRunner执行性能测试。

1. 脚本录制:

(1)脚本一:

  • 脚本名称:SuppAdd。
  • 脚本内容:系统管理员登录、进行新增供应商操作。

具体要求如下:

  • 所有脚本存放在Action。供应商名称前4位为固定值GYMC,联系人前4位为固定值GLXR,固定值后面的字符可任意设置。对新增供应商保存操作设置事务,事务名称:T_SuppAdd。设置检查点,使用新增供应商成功,服务器响应正文内容中的code键值对作为检查点。在新增供应商保存操作前添加集合点,集合点名称:R_SuppAdd。

截图要求:一共1张图:①Action中新增供应商保存操作部分截图。

(2)脚本二:

  • 脚本名称:SaleAdd。
  • 脚本内容:销售专员登录、进行新增销售订单、保存并提交操作。

具体要求如下:

  • 所有脚本存放在Action。仓库、客户任意选择,商品任意选择一种即可。对销售订单保存并提交操作设置事务,事务名称:T_SaleAdd。设置检查点,使用提交操作成功,服务器响应正文内容中的code键值对作为检查点。在新增销售订单保存操作前添加集合点,集合点名称:R_SaleAdd。

截图要求:一共1张图:①Action中新增销售订单保存并提交操作部分截图。

2. 脚本回放:使用回放功能对脚本的正确性进行校验。

(1)脚本一脚本回放具体要求如下:

  • 对供应商名称进行修改,前4位为固定值GYHF,固定值后面的字符可任意设置。
  • 对联系人进行修改,前4位为固定值LXHF,固定值后面的字符可任意设置。
  • 运行脚本,查看回放结果,要求脚本回放能成功实现新增供应商业务。

(2)脚本二脚本回放具体要求如下:

  • 运行脚本,查看回放结果,要求脚本回放能成功实现新增销售订单保存并提交业务。
  • 保存并提交操作若需要关联,使用关联函数web_reg_save_param_ex(),参数名称submitId。

截图要求:一共1张图:①Action中新增销售订单保存并提交操作部分截图。

3. 脚本参数设置要求:脚本回放成功后按要求设置脚本参数。

(1)脚本一参数化具体要求如下:

  • 新建参数:参数名称:letter,参数类型:文件,参数值:26个英文字母大写,每次出现随机取值。
  • 新建参数:参数名称:VuID,参数类型:Vuser ID,文本格式:%03s。
  • 新建参数:参数名称:uniNo,参数类型:唯一编号,编号从1开始,每个Vuser的块大小为100,编号格式:%04d。
  • 对供应商名称进行参数化设置:供应商名称前4位固定值GYCS,固定值后面接2个随机大写字母、参数VuID和uniNo。
  • 对联系人进行参数化设置:联系人前3位固定值LXR,固定值后面接2个随机大写字母、参数VuID和uniNo。
  • 对联系电话进行参数化设置:只参数化联系电话的后8位,参数名称:phone,参数类型:随机数字,随机范围:1-9999,数字格式:%08lu,每次迭代更新。
  • 脚本迭代次数3次。

截图要求:一共1张图:①新增供应商保存操作和参数列表截图。

(2)脚本二参数化具体要求如下:

  • 新建参数化文件customer.dat,文件中包含customerId、customerName两个字段,customerId输系统预置的10条客户id值,customerName输入对应的客户名称值。
  • 对客户进行参数化设置:客户ID使用参数customerId,客户名称使用参数customerName,均使用customer.dat参数化文件。
  • customerId参数选择列使用按名称方式,每次迭代顺序取值。customerName参数选择列使用按名称方式,取值为customerId相同行。
  • 对销售数量进行参数化设置:参数名称:Amount,参数类型:随机数字,随机范围:500-1000,数字格式:%lu。
  • 对实际销售价进行参数化设置:参数名称:Price,参数类型:随机数字,随机范围:2000-3000,数字格式:%lu。
  • 脚本迭代次数3次。

截图要求:一共1张图:①新增销售订单保存并提交操作和参数列表截图。

4. 场景设置:按要求设置虚拟用户个数以及进行场景配置。

  • 脚本修改:新增供应商集合点前添加思考时间40秒,供应商名称前4位固定值修改为GYCJ。
  • 脚本修改:新增销售订单集合点前添加思考时间45秒。
  • 添加负载发生器(Load Generator):本机负载发生器名称localhost,另一电脑负载发生器名称otherlg。
  • 选择新增供应商和新增销售订单两个脚本进行场景设置。
  • 设置新增供应商脚本使用负载发生器localhost,新增销售订单使用负载发生器otherlg。
  • 用户分配选择用户组模式。场景计划方式选择用户组,运行模式选择实际计划。
  • 全局计划:
    1. 新增供应商:场景开始后立即启动组;在每个虚拟用户运行前将其初始化;启动20个用户(每2秒启动1个)执行5分钟,执行完成后停止所有用户(每2秒停止1个)。
    2. 新增销售订单:新增供应商执行完成后启动组;在每个虚拟用户运行前将其初始化;启动15个用户(每2秒启动1个)执行5分钟,执行完成后停止所有用户(每2秒停止1个)。
  • 添加性能计数器对服务器(CPU利用率,可用内存,硬盘)性能状况进行监测。

截图要求:一共2张图,分别为:①新增供应商场景设计界面截图;②新增销售订单场景设计界面截图。

5. 图形结果分析:场景执行完成后对测试结果进行截图操作。

  • 所有截图均需截取完整的结果图,包含下方的说明和左侧的树形结构。

截图要求:一共2张图:①Transaction Response Time (Percentile)截图。②windows Resources - RunningVusers截图。

题目2:使用JMeter执行性能测试。

1. 脚本添加:

  • 脚本文件名称:ProdAndPlan。
  • 测试计划名称:ProdAndPlan。

测试计划下添加两个线程组:

(1)线程组一:

  • 线程组名称:ProdAdd。
  • 线程组内容:系统管理员登录、进行新增商品操作。

具体要求如下:

  • 商品名称前2位为固定值SP,固定值后面的字符可任意设置。新增商品需要添加图片,图片自行准备。选择图片上传请求名称:图片上传;新增商品保存操作请求名称:新增商品保存。对新增商品保存操作设置事务,事务名称:T_SPAdd。设置检查点,使用新增商品成功服务器的响应正文内容作为检查点,检查点名称Reg_SPAdd。

截图要求:一共1张图:①新增商品保存操作截图。

(2)线程组二:

  • 线程组名称:PlanAdd。
  • 线程组内容:生产专员登录、进行新增生产计划单、保存并提交操作。

具体要求如下:

  • 计划生产耗材和计划生产制品新增一行即可,商品任意选择一种。生产计划单保存并提交操作请求名称:保存并提交。对生产计划单保存并提交操作设置事务,事务名称:T_PlanAdd。设置检查点,使用保存并提交操作成功服务器的响应正文内容作为检查点,检查点名称Reg_PlanAdd。在新增生产计划单保存并提交操作前添加集合点,集合点名称:R_PlanAdd。

截图要求:一共1张图:①新增生产计划单保存并提交操作截图。

2. 脚本回放:使用回放功能对脚本的正确性进行校验。

(1)线程组一回放具体要求如下:

  • 对商品名称进行修改,前4位为固定值SPHF,固定值后面的字符可任意设置。
  • 运行脚本,查看回放结果,要求脚本回放能成功实现新增商品业务。

(2)线程组二回放具体要求如下:

  • 运行脚本,查看回放结果,要求脚本回放能成功实现新增生产计划单保存并提交业务。

3. 脚本参数设置要求:脚本回放成功后按要求设置脚本参数。

(1)线程组一参数化具体要求如下:

  • 对商品名称进行参数化设置:商品名称前4位固定值SPCS,固定值后面接函数threadNum和RandomString,Random string长度:5,生成random string的字符:0123456789。
  • 对采购价进行参数化设置:使用Random函数实现参数化,范围:50-100。
  • 对销售价进行参数化设置:使用Random函数实现参数化,范围:200-300。
  • 对商品图片进行参数化:自行准备10张图片,使用CSV数据文件设置实现参数化,CSV数据文件命名:file.dat,参数名称:file。若需要关联,使用边界提取器,参数名称photo。
  • 脚本迭代次数3次。

截图要求:一共2张图,分别为:①图片上传操作截图;②新增商品保存操作截图。

(2)线程组二参数化具体要求如下:

  • 对计划耗材数量进行参数化设置:使用Random函数实现参数化,范围:500-1000。
  • 新建参数化文件center.dat,文件中包含centerId、centerCode、centerName三个字段,centerId输入系统预置的10条仓库id值,centerCode输入对应的仓库编号值,centerName输入对应的仓库名称值。
  • 对计划生产耗材仓库进行参数化设置:使用CSV数据文件设置实现参数化,使用center.dat文件。仓库ID参数名称centerId,仓库编号参数名称centerCode,仓库名称参数名称centerName。
  • 脚本迭代次数3次。

截图要求:一共1张图:①新增生产计划单保存并提交操作截图。

4. 场景设置:按要求设置虚拟用户个数以及进行场景配置。

  • 脚本修改:新增商品保存操作前添加思考时间25秒;新增生产计划单保存并提交操作前添加思考时间30秒;其他步骤添加思考时间5秒。
  • 新增生产计划单集合点设置:模拟数量:5,超时时间30秒。
  • 场景配置:
    1. 新增商品场景配置:取样器错误后执行动作:继续;线程数:15;Ramp-Up时间:15秒;循环5次。新增生产计划单场景运行完成后开始运行。
    2. 新增生产计划单场景配置:取样器错误后执行动作:继续;线程数:20;Ramp-Up时间:20秒;循环5次。
  • 使用非GUI模式运行。

截图要求:一共2张图,分别为:①测试计划截图;②新增商品场景配置截图。

5. 图形结果:分析场景执行完成后对测试结果进行截图操作。

截图要求:一共1张图:①Response Time Percentiles Over Time (successful responses)截图。

二、报告编写

根据性能测试情况,参考性能测试报告模版,按要求截取性能测试过程和结果截图并粘贴到性能测试报告,完成性能测试报告。

任务七 接口测试

一、任务要求

题目1:登录接口脚本编写和执行测试。

1. 登录接口描述如下:

接口功能:提供用户登录功能处理,根据传入的用户名和密码判断登录状态。

接口地址(根据实际系统IP及端口自行替换):

  • http://XX.XX.XX.XX:XXXX/prod-api/auth/login。

请求方式:POST。

请求参数:

参数

必填

类型

说明

username

Ture

Int

用户名

password

Ture

Int

用户密码

roleId

Ture

Int

登录ID(默认1)

响应结果:

  • 登录成功时返回:

{

    "code": 200,

    "msg": xxx,

    "data": {

        "access_token": "xxx",

        "name": xxx,

        "photo": "xxx",

        "expires_in": xxx

    };

  • 登录失败时返回(密码错误):

{

    "msg": "登录密码错误",

    "code": 500

}

  • 登录失败时返回(密码为空):

{

    "msg": "请输入密码",

    "code": 500

}

2. 接口测试要求说明:

  • 在Postman中新建Collections集,测试集命名为Data_Driver;
  • 在测试集Data_Driver下新建data_driver脚本;
  • 在脚本Body中的raw下新建json参数(username、password、roleId)进行传值,其中username、password参数改为变量接收数据驱动中的数据;
  • 新建josn文件保存接口数据驱动测试数据,josn参数名为username、password;用户名和密码数据为:
  • 新建测试用例集Data_Driver,执行Run,在测试集合运行页面设置执行要求,运行次数要求3次,请求间隔时间为500ms,发送请求的data文件导入前面的新建json数据文件;
  • 设置完成执行测试用例集;
  • 截图要求:一共6张图,分别为:①测试用例脚本包含URL和raw中参数相关内容截图;②测试用例集导入json数据后预览数据的截图;③Collection Runner页面的截图;④、⑤、⑥分别截图三条用例的测试报告中Response Body的全部内容。

username

password

XTGLY

123456

XTGLY

123

XTGLY

题目2:新增接口脚本编写和执行测试,并执行脚本。

1. 商品分类添加接口描述如下:

接口功能:提供商品分类新增处理。

接口地址(根据实际系统IP及端口自行替换):

  • http://XX.XX.XX.XX:XXXX/prod-api/manager/category/add。

请求方式:POST。

请求参数:

参数

必填

类型

说明

createBy

Ture

Int

添加id(默认2)

name

Ture

String

商品分类名称

响应结果:

{"msg": "操作成功","code": 200}

其余均失败。

2. 接口测试要求说明:

  • 在Postman中新建Collections集,测试集命名为Test_Add;
  • 在Test_Add中新建测试用例1,Login脚本;
  • Login脚本URL为:http://XX.XX.XX.XX:XXXX/prod-api/auth/login;
  • Login脚本Json参数为:{"username":"XTGLY","password":"123456","roleId":1};
  • 在Login脚本的Tests中编写代码,将Login接口返回值responseBody转为json字符串并将responseBody中的获取到的access_token的值使用setEnvironmentVariable方法存放到环境变量中,环境变量命名为token;
  • 在Test_Add中新建测试用例2,Add脚本;
  • 将Login中获取的变量token放在Add脚本Authorization界面下的Bearer Token中;
  • 在Environment中新建VARIABLE值为“token”,其他值为空的环境变量,方便用来调试Add脚本;
  • Add脚本URL为:http://XX.XX.XX.XX:XXXX/prod-api/manager/category/add;
  • Add脚本Json参数为:{"createBy":"2","name":"测试数据"};
  • 在Add脚本的Tests中对执行结果进行断言判断,设置两个断言:①判断响应状态码为200;②使用JSON value check方法判断响应内容中返回的msg参数值中存在“操作成功”字符串;
  • 设置执行测试集Test_Add;
  • 截图要求:一共4张图,分别为:①用例Add的Body界面截图,需要包含接口提交方式和URL以及raw中内容;②用例Add的Authorization界面截图,需要包含接口提交方式和Type以及Token中内容;③用例Add的Tests界面截图;④测试用例集Test_Add执行结果界面截图。

题目3:修改接口脚本编写和执行测试,并执行脚本。

1. 商品分类修改接口描述如下:

接口功能:提供商品分类修改处理。

接口地址(根据实际系统IP及端口自行替换):

  • http://XX.XX.XX.XX:XXXX/prod-api/manager/category/update。

请求方式:PUT。

请求参数:

参数

必填

类型

说明

id

Ture

Int

修改id

name

Ture

String

商品分类名称

响应结果:

{"msg": "操作成功","code": 200}

其余均失败。

2.接口测试要求说明:

  • 在Postman中新建Collections集,测试集命名为Test_Revise;
  • 在Test_Revise中新建测试用例1,Login脚本;
  • Login脚本URL为:http://XX.XX.XX.XX:XXXX/prod-api/auth/login;
  • Login脚本Json参数为:{"username":"XTGLY","password":"123456","roleId":1};
  • 在Login脚本的Tests中编写代码,将Login接口返回值responseBody转为json字符串并将responseBody中的获取到的access_token的值使用setEnvironmentVariable方法存放到环境变量中,环境变量命名为token;
  • 在Test_Revise中新建测试用例2,Revise脚本;
  • 将Login中获取的变量token放在Revise脚本Authorization界面下的Bearer Token中;
  • 在Environment中新建VARIABLE值为“token”,其他值为空的环境变量,方便用来调试Revise脚本;
  • Revise脚本URL为:http://XX.XX.XX.XX:XXXX/prod-api/manager/category/update;
  • Revise脚本Json参数为:{"id":"1","name":"测试"};
  • 在Revise脚本的Tests中对执行结果进行断言判断,设置两个断言:①判断响应状态码为200;②使用JSON value check方法判断响应内容中返回的msg参数值中存在“操作成功”字符串;
  • 设置执行测试集Test_Revise;
  • 截图要求:一共4张图,分别为:①用例Revise的Body界面截图,需要包含接口提交方式和URL以及raw中内容;②用例Revise的Authorization界面截图,需要包含接口提交方式和Type以及Token中内容;③用例Revise的Tests界面截图;④测试用例集Test_Revise执行结果界面截图。

二、报告编写

根据接口测试情况,参考接口测试报告模版,按要求截取接口测试脚本和结果截图并粘贴到接口测试报告中,完成接口测试报告。

Guess you like

Origin blog.csdn.net/weixin_57099902/article/details/131454633