WO2021003818A1 - 接口测试用例生成方法、装置、计算机设备及存储介质 - Google Patents

接口测试用例生成方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2021003818A1
WO2021003818A1 PCT/CN2019/103224 CN2019103224W WO2021003818A1 WO 2021003818 A1 WO2021003818 A1 WO 2021003818A1 CN 2019103224 W CN2019103224 W CN 2019103224W WO 2021003818 A1 WO2021003818 A1 WO 2021003818A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
test
monitoring
parameters
automation
Prior art date
Application number
PCT/CN2019/103224
Other languages
English (en)
French (fr)
Inventor
杨雨晨
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021003818A1 publication Critical patent/WO2021003818A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Definitions

  • This application relates to the technical field of test case generation, and in particular to a method, device, computer equipment, and storage medium for generating interface test cases.
  • Software testing is indispensable in the software development process. It is performed by testing tools in accordance with certain testing plans and procedures. Its purpose is to find defects lurking in the software, reduce software development and maintenance costs, and promote software quality improvement.
  • Automated testing is a process that transforms human-driven testing behavior into machine execution. Usually, after the test case is designed and passed the review, the tester executes the test step by step according to the procedures described in the test case, and compares the actual result with the expected result. In this process, in order to save manpower, time or hardware resources and improve test efficiency, the concept of automated testing was introduced.
  • Automated testing includes unit automated testing at the data processing layer, interface automated testing at the business logic layer, and UI (User Interface) automated testing at the GUI (Graphical User Interface) interface layer.
  • unit automated testing refers to Check and verify the smallest testable unit in the software
  • interface automation test refers to the test of the interface between the test system components, mainly checking the call and return between the verification modules and the data exchange between different systems and services
  • UI automatic test refers to the User interface testing, including user-friendliness, humanization, and ease of operation.
  • WEBDRIVER driver software in web pages
  • UI automation testing If you want to carry out the corresponding interface test, you must re-walk the process manually to manually capture the interface information and design the interface test cases, which leads to duplication of work and low efficiency.
  • the purpose of the embodiments of the present application is to propose a method, device, computer equipment, and storage medium for generating interface test cases, so as to solve the problems of repeated work and low efficiency caused by independent testing of UI automation tests in the prior art.
  • an embodiment of the present application provides a method for generating interface test cases, which adopts the following technical solutions:
  • the task information includes UI automation test information and monitoring interface parameters
  • An interface test case is generated according to the interface test case parameters.
  • an interface test case generation device including:
  • the calling module is used to call the UI automation test project according to the task information preset by the user, the task information includes UI automation test information and monitoring interface parameters;
  • the monitoring module is used for monitoring the interface corresponding to the monitoring interface parameter pre-configured in the task information in the UI automation test engineering test;
  • a data acquisition module configured to acquire monitoring data of the interface after the UI automation test project is completed
  • the parameter extraction module is configured to extract interface test case parameters from the monitoring data according to the interface test parameters in the monitoring interface parameters and the value range of the interface test parameters;
  • an embodiment of the present application further provides a computer device, including a memory and a processor.
  • the memory stores computer-readable instructions.
  • the processor executes the computer-readable instructions, The steps of the interface test case generation method.
  • the embodiments of the present application further provide one or more non-volatile readable storage media storing computer readable instructions, which when executed by a processor implement the interface test as described above Steps of the use case generation method.
  • Figure 1 is an exemplary system architecture diagram to which this application can be applied;
  • FIG. 3 is an example of a task list in the embodiment shown in FIG. 2;
  • Figure 5 is an example of a parameter value code configuration table
  • Fig. 6 is a schematic structural diagram of an embodiment of an interface test case generation device according to the present application.
  • the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105.
  • the network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105.
  • the network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables.
  • the user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages and so on.
  • Various communication client applications such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social platform software, can be installed on the terminal devices 101, 102, and 103.
  • the terminal devices 101, 102, 103 may be various electronic devices with display screens and support for web browsing, including but not limited to smart phones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic Video experts compress standard audio layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image experts compress standard audio layer 4) players, laptop portable computers and desktop computers, etc.
  • MP3 players Moving Picture Experts Group Audio Layer III, dynamic Video experts compress standard audio layer 3
  • MP4 Moving Picture Experts Group Audio Layer IV, dynamic image experts compress standard audio layer 4
  • laptop portable computers and desktop computers etc.
  • the server 105 may be a server that provides various services, for example, a background server that provides support for the pages displayed on the terminal devices 101, 102, and 103.
  • the interface test case generation method provided in the embodiments of the present application is generally executed by a terminal device, and accordingly, the interface test case generation device is generally set in the terminal device.
  • terminal devices, networks, and servers in FIG. 1 are merely illustrative. According to implementation needs, there can be any number of terminal devices, networks and servers.
  • the method for generating interface test cases includes the following steps:
  • Step 201 Invoke a UI automation test project according to task information preset by the user, the task information including UI automation test information and monitoring interface parameters.
  • the electronic device (such as the terminal device shown in FIG. 1) on which the interface test case generation method runs.
  • the above-mentioned wireless connection methods can include but are not limited to 3G/4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other currently known or future wireless connection methods .
  • the task execution information may include UI automation test information and monitoring interface parameters.
  • the UI automation test information includes the name, path, or method of calling the UI automation project (or script);
  • the monitoring interface parameters include: the interface address that needs to be monitored (such as packet capture domain name/ip path), interface parameter assignment, and Its assignment code, interface test parameter and value range of interface test parameter, etc.
  • Automated script path refers to the path of the called UI automation script
  • Automated script execution command refers to the command to call the UI automation script
  • Capture domain name/ip path refers to the address of the interface that needs to be monitored
  • Generate output path It means to generate text from the monitored data and output it to the specified address
  • Number of use cases It means that 5 test cases need to be generated for each tested interface.
  • UI automation test projects can use existing UI automation test tools (such as commonly used test tools WEBDRIVER or PWATIR), or write new UI automation projects.
  • WEBDRIVER commonly used test tools
  • PWATIR write new UI automation projects.
  • Step 202 In the UI automation test engineering test, monitor the interface corresponding to the listening interface parameter preconfigured in the task information.
  • the monitoring interface parameter includes the monitoring interface address
  • the step 202 includes: monitoring the request data of the interface corresponding to the interface address according to the monitoring interface address.
  • the request and response data of the corresponding interface can also be captured by the Fiddler tool.
  • Step 203 After the UI automation test project is completed, the monitoring data of the interface is obtained.
  • step 203 includes the following steps:
  • Step A Record the packet capture data for capturing the interface during the monitoring process.
  • Fiddler In actual applications, after Fiddler is started, the data captured by Fiddler will be recorded in the background. When the UI automation test is completed, the captured data will be exported as a text file.
  • Step C Read the text file from the specified path, obtain test parameters through analysis, and write the test parameter template.
  • the specific implementation of this step is: parsing the request and response parameters of the interface request and response content acquisition interface, and writing the acquired request and response parameters into the test parameter template.
  • Step D Read monitoring data from the test parameter template, and the monitoring data is the test parameter obtained by analysis.
  • the output directory can be customized.
  • the test parameters are written into a unified template and stored in order to facilitate classification and collection, and to screen subsequent test data.
  • Step 204 Extract interface test case parameters from the monitoring data according to the interface test parameters preset in the monitoring interface parameters and the value range of the interface test parameters.
  • the data certificate type ID card
  • the certificate number 123
  • a certificate type such as "passport” can be randomly selected, and then based on the passport
  • the rules randomly generate the ID number of the passport, that is, the passport is not the result of real packet capture, but the result of the expansion of the generated test case.
  • the method further includes:
  • a new interface test case is generated according to the new test interface use case parameters.
  • the generated test cases can be expanded without separate testing.
  • the interface test parameters ie, custom interface parameter assignment
  • the interface test parameters include: applno (request number), ID type (document type), ID numbe (document number).
  • the value range (assignment code) includes: Z (regular expression), DIY (custom), CER ID number/PAS passport number/SOL military ID number, etc.
  • the assignment code can be defined and searched through the pre-stored parameter value code configuration table, as shown in Figure 5.
  • the original request parameters for packet capture include: ⁇ "applno":"JK123",”ID type”:”ID card”,”ID number":"123456198001018888”,”salarybase”:"5000","city”: "Chengdu” ⁇ ;
  • the original response parameters of the packet capture include: ⁇ "applno":"JK123","successFlag”:"Successful distribution! ⁇ ;
  • the capture header includes: User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110Safari/537.36
  • Content-Type application/x-www-form-urlencoded.
  • the interface test case parameters that need to be extracted include applno (request number), ID type (certificate type), ID numbe (certificate number). Therefore, from the above packet capture parameters, the extracted test case parameters are as follows:
  • ID type "ID card”
  • Step 205 Generate an interface test case according to the extracted interface test case parameters.
  • the implementation method of this step is: writing the extracted interface test case parameters into a preset interface test case template.
  • the interface of the UI automation test is monitored, and the interface test cases can be obtained by filtering the monitoring data, which can reduce the overlap of UI automation and interface test automation. ; Efficient use of the existing mature UI automation test projects directly into interface test cases, greatly reducing the labor cost and time cost of constructing interface test cases.
  • the aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.
  • this application provides an embodiment of an interface test case generation device.
  • the device embodiment corresponds to the method embodiment shown in FIG. Specifically, it can be applied to various electronic devices.
  • the interface test case generation device 600 in this embodiment includes:
  • the calling module 601 is configured to call the UI automation test project according to the task information preset by the user, the task information includes UI automation test information and monitoring interface parameters;
  • the monitoring module 602 is used for monitoring the interface corresponding to the monitoring interface parameter pre-configured in the task information in the UI automation test engineering test;
  • the data acquisition module 603 is configured to acquire monitoring data of the interface after the UI automation test project is completed;
  • the parameter extraction module 604 is configured to extract interface test case parameters from the monitoring data according to the interface test parameters in the monitoring interface parameters and the value range of the interface test parameters;
  • the use case generation module 605 is configured to generate interface test cases according to the interface test case parameters.
  • the task execution information may include UI automation test information and monitoring interface parameters.
  • the UI automation test information includes the name, path, or method of calling the UI automation project (or script);
  • the monitoring interface parameters include: the interface address that needs to be monitored (such as packet capture domain name/ip path), interface parameter assignment, and Its assignment code, value range, etc.
  • Automation script path refers to the path of the UI automation script to be called
  • Automation script execution command refers to the command to call the UI automation script
  • Capture domain name/ip path indicates the address of the interface that needs to be monitored
  • Generate output path It means to generate text from the monitored data and output it to the specified address.
  • the UI automation test project can use the existing UI automation test tools (such as WEBDRIVER or PWATIR), or you can write a new UI automation project.
  • WEBDRIVER or PWATIR
  • the monitoring interface parameters include a monitoring interface address
  • the monitoring module 602 is further configured to monitor request data of the interface corresponding to the interface address according to the monitoring interface address.
  • the monitoring module 602 is further configured to capture the request and response data of the corresponding interface through the Fiddler tool.
  • Fiddler is an http protocol debugging proxy tool. It can record and check the http communication between the computer and the Internet, set breakpoints, and view all the data "in and out" Fiddler.
  • the data acquisition module 603 includes:
  • the data recording sub-module is used to record the packet capture data for capturing the interface during the monitoring process
  • the data export sub-module is used to export the captured packet data as a text file and store it in a designated storage path;
  • the parameter acquisition sub-module is used to read the text file from the specified path, acquire the test parameters through analysis and write the test parameter template;
  • the parameter reading sub-module is used to read monitoring data from the test parameter template, and the monitoring data is the test parameter obtained by analysis.
  • the parameter acquisition submodule is further used to parse the interface request and response content acquisition interface request and response parameters therein, and write the acquired request and response parameters into the test parameter template.
  • test parameters obtained by parsing may include: the detailed address of the request interface, header information, request method, request data, parameter return information and other necessary interface request parameter information.
  • the device 600 may also include a storage sub-module for reading the text file from the specified path by the parameter obtaining sub-module, and after the test parameters are obtained by parsing and written into the test parameter template, the test parameters The template is stored in the specified output directory.
  • the output directory can be customized.
  • the test parameters are written into a unified template and stored in order to facilitate classification and collection, and to screen subsequent test data.
  • test parameters obtained by the parameter obtaining submodule through analysis include at least one of the following parameters:
  • Required interface request parameter information such as the detailed address of the request interface, header information, request method, request data, and return parameter information.
  • the use case generation module 605 is further configured to write the extracted interface test case parameters into a preset interface test case template.
  • the interface test parameters ie, custom interface parameter assignment
  • the interface test parameters include: applno (request number), ID type (document type), ID numbe (document number).
  • the value range (assignment code) includes: Z (regular expression), DIY (custom), CER ID number/PAS passport number/SOL military ID number.
  • the assignment code can be defined and searched through the pre-stored parameter value code configuration table parameter value code configuration table.
  • the interface test case generation device of this embodiment monitors the interface of the UI automation test during the UI automation test. By filtering the monitoring data, the interface test case can be obtained, which can reduce both UI automation and interface test automation. Intersected repetitive work; efficient use of the existing mature UI automation test project directly into interface test cases, greatly reducing the labor cost and time cost of constructing interface test cases.
  • FIG. 7 is a block diagram of the basic structure of the computer device in this embodiment.
  • Its hardware includes but is not limited to microprocessors, dedicated Integrated Circuit (Application Specific Integrated Circuit, ASIC), Programmable Gate Array (Field-Programmable Gate Array, FPGA), Digital Processor (Digital Signal Processor, DSP), embedded devices, etc.
  • ASIC Application Specific Integrated Circuit
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • DSP Digital Processor
  • the processor 72 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments.
  • the processor 72 is generally used to control the overall operation of the computer device 7.
  • the processor 72 is configured to run the program code or process data stored in the memory 71, for example, run the program code of the interface test case generation method.
  • the network interface 73 may include a wireless network interface or a wired network interface, and the network interface 73 is generally used to establish a communication connection between the computer device 7 and other electronic devices.
  • This application also provides another implementation manner, that is, one or more non-volatile readable storage media storing computer readable instructions are provided, and the non-volatile readable storage medium stores an interface test case generation program
  • the interface test case generation program may be executed by at least one processor, so that the at least one processor executes the steps of the interface test case generation method described above.
  • the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better. ⁇
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to enable a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the method described in each embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

测试用例生成方法、装置、计算机设备及存储介质,涉及测试用例生成领域,所述方法包括:根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数(201);在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听(202);当所述UI自动化测试工程完成后,获取所述接口的监听数据(203);根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数(204);根据所述接口测试用例参数生成接口测试用例(205)。所述方法利用已有的UI自动化测试工程直接转化为接口测试用例,大幅减少构造接口测试用例的人力成本、时间成本。

Description

接口测试用例生成方法、装置、计算机设备及存储介质
【交叉引用】
本申请以2019年7月8日提交的申请号为201910611213.0,名称为“接口测试用例生成方法、装置、计算机设备及存储介质”的中国发明专利申请为基础,并要求其优先权。
【技术领域】
本申请涉及测试用例生成技术领域,尤其涉及一种接口测试用例生成方法、装置、计算机设备及存储介质。
【背景技术】
软件测试是软件开发过程中不可缺少的,其是由测试工具按照一定的测试方案和流程进行测试操作,其目的是发现潜伏在软件中的缺陷,减少软件开发和维护成本,促进软件质量提升。而自动化测试是把以人为驱动的测试行为转化为机器执行的一种过程。通常,在设计了测试用例并通过评审之后,由测试人员根据测试用例中描述的规程一步步执行测试,得到实际结果与期望结果的比较。在此过程中,为了节省人力、时间或硬件资源,提高测试效率,便引入了自动化测试的概念。
自动化测试包括数据处理层的单元自动化测试、业务逻辑层的接口自动化测试和GUI(Graphical User Interface,图形化界面)界面层的UI(User Interface,用户界面)自动化测试,其中:单元自动化测试是指对软件中最小的可测试单元进行检查和验证;接口自动化测试是指测试系统组件间接口的测试,主要检查验证模块间的调用返回以及不同系统、服务间的数据交换;UI自动测试是指对用户界面的测试,包括用户友好性、人性化、易操作性等测试。
现有技术中,不同的自动化测试之间都是独立进行的。例如,通常使用WEBDRIVER(网页内驱动软件)进行UI自动化测试,如果要开展相应的接口测试,则必须要重新人工走流程进行手工抓包提取接口信息,设计接口测试用例,这样导致了重复工作和效率低下。
【发明内容】
本申请实施例的目的在于提出一种接口测试用例生成方法、装置、计算机设备及存储介质,以解决现有技术对UI自动化测试进行独立测试导致的重复工作和效率低下的问题。
为了解决上述技术问题,本申请实施例提供一种接口测试用例生成方法,采用了如下所述的技术方案:
根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
当所述UI自动化测试工程完成后,获取所述接口的监听数据;
根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
根据所述接口测试用例参数生成接口测试用例。
为了解决上述技术问题,本申请实施例还提供一种接口测试用例生成装置,包括:
调用模块,用于根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
监听模块,用于在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
数据获取模块,用于在所述UI自动化测试工程完成后,获取所述接口的监听数据;
参数提取模块,用于根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
用例生成模块,用于根据所述接口测试用例参数生成接口测试用例。
为了解决上述技术问题,本申请实施例还提供一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现如上所述的接口测试用例生成方法的步骤。
为了解决上述技术问题,本申请实施例还提供一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被处理器执行时实现如 上所述的接口测试用例生成方法的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出,本申请的其他特征和优点将从说明书、附图以及权利要求变得明显。
【附图说明】
为了更清楚地说明本申请中的方案,下面将对本申请实施例描述中所需要使用的附图作一个简单介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请可以应用于其中的示例性系统架构图;
图2根据本申请的接口测试用例生成方法的一个实施例的流程图;
图3是图2所示实施例中的一个任务列表的举例;
图4是图2所示实施例中的一个参数值范围自定义数据表的举例;
图5是参数值代号配置表的举例;
图6是根据本申请的接口测试用例生成装置的一个实施例的结构示意图;
图7是根据本申请的计算机设备的一个实施例的结构示意图。
【具体实施方式】
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同;本文中在申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请;本申请的说明书和权利要求书及上述附图说明中的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。本申请的说明书和权利要求书或上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
为了使本技术领域的人员更好地理解本申请方案,下面将结合附图,对本申请实施例中的技术方案进行清楚、完整地描述。
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。
终端设备101、102、103可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、膝上型便携计算机和台式计算机等等。
服务器105可以是提供各种服务的服务器,例如对终端设备101、102、103上显示的页面提供支持的后台服务器。
需要说明的是,本申请实施例所提供的接口测试用例生成方法一般由终端设备执行,相应地,接口测试用例生成装置一般设置于终端设备中。
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。
继续参考图2,示出了根据本申请的接口测试用例生成方法的一个实施例的流程图。所述的接口测试用例生成方法,包括以下步骤:
步骤201,根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数。
在本实施例中,接口测试用例生成方法运行于其上的电子设备(例如图1所示的终端设备)。需要指出的是,上述无线连接方式可以包括但不限于3G/4G连接、WiFi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB(ultra wideband)连接、以及其他现在已知或将来开发的无线连接方式。
实际应用中,用户需要在任务表中建立任务信息,任务信息包括任务开始执行时间、任务执行信息等。任务执行信息可以包括UI自动化测试信息以及监听接口参数。其中,UI自动化测试信息包括调用UI自动化工程(或脚本)的名称、路径或者调用方法的信息等;监听接口参数包括:需要监控的接口地址(如抓包域名/ip路径)、接口参数赋值及其赋值代号、接口测试参数及接口测试参数的取值范围等。
一个任务列表举例如图3的任务列表所示。其中,设置的主要参数如下:
自动化脚本路径:指调用的UI自动化脚本的路径;
自动化脚本执行命令:指调用UI自动化脚本的命令;
抓包域名/ip路径:是指需要监听的接口的地址;
生成输出路径:是指将监听到的数据生成文本并输出到指定的地址;
用例数目:是指每个被测接口需要生成5个测试用例。
在本实施例中,步骤201根据用户预先设置的任务信息调用UI自动化测试工程,可以采用如下方法实现:
根据所述任务信息中的UI自动化工程的名称及路径调用对应的UI自动化测试工程。
实际应用中,UI自动化测试工程可以采用现有的UI自动化测试工具(如常用的测试工具WEBDRIVER或PWATIR),也可以编写新的UI自动化的工程。
步骤202,在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听。
本实施例中,监听接口参数包括监听接口地址,所述步骤202,包括:根据监听接口地址对所述接口地址对应的接口的请求数据进行监听。
实际应用中,如果在整个UI自动化运行过程中,只会在http://www.baidu.com的域名下执行,那么配置的接口地址就是http://www.baidu.com,就可以监控到所有的请求到这个域名前缀的接口地址,比如http://www.baidu.com/interface。
实际应用中,如果任务信息中未配置监听接口,将监听该工程执行时所有的接口。
本实施例中,还可以通过Fiddler工具对所述对应的接口的请求及响应数据进行抓包。
Fiddler是一个http协议调试代理工具,它能够记录并检查电脑和互联网之间的http通讯,设置断点,查看所有的“进出”Fiddler的数据。
实际应用中,可以在生成测试用例的开始时,先启动Fiddler的监听,然后马上启动WEBDRIVER工程,在WEBDRIVER工程的UI自动化的执行过程中会有一连串的接口调用执行,抓包结果将会由Fiddler来记录,再根据记录生成接口测试用例。
步骤203,当所述UI自动化测试工程完成后,获取所述接口的监听数据。本实施例中,步骤203包括如下步骤:
步骤A、在监听过程中记录对所述接口进行抓包的抓包数据。
步骤B、将所述抓包数据导出为文本文件并存储到指定的存储路径中。
实际应用中,在Fiddler启动后,后台会记录Fiddler抓包的数据,当UI自动化测试完成后,会将抓包数据导出为文本文件。
步骤C、从所述指定的路径读取所述文本文件,通过解析获取测试参数并写入测试参数模板。
本步骤的具体实现为:解析其中的接口请求与响应内容获取接口的请求及响应参数,并将获取的请求及响应参数写入测试参数模板。
实际应用中,通过解析获取测试参数可以包括:请求接口的详细地址,header信息、请求方式、请求数据、回参信息等必要的接口请求参数信息等。
步骤D、从测试参数模板中读取监听数据,该监听数据即为解析获取的测试参数。
本实施例中,步骤C之后,还包可以包括入戏步骤:
将测试参数模板存入指定的输出目录下。
实际应用各种,输出目录可以自定义,将测试参数写入统一模板并存储,是为了便于归类和收集,以及对后续测试数据的筛选。
步骤204、根据所述监听接口参数中预先设置的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数。
实际应用中,每次抓包出来的只是一个请求,比如证件类型=身份证,证件号=123,但是在自动生成的测试用例时,只有这一个“证件类型”,一个测试用例无法起到覆盖接口测试的要求。因此需要从生成的测试用例中要进行扩展生成更多的适用该接口的测试用例。例如,需要指定参数证件类型在“身份证”/ “护照”/“军官证”这些类型里随机选择,证件号则按身份证规则、护照规则、军官证规则去随机自动生成,以此产生更多的覆盖接口的测试用例。例如,在一次抓包时,获取的数据证件类型=身份证,证件号=123,那么可以在本次抓包生成的测试用例基础上,随机选择一个证件类型,如“护照”,然后根据护照规则随机生成护照的证件号,即该护照不是真实抓包的结果,而是根据已生成的测试用例扩展的结果。
因此,在本实施例中,若所述UI自动化测试工程中仅获得一个接口测试用例,在所述根据所述接口测试用例参数生成接口测试用例的步骤之后,所述方法还包括:
根据生成的接口测试用例以及预设的接口测试用例参数生成规则,生成新的测试接口用例参数;
根据所述新的测试接口用例参数生成新的接口测试用例。
通过上述方法,可以在实际获得的用例数量不足或偏少时,根据已生成的测试用例扩展,无需再单独测试。
请阅参图4,可以在图3的任务列表信息中加入生成接口测试用例的测试参数。由图4可以看出,需要提取的接口测试参数(即自定义接口参数赋值)包括:applno(请求编号),ID type(证件类型),ID numbe(证件号码)。取值范围(赋值代号)包括:Z(正则表达式),DIY(自定义),CER身份证号/PAS护照号/SOL军官证号等。
其中,赋值代号可通过预存的参数值代号配置表中进行定义及查找,如图5所示。
结合图3及图4,一个具体的抓包如下:
1、根据接口地址(http://www.baidu.com/webtest),获取抓包原始请求参数、抓包原始响应参数和抓包HEADER(头字段)。
具体的,抓包原始请求参数包括:{"applno":"JK123","ID type":"身份证","ID number":"123456198001018888","salarybase":"5000","city":"成都"};
抓包原始响应参数包括:{"applno":"JK123","successFlag":"发放成功!"};
抓包HEADER包括:User-Agent:Mozilla/5.0(Windows NT 6.1;WOW64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/49.0.2623.110Safari/537.36
Content-Type:application/x-www-form-urlencoded。
2、根据图4中需要提取的接口测试用例参数包括applno(请求编号),ID type(证件类型),ID numbe(证件号码),因此,从上述抓包参数中,提取的测试用例参数如下:
"applno":"JK456";
"ID type":"身份证";
"ID number":"511200198001018888"。
步骤205,根据提取的接口测试用例参数生成接口测试用例。
本实施例中,该步骤的实现方法是:将所述提取的接口测试用例参数写入预设的接口测试用例模板中。
实际应用中,可以在一个任务的任务信息实现多个接口的监听,此时只需要在任务信息中增加多个需要监听的接口的监听接口参数即可。如果需要多个接口之间的逻辑关系用例,可以在监听接口参数中写明接口之间的关系标识,然后在根据抓取的各接口的监听数据及关系标识,将有逻辑关系的接口的监听数据进行整合,生成逻辑关系测试用例。
在本实施例中,在进行UI自动化测试时,对UI自动化测试的接口进行监听,通过对监听数据的筛选,即可获得接口测试用例,能够减少UI自动化和接口测试自动化两者交集的重复工作;高效利用已有的成熟的UI自动化测试工程直接转化为接口测试用例,大幅减少构造接口测试用例的人力成本、时间成本。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,该计算机可读指令可存储于非易失性可读存储介质中,该程序在被执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执 行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
进一步参考图6,作为对上述图2所示方法的实现,本申请提供了一种接口测试用例生成装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。
如图6所示,本实施例所述的接口测试用例生成装置600包括:
调用模块601,用于根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
监听模块602,用于在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
数据获取模块603,用于在所述UI自动化测试工程完成后,获取所述接口的监听数据;
参数提取模块604,用于根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
用例生成模块605,用于根据所述接口测试用例参数生成接口测试用例。
实际应用中,用户需要在任务表中建立任务信息,任务信息包括任务开始执行时间、任务执行信息等。任务执行信息可以包括UI自动化测试信息以及监听接口参数。其中,UI自动化测试信息包括调用UI自动化工程(或脚本)的名称、路径或者调用方法的信息等;监听接口参数包括:需要监控的接口地址(如抓包域名/ip路径)、接口参数赋值及其赋值代号、取值范围等。
一个任务列表举例如图3的任务列表所示。其中,设置的主要参数如下:自动化脚本路径:指调用的UI自动化脚本的路径;自动化脚本执行命令:指调用UI自动化脚本的命令;抓包域名/ip路径:指出了需要监听的接口的地址;生成输出路径:指将监听到的数据生成文本并输出到指定的地址。
本实施例中,调用模块601,进一步用于根据所述任务信息中的UI自动化工程的名称及路径调用对应的UI自动化测试工程。
实际应用中,UI自动化测试工程可以采用现有的UI自动化测试工具(如WEBDRIVER或PWATIR),也可以编写新的UI自动化的工程。
本实施例中,所述监听接口参数包括监听接口地址,所述监听模块602,进一步用于根据监听接口地址对所述接口地址对应的接口的请求数据进行监听。
实际应用中,如果在整个UI自动化运行过程中,只会在http://www.baidu.com的域名下执行,那么配置的接口地址就是http://www.baidu.com,就可以监控到所有的请求到这个域名前缀的接口地址,比如http://www.baidu.com/interface。
实际应用中,如果任务信息中未配置监听接口,将监听该工程执行时所有的接口。
本实施例中,所述监听模块602,进一步用于通过Fiddler工具对所述对应的接口的请求及响应数据进行抓包。
Fiddler是一个http协议调试代理工具,它能够记录并检查电脑和互联网之间的http通讯,设置断点,查看所有的“进出”Fiddler的数据。
实际应用中,可以在生成测试用例的开始时,先启动Fiddler的监听,然后马上启动WEBDRIVER工程,在WEBDRIVER工程的UI自动化的执行过程中会有一连串的接口调用执行,抓包结果将会由Fiddler来记录,再根据记录生成接口测试用例。
本实施例中,所述当所述UI自动化测试工程完成后,所述数据获取模块603,包括:
数据记录子模块,用于在监听过程中记录对所述接口进行抓包的抓包数据;
数据导出子模块,用于将所述抓包数据导出为文本文件并存储到指定的存储路径中;
参数获取子模块,用于从所述指定的路径读取所述文本文件,通过解析获取测试参数并写入测试参数模板;
参数读取子模块,用于从所述测试参数模板中读取监听数据,该监听数据即为解析获取的测试参数。
本实施例中,参数获取子模块,进一步用于解析其中的接口请求与响应内容获取接口的请求及响应参数,并将获取的请求及响应参数写入测试参数模板。
实际应用中,通过解析获取测试参数可以包括:请求接口的详细地址,header信息、请求方式、请求数据、回参信息等必要的接口请求参数信息等。
实际应用中,该装置600还可以包括存储子模块,用于在参数获取子模块从所述指定的路径读取所述文本文件,通过解析获取测试参数并写入测试参数模板之后,将测试参数模板存入指定的输出目录下。
实际应用各种,输出目录可以自定义,将测试参数写入统一模板并存储,是为了便于归类和收集,以及对后续测试数据的筛选。
本实施例中,参数获取子模块通过解析获取的测试参数包括如下参数中的至少一种:
请求接口的详细地址、header信息、请求方式、请求数据及回参信息等必要的接口请求参数信息。
本实施例中,所述用例生成模块605,进一步用于将所述提取的接口测试用例参数写入预设的接口测试用例模板中。
实际应用中,每次抓包出来的只是一个请求,比如证件类型=身份证,证件号=123,但是在自动生成的测试用例时,只有这一个“证件类型”,一个测试用例无法起到覆盖接口测试的要求。因此需要从生成的测试用例中要进行扩展生成更多的适用该接口的测试用例。例如,需要指定参数证件类型在“身份证”/“护照”/“军官证”这些类型里随机选择,证件号则按身份证规则、护照规则、军官证规则去随机自动生成,以此产生更多的覆盖接口的测试用例。
请参图4,可以在任务列表信息中加入生成接口测试用例的测试参数。由图4可以看出,需要提取的接口测试参数(即自定义接口参数赋值)包括:applno(请求编号),ID type(证件类型),ID numbe(证件号码)。取值范围(赋值代号)包括:Z(正则表达式),DIY(自定义),CER身份证号/PAS护照号/SOL军官证号。
其中,赋值代号可通过预存的参数值代号配置表参数值代号配置表中进行定义及查找。
本实施例的接口测试用例生成装置,在进行UI自动化测试时,对UI自动化测试的接口进行监听,通过对监听数据的筛选,即可获得接口测试用例,能够减少UI自动化和接口测试自动化两者交集的重复工作;高效利用已有的成熟的UI自动化测试工程直接转化为接口测试用例,大幅减少构造接口测试用例的人力成本、时间成本。
为解决上述技术问题,本申请实施例还提供计算机设备。具体请参阅图6,图7为本实施例计算机设备基本结构框图。
所述计算机设备7包括通过系统总线相互通信连接存储器71、处理器72、网络接口73。需要指出的是,图中仅示出了具有组件71-73的计算机设备7,但 是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。其中,本技术领域技术人员可以理解,这里的计算机设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。
所述计算机设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述计算机设备可以与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互。
所述存储器71至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器71可以是所述计算机设备7的内部存储单元,例如该计算机设备7的硬盘或内存。在另一些实施例中,所述存储器71也可以是所述计算机设备7的外部存储设备,例如该计算机设备7上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器71还可以既包括所述计算机设备7的内部存储单元也包括其外部存储设备。本实施例中,所述存储器71通常用于存储安装于所述计算机设备7的操作系统和各类应用软件,例如接口测试用例生成方法的程序代码等。此外,所述存储器71还可以用于暂时地存储已经输出或者将要输出的各类数据。
所述处理器72在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器72通常用于控制所述计算机设备7的总体操作。本实施例中,所述处理器72用于运行所述存储器71中存储的程序代码或者处理数据,例如运行所述接口测试用例生成方法的程序代码。
所述网络接口73可包括无线网络接口或有线网络接口,该网络接口73通常用于在所述计算机设备7与其他电子设备之间建立通信连接。
本申请还提供了另一种实施方式,即提供一个或多个存储有计算机可读指令的非易失性可读存储介质,所述非易失性可读存储介质存储有接口测试用例生成程序,所述接口测试用例生成程序可被至少一个处理器执行,以使所述至少一个处理器执行如上述的接口测试用例生成方法的步骤。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
显然,以上所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例,附图中给出了本申请的较佳实施例,但并不限制本申请的专利范围。本申请可以以许多不同的形式来实现,相反地,提供这些实施例的目的是使对本申请的公开内容的理解更加透彻全面。尽管参照前述实施例对本申请进行了详细的说明,对于本领域的技术人员来而言,其依然可以对前述各具体实施方式所记载的技术方案进行修改,或者对其中部分技术特征进行等效替换。凡是利用本申请说明书及附图内容所做的等效结构,直接或间接运用在其他相关的技术领域,均同理在本申请专利保护范围之内。

Claims (20)

  1. 一种接口测试用例生成方法,其特征在于,包括下述步骤:
    根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
    在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
    当所述UI自动化测试工程完成后,获取所述接口的监听数据;
    根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
    根据所述接口测试用例参数生成接口测试用例。
  2. 根据权利要求1所述的接口测试用例生成方法,其特征在于,所述UI自动化测试信息包括调用UI自动化工程的名称、路径的信息,所述根据用户预先设置的任务信息调用UI自动化测试工程的步骤包括:
    根据所述UI自动化工程的名称及路径调用对应的UI自动化测试工程。
  3. 根据权利要求1所述的接口测试用例生成方法,其特征在于,所述监听接口参数包括监听接口地址,所述对所述任务信息中预先配置的监听接口参数对应的接口进行监听的步骤具体包括:
    根据监听接口地址对所述接口地址对应的接口的请求数据进行监听;
    通过Fiddler工具对所述对应的接口的请求及响应数据进行抓包。
  4. 根据权利要求1所述的接口测试用例生成方法,其特征在于,所述当所述UI自动化测试工程完成后,获取所述接口的监听数据的步骤具体包括:
    在监听过程中记录对所述接口进行抓包的抓包数据;
    将所述抓包数据导出为文本文件并存储到指定的存储路径中;
    从所述指定的路径读取所述文本文件;
    解析所述文本文件获取测试参数并写入测试参数模板;
    从所述测试参数模板中读取解析获取的测试参数,作为所述接口的监听数据。
  5. 根据权利要求4所述的接口测试用例生成方法,其特征在于,所述解析所述文本文件获取测试参数并写入测试参数模板的步骤具体包括:
    解析其中的接口请求与响应内容获取接口的请求及响应参数;
    将获取的请求及响应参数写入测试参数模板。
  6. 根据权利要求1所述的接口测试用例生成方法,其特征在于,若所述UI自动化测试工程中仅获得一个接口测试用例,在所述根据所述接口测试用例参数生成接口测试用例的步骤之后,所述方法还包括:
    根据生成的接口测试用例以及预设的接口测试用例参数生成规则,生成新的测试接口用例参数;
    根据所述新的测试接口用例参数生成新的接口测试用例。
  7. 根据权利要求1所述的接口测试用例生成方法,其特征在于,所述根据提取的接口测试用例参数生成接口测试用例的具体步骤包括:
    将所述提取的接口测试用例参数写入预设的接口测试用例模板中。
  8. 一种接口测试用例生成装置,其特征在于,包括:
    调用模块,用于根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
    监听模块,用于在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
    数据获取模块,用于在所述UI自动化测试工程完成后,获取所述接口的监听数据;
    参数提取模块,用于根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
    用例生成模块,用于根据所述接口测试用例参数生成接口测试用例。
  9. 根据权利要求8所述的接口测试用例生成装置,其特征在于,所述数据获取模块包括:
    数据记录子模块,用于在监听过程中记录对所述接口进行抓包的抓包数据;
    数据导出子模块,用于将所述抓包数据导出为文本文件并存储到指定的存储路径中;
    参数获取子模块,用于从所述指定的路径读取所述文本文件,通过解析获取测试参数并写入测试参数模板;
    参数读取子模块,用于从所述测试参数模板中读取监听数据,该监听数据即为解析获取的测试参数。
  10. 根据权利要求8所述的接口测试用例生成装置,其特征在于,所述接口测试用例生成装置还包括:
    存储子模块,用于在参数获取子模块从所述指定的路径读取所述文本文件,通过解析获取测试参数并写入测试参数模板之后,将测试参数模板存入指定的输出目录下。
  11. 一种计算机设备,其特征在于,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
    根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
    在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
    当所述UI自动化测试工程完成后,获取所述接口的监听数据;
    根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
    根据所述接口测试用例参数生成接口测试用例。
  12. 根据权利要求11所述的计算机设备,其特征在于,所述UI自动化测试信息包括调用UI自动化工程的名称、路径的信息,所述根据用户预先设置的任务信息调用UI自动化测试工程的步骤包括:
    根据所述UI自动化工程的名称及路径调用对应的UI自动化测试工程。
  13. 根据权利要求11所述的计算机设备,其特征在于,所述监听接口参数包括监听接口地址,所述对所述任务信息中预先配置的监听接口参数对应的接口进行监听的步骤具体包括:
    根据监听接口地址对所述接口地址对应的接口的请求数据进行监听;
    通过Fiddler工具对所述对应的接口的请求及响应数据进行抓包。
  14. 根据权利要求11所述的计算机设备,其特征在于,所述当所述UI自动化测试工程完成后,获取所述接口的监听数据的步骤具体包括:
    在监听过程中记录对所述接口进行抓包的抓包数据;
    将所述抓包数据导出为文本文件并存储到指定的存储路径中;
    从所述指定的路径读取所述文本文件;
    解析所述文本文件获取测试参数并写入测试参数模板;
    从所述测试参数模板中读取解析获取的测试参数,作为所述接口的监听数据。
  15. 根据权利要求14所述的计算机设备,其特征在于,所述解析所述文本文件获取测试参数并写入测试参数模板的步骤具体包括:
    解析其中的接口请求与响应内容获取接口的请求及响应参数;
    将获取的请求及响应参数写入测试参数模板。
  16. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:
    根据用户预先设置的任务信息调用UI自动化测试工程,所述任务信息包括UI自动化测试信息以及监听接口参数;
    在UI自动化测试工程测试中,对所述任务信息中预先配置的监听接口参数对应的接口进行监听;
    当所述UI自动化测试工程完成后,获取所述接口的监听数据;
    根据所述监听接口参数中的接口测试参数及所述接口测试参数的取值范围从所述监听数据中提取接口测试用例参数;
    根据所述接口测试用例参数生成接口测试用例。
  17. 根据权利要求16所述的非易失性可读存储介质,其特征在于,所述UI自动化测试信息包括调用UI自动化工程的名称、路径的信息,所述根据用户预先设置的任务信息调用UI自动化测试工程的步骤包括:
    根据所述UI自动化工程的名称及路径调用对应的UI自动化测试工程。
  18. 根据权利要求16所述的非易失性可读存储介质,其特征在于,所述监听接口参数包括监听接口地址,所述对所述任务信息中预先配置的监听接口参数对应的接口进行监听的步骤具体包括:
    根据监听接口地址对所述接口地址对应的接口的请求数据进行监听;
    通过Fiddler工具对所述对应的接口的请求及响应数据进行抓包。
  19. 根据权利要求16所述的非易失性可读存储介质,其特征在于,所述当所述UI自动化测试工程完成后,获取所述接口的监听数据的步骤具体包括:
    在监听过程中记录对所述接口进行抓包的抓包数据;
    将所述抓包数据导出为文本文件并存储到指定的存储路径中;
    从所述指定的路径读取所述文本文件;
    解析所述文本文件获取测试参数并写入测试参数模板;
    从所述测试参数模板中读取解析获取的测试参数,作为所述接口的监听数据。
  20. 根据权利要求19所述的非易失性可读存储介质,其特征在于,所述解析所述文本文件获取测试参数并写入测试参数模板的步骤具体包括:
    解析其中的接口请求与响应内容获取接口的请求及响应参数;
    将获取的请求及响应参数写入测试参数模板。
PCT/CN2019/103224 2019-07-08 2019-08-29 接口测试用例生成方法、装置、计算机设备及存储介质 WO2021003818A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910611213.0 2019-07-08
CN201910611213.0A CN110532169A (zh) 2019-07-08 2019-07-08 接口测试用例生成方法、装置、计算机设备及存储介质

Publications (1)

Publication Number Publication Date
WO2021003818A1 true WO2021003818A1 (zh) 2021-01-14

Family

ID=68659562

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103224 WO2021003818A1 (zh) 2019-07-08 2019-08-29 接口测试用例生成方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN110532169A (zh)
WO (1) WO2021003818A1 (zh)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835808A (zh) * 2021-03-12 2021-05-25 中国平安财产保险股份有限公司 接口测试方法、装置、计算机设备及存储介质
CN113010425A (zh) * 2021-03-18 2021-06-22 中国平安人寿保险股份有限公司 系统质量监测方法、装置、计算机设备及存储介质
CN113505054A (zh) * 2021-04-08 2021-10-15 中国航空无线电电子研究所 一种无人机控制站的网络数据静态测试系统和测试方法
CN113535223A (zh) * 2021-07-19 2021-10-22 长鑫存储技术有限公司 测试流程的配置方法、装置、存储介质及设备
CN113704095A (zh) * 2021-08-08 2021-11-26 中国航空工业集团公司沈阳飞机设计研究所 一种接口自动测试用例自动生成方法及装置
CN113746840A (zh) * 2021-09-03 2021-12-03 中国银行股份有限公司 Json格式报文生成方法及装置
CN114490202A (zh) * 2021-12-21 2022-05-13 北京密码云芯科技有限公司 一种密码设备测试方法、装置、电子设备及存储介质
CN114584500A (zh) * 2022-02-25 2022-06-03 网易(杭州)网络有限公司 异步通信的测试方法、装置及电子设备
CN115225551A (zh) * 2022-07-14 2022-10-21 北京邮电大学 一种模糊测试方法、装置、设备及存储介质
CN115883431A (zh) * 2022-11-29 2023-03-31 重庆长安汽车股份有限公司 一种终端通讯协议性能测试系统、方法、车辆及存储介质
CN115967797A (zh) * 2022-11-30 2023-04-14 海南视联通信技术有限公司 产品测试方法、装置、电子设备及存储介质
CN117130941A (zh) * 2023-10-24 2023-11-28 易方信息科技股份有限公司 基于浏览器插件的接口自动化方法、系统、设备及介质
CN115883431B (zh) * 2022-11-29 2024-06-04 重庆长安汽车股份有限公司 一种终端通讯协议性能测试系统、方法、车辆及存储介质

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127327A (zh) * 2019-12-31 2021-07-16 深圳云天励飞技术有限公司 一种用于性能测试的测试方法及装置
CN111522728A (zh) * 2019-12-31 2020-08-11 支付宝实验室(新加坡)有限公司 自动化测试用例的生成方法、电子设备及可读存储介质
CN111274153A (zh) * 2020-02-14 2020-06-12 香港乐蜜有限公司 一种自动化测试方法、装置及电子设备
CN111858109A (zh) * 2020-07-22 2020-10-30 中国第一汽车股份有限公司 互斥逻辑的验证方法、装置、设备及存储介质
CN112181836A (zh) * 2020-09-30 2021-01-05 中国平安财产保险股份有限公司 测试用例生成方法、系统、设备及存储介质
CN113138929A (zh) * 2021-05-12 2021-07-20 平安国际智慧城市科技股份有限公司 分布式接口测试方法、装置、电子设备及存储介质
CN113407450B (zh) * 2021-06-22 2024-03-15 平安国际智慧城市科技股份有限公司 基于参数自动识别的接口测试方法、装置、设备及介质
CN113434395B (zh) * 2021-06-22 2024-04-30 中国平安人寿保险股份有限公司 测试用例的自动化生成方法、装置、设备及介质
CN113342689A (zh) * 2021-07-01 2021-09-03 中诚信征信有限公司 一种接口的自动化测试方法、装置、电子设备及存储介质
CN113505068A (zh) * 2021-07-09 2021-10-15 杭州遥望网络科技有限公司 一种http接口自动化测试方法、装置、设备及存储介质
CN113778895A (zh) * 2021-09-18 2021-12-10 上海中通吉网络技术有限公司 接口自动化测试方法及装置
CN114356785B (zh) * 2022-03-11 2022-05-20 中航信移动科技有限公司 一种数据处理方法、装置、电子设备及存储介质
CN114721970B (zh) * 2022-06-08 2022-10-04 易方信息科技股份有限公司 建设接口自动化测试及精准测试的方法及装置
CN114880242B (zh) * 2022-06-08 2023-01-13 北京百度网讯科技有限公司 测试用例的提取方法、装置、设备和介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107894952A (zh) * 2017-11-08 2018-04-10 中国平安人寿保险股份有限公司 接口测试用例的生成方法、装置、设备及可读存储介质
US20180107588A1 (en) * 2015-01-22 2018-04-19 Accenture Global Services Limited Test case generation system
CN108415832A (zh) * 2018-02-07 2018-08-17 平安科技(深圳)有限公司 接口自动化测试方法、装置、设备及存储介质
CN109062788A (zh) * 2018-07-17 2018-12-21 招银云创(深圳)信息技术有限公司 测试用例生成方法、装置、计算机设备和存储介质
CN109408398A (zh) * 2018-11-13 2019-03-01 郑州云海信息技术有限公司 一种接口自动化测试装置及方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10248552B2 (en) * 2016-07-20 2019-04-02 International Business Machines Corporation Generating test scripts for testing a network-based application
CN106951368A (zh) * 2017-03-12 2017-07-14 北京工业大学 基于uml时序图的测试用例自动生成方法
US20190196944A1 (en) * 2017-12-22 2019-06-27 International Business Machines Corporation System for writing and executing unit test cases
CN108984388B (zh) * 2018-06-01 2023-10-27 平安壹钱包电子商务有限公司 一种生成自动化测试用例的方法及终端设备
CN109828903B (zh) * 2018-12-14 2022-03-08 中国平安人寿保险股份有限公司 自动化测试方法、装置、计算机装置及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180107588A1 (en) * 2015-01-22 2018-04-19 Accenture Global Services Limited Test case generation system
CN107894952A (zh) * 2017-11-08 2018-04-10 中国平安人寿保险股份有限公司 接口测试用例的生成方法、装置、设备及可读存储介质
CN108415832A (zh) * 2018-02-07 2018-08-17 平安科技(深圳)有限公司 接口自动化测试方法、装置、设备及存储介质
CN109062788A (zh) * 2018-07-17 2018-12-21 招银云创(深圳)信息技术有限公司 测试用例生成方法、装置、计算机设备和存储介质
CN109408398A (zh) * 2018-11-13 2019-03-01 郑州云海信息技术有限公司 一种接口自动化测试装置及方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ANONYMOUS: "How to record calls to an interface during selenium automation tests", 28 March 2017 (2017-03-28), pages 1 - 8, XP055772637, Retrieved from the Internet <URL:https://www.cnblogs.com/hhudaqiang/p/6635494.html> *

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835808A (zh) * 2021-03-12 2021-05-25 中国平安财产保险股份有限公司 接口测试方法、装置、计算机设备及存储介质
CN113010425A (zh) * 2021-03-18 2021-06-22 中国平安人寿保险股份有限公司 系统质量监测方法、装置、计算机设备及存储介质
CN113010425B (zh) * 2021-03-18 2024-04-02 中国平安人寿保险股份有限公司 系统质量监测方法、装置、计算机设备及存储介质
CN113505054A (zh) * 2021-04-08 2021-10-15 中国航空无线电电子研究所 一种无人机控制站的网络数据静态测试系统和测试方法
CN113505054B (zh) * 2021-04-08 2023-12-12 中国航空无线电电子研究所 一种无人机控制站的网络数据静态测试系统和测试方法
CN113535223A (zh) * 2021-07-19 2021-10-22 长鑫存储技术有限公司 测试流程的配置方法、装置、存储介质及设备
CN113535223B (zh) * 2021-07-19 2023-10-24 长鑫存储技术有限公司 测试流程的配置方法、装置、存储介质及设备
CN113704095A (zh) * 2021-08-08 2021-11-26 中国航空工业集团公司沈阳飞机设计研究所 一种接口自动测试用例自动生成方法及装置
CN113746840A (zh) * 2021-09-03 2021-12-03 中国银行股份有限公司 Json格式报文生成方法及装置
CN114490202B (zh) * 2021-12-21 2023-06-23 北京密码云芯科技有限公司 一种密码设备测试方法、装置、电子设备及存储介质
CN114490202A (zh) * 2021-12-21 2022-05-13 北京密码云芯科技有限公司 一种密码设备测试方法、装置、电子设备及存储介质
CN114584500B (zh) * 2022-02-25 2024-03-22 网易(杭州)网络有限公司 异步通信的测试方法、装置及电子设备
CN114584500A (zh) * 2022-02-25 2022-06-03 网易(杭州)网络有限公司 异步通信的测试方法、装置及电子设备
CN115225551A (zh) * 2022-07-14 2022-10-21 北京邮电大学 一种模糊测试方法、装置、设备及存储介质
CN115225551B (zh) * 2022-07-14 2024-03-29 北京邮电大学 一种模糊测试方法、装置、设备及存储介质
CN115883431A (zh) * 2022-11-29 2023-03-31 重庆长安汽车股份有限公司 一种终端通讯协议性能测试系统、方法、车辆及存储介质
CN115883431B (zh) * 2022-11-29 2024-06-04 重庆长安汽车股份有限公司 一种终端通讯协议性能测试系统、方法、车辆及存储介质
CN115967797A (zh) * 2022-11-30 2023-04-14 海南视联通信技术有限公司 产品测试方法、装置、电子设备及存储介质
CN117130941A (zh) * 2023-10-24 2023-11-28 易方信息科技股份有限公司 基于浏览器插件的接口自动化方法、系统、设备及介质
CN117130941B (zh) * 2023-10-24 2024-03-26 易方信息科技股份有限公司 基于浏览器插件的接口自动化方法、系统、设备及介质

Also Published As

Publication number Publication date
CN110532169A (zh) 2019-12-03

Similar Documents

Publication Publication Date Title
WO2021003818A1 (zh) 接口测试用例生成方法、装置、计算机设备及存储介质
WO2020233053A1 (zh) 一种制作测试页面脚本的方法、装置、设备及存储介质
WO2018120721A1 (zh) 用户界面的测试方法、系统、电子装置及计算机可读存储介质
US8478800B1 (en) Log streaming facilities for computing applications
CN111782492B (zh) 页面首屏加载时长测试方法、装置、计算机设备及介质
CN110798445B (zh) 公共网关接口测试方法、装置、计算机设备及存储介质
CN111552633A (zh) 接口的异常调用测试方法、装置、计算机设备及存储介质
CN108600311B (zh) 客户端模拟接口数据的方法及装置
WO2021169275A1 (zh) Sdn 网络设备访问方法、装置、计算机设备及存储介质
CN110908837B (zh) 应用程序异常处理方法、装置、电子设备及存储介质
CN110808868B (zh) 测试数据获取方法、装置、计算机设备及存储介质
WO2020232883A1 (zh) 脚本缺陷扫描方法、装置、计算机设备和存储介质
CN114610963A (zh) 定制数据展示方法、系统、计算机设备及存储介质
CN114598687B (zh) 一种https数据包的抓取方法、系统及终端
CN115794437A (zh) 微服务的调用方法、装置、计算机设备及存储介质
WO2020077681A1 (zh) 一种延迟加载js脚本的方法和装置
WO2021151314A1 (zh) Dns自动化性能测试方法、装置、设备及可读存储介质
CN117033249A (zh) 一种测试用例生成方法、装置、计算机设备及存储介质
CN114531345A (zh) 流量比对结果存储方法、装置、设备及存储介质
CN111399972B (zh) 一种虚拟机抓包的方法、装置及计算机可读存储介质
CN110881030A (zh) 基于logstash的记录web服务管理员操作日志的方法及装置
CN111651330B (zh) 数据采集方法、装置、电子设备和计算机可读存储介质
CN109995607B (zh) 流量开销的测试方法、终端、服务器和计算机存储介质
CN109324822B (zh) Pwa项目检测方法、计算机可读存储介质及终端设备
CN113468050A (zh) 基于画布的测试方法、装置、计算机设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19936998

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19936998

Country of ref document: EP

Kind code of ref document: A1