WO2020155777A1 - Ui自动化功能测试方法、测试装置、测试设备及存储介质 - Google Patents

Ui自动化功能测试方法、测试装置、测试设备及存储介质 Download PDF

Info

Publication number
WO2020155777A1
WO2020155777A1 PCT/CN2019/118683 CN2019118683W WO2020155777A1 WO 2020155777 A1 WO2020155777 A1 WO 2020155777A1 CN 2019118683 W CN2019118683 W CN 2019118683W WO 2020155777 A1 WO2020155777 A1 WO 2020155777A1
Authority
WO
WIPO (PCT)
Prior art keywords
jump
test
interface
interface node
node
Prior art date
Application number
PCT/CN2019/118683
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 WO2020155777A1 publication Critical patent/WO2020155777A1/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

Definitions

  • the invention relates to the technical field of UI function testing, in particular to a UI automated function testing method, testing device, testing equipment and storage medium.
  • UI interface (including APP interface or webpage or wearable device) is an important platform for network information exchange. Because of the diversity and uncertainty of the content and functions it carries, it needs to be designed according to different application requirements and network environments In order to ensure the reliability of the interface performance, it is also necessary to test the designed user interface.
  • the user interface automation test is actually to automatically verify the input and output of the tested user interface, that is, to simulate the user's input and interface button controls to click and jump to verify the output result of the input operation.
  • the prior art lacks a UI automation function test method that can effectively discover user interface defects.
  • the present invention provides a UI automated function test method, test device, test equipment, and storage medium, which use the user interface jump process and configured parameters to automatically generate test code for testing the user interface , And generate a clear test report, the technical solution is as follows:
  • the present invention provides a UI automation function testing method, including the following steps:
  • jump information of the user interface to be tested includes the interface node before the jump, the jump element, and the interface node after the jump;
  • the topology flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface node;
  • test code includes a program that performs a user interface jump operation on each jump element
  • the method further includes obtaining an assertion setting result before or after obtaining the topology flowchart, the assertion setting result being an expected value set for the display element in the interface node before the jump or the interface node after the jump;
  • Generating the test code includes: referencing the program of the assertion operation after jumping to the interface node before or after the jump corresponding to the set expected value.
  • the method further includes obtaining an initialization parameter configuration result after obtaining the topology flow chart, the initialization parameter configuration result including the test start interface node and its URL, and the initialization parameter configuration result is used to implement the test code generation
  • the parameter initialization includes: initializing the traversal start node as the test start interface node, and the test start interface node may correspond to any jump element on any branch path in the topology flowchart The interface node before the jump.
  • the initialization parameter configuration result further includes a test interface depth, and the configuration value of the test interface depth is greater than or equal to the longest depth value of the flowchart starting from the configured test start interface node.
  • the method further includes obtaining an input parameter configuration result before or after obtaining the topology flowchart, the input parameter configuration result including the input required to realize the interface node before the jump to the corresponding interface node after the jump parameter;
  • Generating the test code includes: assigning the above-mentioned input parameter configuration result to the program of the input parameter element at the interface node before the jump.
  • steps of establishing the topology flowchart include the following operations:
  • the first jump element and the second jump element are set to be on the same branch path. Adjacent jump elements.
  • topology flowchart can be moved, copied, cut and/or pasted.
  • the step of running the test code in the test run environment includes a local run mode and/or a cloud run mode
  • the local run mode includes: downloading the test code from the cloud to a local computer, and Run the test code in the test software in the computer to obtain the test result;
  • the cloud operation mode includes: sending a running request to the cloud, the running request including the user interface to be tested; obtaining the corresponding test code according to the running request; receiving the running request based on the running request in the cloud test software. Describe the test results obtained by the test code.
  • test result includes a test report in the form of video, picture, and/or text.
  • the test report may also include a test failure case description, and the test failure case includes interface jump errors and/or assertion judgments. The wrong situation.
  • process information and data information in each test case obtained by running the test code in the test running environment are associated and stored separately.
  • the present invention provides a UI automation function test device, including the following modules:
  • the jump information acquisition module is used to acquire jump information of the user interface to be tested, where the jump information includes interface nodes before the jump, jump elements, and interface nodes after the jump;
  • the flow chart acquisition module is used to acquire a topological flow chart established according to the jump information.
  • the topological flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element And the corresponding interface node after the jump;
  • the code generation module is used to perform a deep traversal of the topology flow chart, and generate corresponding test code according to each complete branch path from the traversal start node backward, and the test code includes executing a user interface for each jump element Jump operation program;
  • the code running module is used to run the test code in the test running environment to obtain the test result.
  • the present invention provides a UI automation function test device, including a processor and a memory, the memory stores a program, and is characterized in that, when the processor executes the program, the following operations are performed:
  • jump information of the user interface to be tested includes the interface node before the jump, the jump element, and the interface node after the jump;
  • the topology flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface node;
  • test code includes a program that performs a user interface jump operation on each jump element
  • the present invention provides a storage medium for storing a program, and the program performs the following operations when executed:
  • jump information of the user interface to be tested includes the interface node before the jump, the jump element, and the interface node after the jump;
  • the topology flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface node;
  • test code includes a program that performs a user interface jump operation on each jump element
  • the test report is comprehensive and accurate.
  • the report format includes text, picture and/or video format.
  • the test process is highly traceable and the test results are clear at a glance.
  • Figure 1 is a flowchart of a UI automation function testing method provided by an embodiment of the present invention
  • Fig. 2 is a schematic diagram of a topology flowchart provided by an embodiment of the present invention.
  • FIG. 3 is a flowchart of a UI automation function test method with parameter configuration and assertion added according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of modules of a UI automation function testing device provided by an embodiment of the present invention.
  • Figure 5 is a screenshot of the application interface of the actual topology flowchart provided by the embodiment of the present invention.
  • Fig. 6 is a screenshot of the application interface of the test report provided by the embodiment of the present invention.
  • a UI automation function testing method is provided. See FIG. 1, including the following processes:
  • the present invention applies to protect the technology related to UI (User Interface) testing.
  • the interface generally refers to the user's operation interface, including mobile APP, webpage, WeChat applet, WeChat official account, PC application, industrial control software and other interfaces, hereinafter referred to as interface.
  • the jump information includes the interface node before the jump, the jump element, and the interface node after the jump.
  • the interface node before the jump there are multiple control buttons on the interface node before the jump, and pressing the control button can jump to In the latter interface node, take the homepage interface of Ctrip as an example, and the jump elements are hotels and air tickets as examples.
  • the topology flowchart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface node.
  • the specific establishment process is as follows:
  • the first jump element and the second jump element are set to be on the same branch path.
  • Adjacent jump elements such as the above six jump information in Ctrip as an example, can be established to get the topology flow chart shown in Figure 2.
  • the naming of the jump elements in the figure is only for illustration, and the actual object to be tested is The name of the underlying control shall prevail, as shown in Figure 5.
  • the process of using the code engine to generate test code is actually the process of the code engine traversing the topology flowchart: in the traversal process, when a jump element is detected, the control name is obtained to perform the click jump operation. It can be implemented using the click(id) function, where id is the name of the control corresponding to the jump element, and the finally generated test code includes a program that performs a user interface jump operation on each jump element.
  • test code is put into the test running environment in the form of a template that meets the running conditions, and the test code is run to obtain the test result.
  • operation methods include but are not limited to the following two methods:
  • Cloud operation mode Send a running request to the cloud, the running request includes the user interface to be tested; according to the running request, the cloud server obtains the test code corresponding to the user interface to be tested, and puts the test code in Project template to make it meet the operating requirements of the cloud test environment, for example, copy the test code to a folder at a specified address, and call the source configuration file of the user interface to be tested, according to the source configuration file,
  • the parameters in the project template are automatically filled, and the filled project template including the test code can be put into the cloud test software to run, and the test code is obtained by running the test code in the cloud test software based on the run request. Test results;
  • Local running mode download the test code from the cloud to the local computer, and run the test code in the test software in the computer. Before running the test code, it is also necessary to configure the project and its configuration The method is consistent with the operation of putting the test code into the project template in the cloud operation mode. The difference is that the cloud operation mode is automatically completed by the cloud server, while the local operation mode is completed by the operating user. For convenience, While downloading the test code in the cloud, it also downloads the project template, source configuration file, and operating instructions. The project configuration can be completed according to the operating instructions, put into the local test environment for operation, and the test results are obtained. It should be noted that if the carrier of the interface is a mobile terminal, the mobile terminal needs to be connected to the local computer first.
  • test software includes but is not limited to IntelliJ Idea and Android Studio, wherein the Android Studio is used to test the interface in the Android system, and the IntelliJ Idea can be used to test the Android, iOS system, Web or PC interface.
  • the initialization parameter configuration result includes the test start interface node and its URL.
  • the initialization parameter configuration result is used to initialize the parameters when the test code is generated, including: traversing the The start node is initialized as the test start interface node, and the test start interface node can be the interface node before jump corresponding to any jump element on any branch path in the topology flowchart, see Out, the traversal start node can be the root interface node of the topology flowchart, or it can be a certain (not the last) interface node in the middle of the topology flowchart, and each complete branch path from the traversal start node back, Including traversing to the last interface node, in an embodiment of the present invention, the topological flow chart is a process tree structure (one-way).
  • two interfaces in the topological flow chart Nodes can jump in both directions.
  • the ticket booking interface in Figure 2 jumps to the ticket query result interface through the search jump element, and then jumps to the ticket booking interface through the back jump element.
  • the ticket booking interface is When traversing the starting node, the interface node flow under the complete traversal path is the ticket booking interface ⁇ the ticket query result interface ⁇ the ticket booking interface ⁇ the ticket query interface ⁇ the order placing interface ⁇ the payment interface.
  • the URL of the starting interface node is the ticket booking The URL of the interface.
  • the traversal start node can select any node in the middle of the process, so that when a new function needs to be tested, there is no need to retest from the beginning, but only the interface node with the new function added as the traversal start node , Effectively improve test efficiency.
  • the automated test system in the prior art cannot achieve partial testing of only added new functions, resulting in low automated testing efficiency and lengthy testing process.
  • the initialization parameter configuration result also includes the test interface depth, and the configuration value of the test interface depth is greater than or equal to the longest depth value of the flow chart starting from the configured test start interface node , Where the depth configuration value is equal to the longest depth value of the flow chart starting from the configured test start interface node, which can ensure that each branch path process starting from the test start interface node can be traversed completely;
  • the branch paths For example, in the loan app, there are both the loan business process interface and the repayment business process interface. There is interaction between the loan business and the repayment business, for example, it should be loan first and then repayment. Therefore, If you want to test the interactive function between two branch paths, you need to set the interface depth to the sum of the depth values of the two branch processes.
  • step S3 The following describes the input parameter configuration before generating the corresponding test code in step S3:
  • the input parameter configuration result is obtained before or after obtaining the topology flowchart, and the input parameter configuration result includes the parameters that need to be input to realize the interface node before the jump to the corresponding interface node after the jump, such as in the ticket booking interface
  • the input parameters that need to be configured include departure place, destination, date, and can also include filter conditions, such as time period, airline, fare range, etc., for example, in the ticket query result interface, you need to set the selection item information, such as select Click the second ticket information to enter the order placement interface.
  • filter conditions such as time period, airline, fare range, etc.
  • the code engine puts the user's input parameter settings in an appropriate position, that is, assigns the above input parameter configuration results to the input parameters at the interface node before the jump Elements in order to complete the jump to the next interface.
  • step S3 The following describes the assertion configuration before generating the corresponding test code in step S3:
  • the assertion setting is performed before or after the topology flowchart is obtained, and the assertion setting result is the expected value set for the display element in the interface node before the jump or the interface node after the jump;
  • the input parameter is Beijing to Shanghai, then the displayed ticket query result entry is that the departure city should be Beijing, and the destination city should be Shanghai.
  • the ticket query result will be retrieved from the background
  • the list table of the interface according to the list table configuration, the first column of the list is the departure city information, the second column is the destination city, the assertion judgment inserted in the code is to judge whether the value of the first column of the list table is equal to "Beijing", Whether the second column value is equal to "Shanghai".
  • the test result includes a test report in text form, and the test report includes test failure case descriptions, such as interface jump errors and/or assertion judgment errors, see Figure 6, and the Tests entry column on the left corresponds to testCase004ab1
  • the fail mark, click it, and the specific failure details appear on the right.
  • the test report can also be combined with a video or picture.
  • the specific implementation can be on a mobile terminal or a local computer or Start the screen recording tool in the cloud operating environment to get a video test report, or use the screen capture tool to save a screenshot of the current interface when the assertion fails to form a picture test report.
  • part or all of the topological flow chart can be moved, copied, cut and/or pasted, which provides greater convenience when establishing a topological flow chart and reduces repetitive work .
  • process information and data information in each test case obtained by running the test code in the test operation environment are associated and stored separately, and effectively displayed on the product. Because the process and data are stored in different folders, the organization is clear, and the tester is clear at a glance. Whether it involves viewing or modifying the process or data, the work efficiency of the tester can be significantly improved.
  • a UI automation function testing method which includes the following steps:
  • the jump information includes the interface node before the jump, the jump element and the interface node after the jump, and the middle item of each jump information is the UI interaction button;
  • the topology flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface Nodes include: different jump elements corresponding to the same pre-jump interface node form different branch paths, and/or based on the post-jump interface node corresponding to the first jump element being the pre-jump corresponding to the second jump element In the case of interface nodes, the first jump element and the second jump element are set as adjacent jump elements on the same branch path;
  • the initialization parameter configuration result includes the test start interface node, URL, and the test interface depth.
  • the initialization parameter configuration result is used to initialize the parameters when generating the test code, including: starting the traversal
  • the node is initialized as the test start interface node, and the test start interface node is the pre-jump interface node corresponding to any jump element on any branch path in the topology flowchart, the topology flowchart
  • the two interface nodes can jump in both directions; the configuration value of the test interface depth is greater than or equal to the longest depth value of the flowchart starting from the configured test start interface node, where the depth configuration value is equal to the configured test start
  • the code engine is used to deeply traverse the topological flowchart, and the corresponding test code is generated according to each complete branch path from the traversal starting node to the back. During the traversal process, when a jump element is detected, it is obtained The name of the control to perform a click to jump operation, and the test code includes a program that performs a user interface jump operation on each jump element;
  • test code in the test run environment in the form of a template that meets the operating conditions, run the test code to obtain the test result, and run the test code in the following two ways:
  • Cloud operation mode Send a running request to the cloud, the running request includes the user interface to be tested; according to the running request, the cloud server obtains the test code corresponding to the user interface to be tested, and puts the test code in Project template to make it meet the operating requirements of the cloud test environment, for example, copy the test code to a folder at a specified address, and call the source configuration file of the user interface to be tested, according to the source configuration file,
  • the parameters in the project template are automatically filled, and the filled project template including the test code can be put into the cloud test software to run, and the test code is obtained by running the test code in the cloud test software based on the run request. Test results;
  • Local running mode download the test code from the cloud to the local computer, and run the test code in the test software in the computer.
  • the operating user completes the placing of the test code In the operation of entering the project template, while downloading the test code in the cloud, it also downloads the project template, source configuration file and operating instructions, completes the project configuration according to the operating instructions, puts it in the local test environment for operation, and obtains the test result; if
  • the carrier of the interface is a mobile terminal, and the mobile terminal needs to be connected to the local computer first.
  • a UI automation function test device is provided.
  • the device includes the following modules:
  • the jump information acquisition module is used to acquire jump information of the user interface to be tested, where the jump information includes interface nodes before the jump, jump elements, and interface nodes after the jump;
  • the flow chart acquisition module is used to acquire a topological flow chart established according to the jump information.
  • the topological flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element And the corresponding interface node after the jump;
  • the code generation module is used to perform a deep traversal of the topology flow chart, and generate corresponding test code according to each complete branch path from the traversal start node backward, and the test code includes executing a user interface for each jump element Jump operation program;
  • the code running module is used to run the test code in the test running environment to obtain the test result.
  • the testing process of the UI automation function test module is as follows:
  • the jump information module obtains the jump information of each functional area according to the functional area of the user interface to be tested, and jumps the interface node before the jump to the post jump During the interface node process, the information that needs to be filled in the interface node before the jump is preset as input parameters, and the assertion setting is set on the interface node after the jump; then a topology flowchart is established according to the jump information, Then select a node in the topological flow chart as the test start interface node, initialize its URL and test depth value; then traverse the flow chart and automatically generate code.
  • the essence of automatic code generation is to use the code engine to traverse to the interface node.
  • the assertion judgment will be performed. If there is an assertion setting, the assertion judgment will be performed. If there is no assertion setting, the input parameters of the current interface node will be added to the code. After completing the input parameters, click the jump operation according to the id name of the jump node to enter the next interface and then Perform the above operations until you jump to the last interface node on the branch path (complete the corresponding assertion judgment, if the interface has an assertion setting).
  • the UI automation function test device provided in the above embodiment performs UI automation function testing
  • only the division of the above-mentioned functional modules is used as an example for illustration.
  • the above-mentioned functions can be assigned to different functions as required.
  • the function module is completed, that is, the internal structure of the UI automated function test device is divided into different function modules to complete all or part of the functions described above.
  • the UI automation function testing device embodiment provided in this embodiment belongs to the same concept as the UI automation function testing method provided in the above-mentioned embodiments. For the specific implementation process, please refer to the method embodiment, which will not be repeated here.
  • a UI automation function test device including a processor and a memory, the memory stores a program, and when the processor executes the program, the following operations are performed:
  • jump information of the user interface to be tested includes the interface node before the jump, the jump element, and the interface node after the jump;
  • the topology flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface node;
  • test code includes a program that performs a user interface jump operation on each jump element
  • a storage medium for storing a program, and the program performs the following operations when executed:
  • jump information of the user interface to be tested includes the interface node before the jump, the jump element, and the interface node after the jump;
  • the topology flow chart includes a root interface node and one or more branch paths, and each branch path has at least one jump element and a corresponding post-jump interface node;
  • test code includes a program that performs a user interface jump operation on each jump element

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自动化功能测试方法、测试装置、测试设备及存储介质,测试方法包括:获取待测试用户界面的跳转信息(S1),跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;获取根据跳转信息建立得到的拓扑流程图(S2),拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;对拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条分支路径生成与其对应的测试代码(S3),测试代码包括对各个跳转元素执行用户界面跳转操作的程序;在测试环境中运行所述测试代码,得到测试结果(S4)。

Description

UI自动化功能测试方法、测试装置、测试设备及存储介质 技术领域
本发明涉及UI功能测试技术领域,特别涉及一种UI自动化功能测试方法、测试装置、测试设备及存储介质。
背景技术
UI界面(包括APP界面或网页或可穿戴设备)是网络信息交流的重要平台,由于它承载的内容和功能具有多样性和不确定性的特点,就需要根据不同的应用需求和网络环境设计它的内容,为保证界面性能的可靠性,也需要对设计后的用户界面进行测试。
目前大多数的软件开发公司基本上使用人工测试方式,有软件测试工程师编写测试用例,然后手工对用户界面进行测试,效率低,并且容易遗漏测试用例,且无法对测试过程进行有效追溯。
基于此,用户界面功能的自动化测试技术的开发显得尤为迫切。用户界面自动化测试实则是对被测试用户界面的输入、输出进行自动化验证,即模拟用户的输入和界面按钮控件点击跳转动作,验证输入操作的输出结果。现有技术中缺乏有效发现用户界面缺陷的UI自动化功能测试方法。
发明内容
为了解决现有技术的问题,本发明提供了一种UI自动化功能测试方法、测试装置、测试设备及存储介质,利用用户界面跳转流程及配置的参数自动生成用于测试该用户界面的测试代码,并生成一目了然的测试报告,所述技术方案如下:
一方面,本发明提供了一种UI自动化功能测试方法,包括以下步骤:
获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
在测试运行环境中运行所述测试代码,得到测试结果。
进一步地,所述方法还包括在获取拓扑流程图之前或之后获取断言设置结果,所述断言设置结果为对所述跳转前界面节点或跳转后界面节点中的显示元素设置的预期值;
生成测试代码包括:在跳转到对应于设置有预期值的跳转前界面节点或跳转后界面节点后引用断言操作的程序。
进一步地,所述方法还包括在获取拓扑流程图之后获取初始化参数配置结果,所述初始化参数配置结果包括测试起始界面节点及其URL,所述初始化参数配置结果用于在生成测试代码时实现参数初始化,包括:将所述遍历起始节点初始化为所述测试起始界面节点,所述测试起始界面节点可以为所述拓扑流程图中任意一个分支路径上的任意一个跳转元素所对应的跳转前界面节点。
进一步地,所述初始化参数配置结果还包括测试界面深度,所述测试界面深度的配置值大于或等于以配置的测试起始界面节点为起点的流程图最长深度值。
进一步地,所述方法还包括在获取拓扑流程图之前或之后获取输入参数配置结果,所述输入参数配置结果包括为实现跳转前界面节点跳转到相应的跳转后界面节点所需输入的参数;
生成测试代码包括:将上述输入参数配置结果赋值给相应跳转前界面节点处的输入参数元素的程序。
进一步地,所述拓扑流程图的建立步骤包括以下操作:
对应于同一跳转前界面节点的不同跳转元素形成不同的分支路径,和/或
基于第一跳转元素对应的跳转后界面节点为第二跳转元素对应的跳转前界面节点的情况,将所述第一跳转元素、第二跳转元素设为同一分支路径上的相 邻跳转元素。
进一步地,所述拓扑流程图的局部或全部能够进行移动、复制、剪切和/或粘贴操作。
可选地,所述在测试运行环境中运行所述测试代码的步骤包括本地运行方式和/或云端运行方式,所述本地运行方式包括:从云端下载所述测试代码到本地计算机中,并在所述计算机中的测试软件中运行所述测试代码,得到测试结果;
所述云端运行方式包括:向云端发送运行请求,所述运行请求中包括待测试用户界面;根据所述运行请求,获取对应的测试代码;接收基于所述运行请求在云端的测试软件中运行所述测试代码得到的测试结果。
进一步地,所述测试结果包括视频、图片、和/或文字形式的测试报告,所述测试报告中或者还包括测试失败例情况说明,所述测试失败例包括界面跳转错误和/或断言判断错误的情况。
进一步地,将所述在测试运行环境中运行所述测试代码得到的每一条测试用例中的流程信息与数据信息关联并分离存储。
另一方面,本发明提供了一种UI自动化功能测试装置,包括以下模块:
跳转信息获取模块,用于获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
流程图获取模块,用于获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
代码生成模块,用于对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
代码运行模块,用于在测试运行环境中运行所述测试代码,得到测试结果。
再一方面,本发明提供了一种UI自动化功能测试设备,包括处理器以及存储器,所述存储器中存储有程序,其特征在于,在所述处理器执行所述程序时,进行以下操作:
获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳 转元素及跳转后界面节点;
获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
在测试运行环境中运行所述测试代码,得到测试结果。
再一方面,本发明提供了一种存储介质,用于存储程序,所述程序在被执行时进行以下操作:
获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
在测试运行环境中运行所述测试代码,得到测试结果。
本发明提供的技术方案带来的有益效果如下:
a.拓扑流程图加强了对测试软件的语义支持;
b.利用代码自动生成引擎自动生成测试代码;
c.将测试用例中的流程和数据分离存储,并在产品上有效展示出来,提高测试人员的使用便捷性;
d.能够对计算机网页、移动终端网页、移动终端App、微信小程序、微信公众号,PC应用程序,工控软件等界面进行自动化测试,应用范围广泛;
e.测试报告全面准确,报告形式包括文字、图片和/或视频格式,测试过程可追溯性强,测试结果一目了然。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的UI自动化功能测试方法的流程图;
图2是本发明实施例提供的拓扑流程图的示意图;
图3是本发明实施例提供的加入参数配置和断言的UI自动化功能测试方法流程图;
图4是本发明实施例提供的UI自动化功能测试装置的模块示意图;
图5是本发明实施例提供的实际拓扑流程图的应用界面截图;
图6是本发明实施例提供的测试报告的应用界面截图。
具体实施方式
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、装置、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本发明的一个实施例中,提供了一种UI自动化功能测试方法,参见图1,包括以下流程:
S1、获取待测试用户界面的跳转信息。
本发明申请保护关于UI(User Interface,用户界面)测试的技术,界面泛指用户的操作界面,包含移动APP、网页、微信小程序、微信公众号、PC应用程序、工控软件等界面,以下简称界面。
具体地,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点,比如:在跳转前界面节点上设有多个控件按钮,按下该控件按钮可跳转到后一界面节点,以携程网首页界面为例,跳转元素以酒店和机票为例,则分别得到订酒店界面和订机票界面;在订酒店界面输入查询条件(日期、地址或酒店类型等等),搜索得到酒店查询结果界面,在订机票界面输入查询条件(起飞城市、终点城市、日期等),搜索得到机票查询结果界面,然后选择其中一条结果条目,进入下订单界面,在下订单界面点击付款按钮,进入支付界面等等,则这里至少出现了以下跳转信息:①首页-“hotel”-订酒店界面,②首页-“air-ticket”-订机票界面,③订酒店界面-“search”-酒店查询结果界面,④订机票界面-“search”-机票查询结果界面,⑤机票查询结果界面-“term1”-下订单界面,⑥下订单界面-“pay”-支付界面,每一个跳转信息的中间项为跳转元素(即交互按钮),实际上以界面交互按钮的控件名称命名,跳转元素前后的界面节点优选以简单明了的原则自由命名。
S2、获取根据所述跳转信息建立得到的拓扑流程图。
具体地,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点,其具体的建立过程如下:
对应于同一跳转前界面节点的不同跳转元素形成不同的分支路径,
基于第一跳转元素对应的跳转后界面节点为第二跳转元素对应的跳转前界面节点的情况,将所述第一跳转元素、第二跳转元素设为同一分支路径上的相邻跳转元素,比如以上述携程中的六个跳转信息为例,可以建立得到如图2所示的拓扑流程图,图中跳转元素的命名仅为示意,实际以待测试对象的底层控件名称为准,如图5所示。
S3、对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码。
具体地,利用代码引擎生成测试代码的过程实际上是代码引擎遍历拓扑流程图的过程:在遍历的过程中,当检测到跳转元素时,获取其控件名称,以执行点击跳转操作,具体可利用click(id)函数实现,其中id即为跳转元素对应的控件名称,最后生成的所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序。
S4、在测试运行环境中运行所述测试代码,得到测试结果。
将测试代码以符合运行条件的模板形式放入测试运行环境中,运行所述测试代码,得到测试结果。运行的方式包括但不限于以下两种方式:
云端运行方式:向云端发送运行请求,所述运行请求中包括待测试用户界面;云端服务器根据所述运行请求,获取与所述待测试用户界面对应的测试代码,并将所述测试代码放入项目模版,使其符合云端测试环境的运行要求,比如,将所述测试代码拷贝到指定地址的文件夹下,并调用所述待测试用户界面的源配置文件,根据所述源配置文件,将所述项目模板中的参数进行自动填充,完成填充后的包括有测试代码的项目模版可以放入云端的测试软件中运行,接收基于所述运行请求在云端的测试软件中运行所述测试代码得到的测试结果;
本地运行方式:从云端下载所述测试代码到本地计算机中,并在所述计算机中的测试软件中运行所述测试代码,在运行所述测试代码之前,同样需要对其进行项目配置,其配置的方式与云端运行方式中将所述测试代码放入项目模版的操作一致,不同之处在于,云端运行方式中是由云端服务器自动完成,而本地运行方式由操作用户完成,为了方便完成,在云端下载测试代码的同时,还一并下载项目模板、源配置文件及操作说明,可根据所述操作说明完成项目配置,放入本地测试环境进行运行,得到测试结果。需要说明的是,若界面的载体为移动终端,则需要先将所述移动终端与本地计算机连接。
其中,所述测试软件包括但不限于IntelliJ Idea,Android Studio,其中,所述Android Studio用于测试安卓系统内的界面,所述IntelliJ Idea可以用于测试安卓、iOS系统、Web或PC界面。
对于大部分需要测试的用户界面来说,在自动生成代码之前还需要配置好初始化参数、输入参数及断言条件,方法流程如图3所示,下面对步骤S3中生成对应的测试代码之前的参数初始化进行说明:
在获取拓扑流程图之后进行初始化参数配置,所述初始化参数配置结果包括测试起始界面节点及其URL,所述初始化参数配置结果用于在生成测试代码时实现参数初始化,包括:将所述遍历起始节点初始化为所述测试起始界面节点,所述测试起始界面节点可以为所述拓扑流程图中任意一个分支路径上的任意一个跳转元素所对应的跳转前界面节点,可以看出,所述遍历起始节点可以为拓扑流程图的根界面节点,也可以是拓扑流程图中中间某一个(不是最后一个)界面节点,自遍历起始节点向后的每一条完整分支路径,包括遍历到最后一个界面节点,在本发明的一个实施例中,所述拓扑流程图为流程树结构(单向),在本发明的一个优选实施例中,所述拓扑流程图中两个界面节点可以双向跳转,比如图2中订机票界面通过search跳转元素跳转至机票查询结果界面,然后通过back跳转元素跳转到订机票界面,在这种情况下,以订机票界面为遍历起始节点的话,完整的遍历路径下的界面节点流程为订机票界面→机票查询结果界面→订机票界面→机票查询界面→下订单界面→支付界面,起始界面节点的URL即为订机票界面的网址。所述遍历起始节点可以选择流程中间的任意一个节点,这样使得当增加了一种新功能需要测试的时候,无需从头开始重新测,而仅需从增加新功能的界面节点作为遍历起始节点,有效提高测试效率。现有技术中的自动化测试系统无法实现仅针对增加的新功能进行局部测试,导致自动化测试效率低下,测试过程冗长。
除了测试起始界面节点及其URL,所述初始化参数配置结果还包括测试界面深度,所述测试界面深度的配置值大于或等于以配置的测试起始界面节点为起点的流程图最长深度值,其中,深度配置值等于以配置的测试起始界面节点为起点的流程图最长深度值,可以确保能够完整地遍历以测试起始界面节点起起点的每一个分支路径流程;若多个所述分支路径之间具有交互,比如贷款App中,既有贷款业务流程界面,又有还款业务流程界面,贷款业务和还款业务之间有交互,比如应当是先贷款后还款,因此,若要测试两条分支路径之间的交互功能,则需要设置界面深度为两条分支流程的深度值之和。
下面对步骤S3中生成对应的测试代码之前的输入参数配置进行说明:
在获取拓扑流程图之前或之后获取输入参数配置结果,所述输入参数配置结果包括为实现跳转前界面节点跳转到相应的跳转后界面节点所需输入的参 数,比如在订机票界面,需要配置的输入参数包括起飞地、目的地、日期,还可以包括筛选条件,比如,时间段、航空公司、票价范围等等,再比如在机票查询结果界面,需要设置选择条目信息,比如选择第二条机票信息点击后进入下订单界面。当然,对于有些界面,不一定需要输入参数,比如新闻app或者网页,可采取随机点击新闻标题而进入下一界面。通过预先设置的各个界面对应的输入参数,在生成测试代码过程中,代码引擎将用户的输入参数设置放在合适的位置,即将上述输入参数配置结果赋值给相应跳转前界面节点处的输入参数元素以便于完成到下一界面的跳转。
下面对步骤S3中生成对应的测试代码之前的断言配置进行说明:
在获取拓扑流程图之前或之后进行断言设置,所述断言设置结果为对所述跳转前界面节点或跳转后界面节点中的显示元素设置的预期值;在生成代码过程中,对于预设有断言配置的某一界面节点,在跳转到该界面节点后,引用断言操作,比如利用assert(实际值==期待值)进行断言判断,比如对于机票查询结果界面,如果在订机票界面中输入的参数为北京到上海,那么显示的机票查询结果条目中都是起飞城市均应当为北京,目的城市均应为上海,则在自动生成测试代码过程中,则会从后台调取机票查询结果界面的list表,根据list表配置可知,列表第一列为起飞城市信息,第二列为目的城市,代码中插入的断言判断则为判断list表的第一列值是否等于“北京”,第二列值是否等于“上海”。
所述测试结果包括文字形式的测试报告,所述测试报告中包括测试失败例情况说明,比如界面跳转错误和/或断言判断错误的情况,参见图6,左侧Tests条目栏中比如testCase004ab1对应fail标记,点击它,右面则出现具体的失败细节,在本发明的一个优选实施例中,所述测试报告还可以结合视频或图片的形式,具体实现方式可以在移动终端上或者本地计算机上或者云端运行环境中开启录屏工具,就可以得到视频测试报告,或者在断言判断失败时,利用截屏工具将当前界面截图保存,形成图片测试报告。
在本发明的一个优选实施例中,所述拓扑流程图的局部或全部能够进行移动、复制、剪切和/或粘贴操作,这在建立拓扑流程图时提供了较大的便利,减少重复工作。
进一步地,将所述在测试运行环境中运行所述测试代码得到的每一条测试 用例中的流程信息与数据信息关联并分离存储,并在产品上有效展示出来。由于流程与数据分不同的文件夹进行存放,条理清晰,测试人员一目了然,无论是涉及流程还是数据的查看或者修改,都能显著提高测试人员的工作效率。
在本发明的一个实施例中,提供了一种UI自动化功能测试方法,包括以下步骤:
获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点,每一个跳转信息的中间项为UI的交互按钮;
获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点,包括:对应于同一跳转前界面节点的不同跳转元素形成不同的分支路径,和/或基于第一跳转元素对应的跳转后界面节点为第二跳转元素对应的跳转前界面节点的情况,将所述第一跳转元素、第二跳转元素设为同一分支路径上的相邻跳转元素;
获取初始化参数配置结果,所述初始化参数配置结果包括测试起始界面节点、URL、测试界面深度,所述初始化参数配置结果用于在生成测试代码时实现参数初始化,包括:将所述遍历起始节点初始化为所述测试起始界面节点,所述测试起始界面节点为所述拓扑流程图中任意一个分支路径上的任意一个跳转元素所对应的跳转前界面节点,所述拓扑流程图中两个界面节点可以双向跳转;所述测试界面深度的配置值大于或等于以配置的测试起始界面节点为起点的流程图最长深度值,其中,深度配置值等于以配置的测试起始界面节点为起点的流程图最长深度值,若多个所述分支路径之间具有交互,则需要设置界面深度为两条分支流程的深度值之和;
利用代码引擎对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,在遍历的过程中,当检测到跳转元素时,获取其控件名称,以执行点击跳转操作,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
将测试代码以符合运行条件的模板形式放入测试运行环境中,运行所述测试代码,得到测试结果,运行所述测试代码的方式包括以下两种:
云端运行方式:向云端发送运行请求,所述运行请求中包括待测试用户界 面;云端服务器根据所述运行请求,获取与所述待测试用户界面对应的测试代码,并将所述测试代码放入项目模版,使其符合云端测试环境的运行要求,比如,将所述测试代码拷贝到指定地址的文件夹下,并调用所述待测试用户界面的源配置文件,根据所述源配置文件,将所述项目模板中的参数进行自动填充,完成填充后的包括有测试代码的项目模版可以放入云端的测试软件中运行,接收基于所述运行请求在云端的测试软件中运行所述测试代码得到的测试结果;
本地运行方式:从云端下载所述测试代码到本地计算机中,并在所述计算机中的测试软件中运行所述测试代码,在运行所述测试代码之前,由操作用户完成将所述测试代码放入项目模版的操作,在云端下载测试代码的同时,还一并下载项目模板、源配置文件及操作说明,根据所述操作说明完成项目配置,放入本地测试环境进行运行,得到测试结果;若界面的载体为移动终端,则需要先将所述移动终端与本地计算机连接。
在本发明的一个实施例中,提供了一种UI自动化功能测试装置,参见图4,所述装置包括以下模块:
跳转信息获取模块,用于获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
流程图获取模块,用于获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
代码生成模块,用于对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
代码运行模块,用于在测试运行环境中运行所述测试代码,得到测试结果。
总的来说,UI自动化功能测试模块的测试工作过程如下:跳转信息模块为根据待测试用户界面的功能区得到各个功能区的跳转信息,将跳转前界面节点跳转到跳转后界面节点过程中,所述跳转前界面节点上需要填的信息被预设为输入参数,并在所述跳转后界面节点上设置断言设置;再根据所述跳转信息建立拓扑流程图,然后在所述拓扑流程图中选择一个节点为测试起始界面节点,初始化其URL及测试深度值;接下来遍历流程图并自动生成代码,自动生成代 码的实质为利用代码引擎遍历到界面节点,若有断言设置,则进行断言判断,若无断言设置,则代码中加入当前界面节点的输入参数,完成输入参数后,根据跳转节点的id名称进行点击跳转操作,进入到下一界面再进行上述操作,直至跳转到分支路径上的最后一个界面节点(完成相应的断言判断,如果该界面有断言设置的话)。
需要说明的是:上述实施例提供的UI自动化功能测试装置在进行UI自动化功能测试时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将UI自动化功能测试装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,本实施例提供的UI自动化功能测试装置实施例与上述实施例提供的UI自动化功能测试方法属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
在本本发明的一个实施例中,提供了一种UI自动化功能测试设备,包括处理器以及存储器,所述存储器中存储有程序,在所述处理器执行所述程序时,进行以下操作:
获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
在测试运行环境中运行所述测试代码,得到测试结果。
在本发明的一个实施例中,提供了一种存储介质,用于存储程序,所述程序在被执行时进行以下操作:
获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个 根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
在测试运行环境中运行所述测试代码,得到测试结果。
以上关于UI自动化功能测试设备及相应存储介质的实施例与上述实施例提供的UI自动化功能测试方法属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (14)

  1. 一种UI自动化功能测试方法,其特征在于,包括以下步骤:
    获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点,每一个跳转信息的中间项为UI的交互按钮;
    获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点,包括:对应于同一跳转前界面节点的不同跳转元素形成不同的分支路径,和/或基于第一跳转元素对应的跳转后界面节点为第二跳转元素对应的跳转前界面节点的情况,将所述第一跳转元素、第二跳转元素设为同一分支路径上的相邻跳转元素;
    获取初始化参数配置结果,所述初始化参数配置结果包括测试起始界面节点、URL、测试界面深度,所述初始化参数配置结果用于在生成测试代码时实现参数初始化,包括:将所述遍历起始节点初始化为所述测试起始界面节点,所述测试起始界面节点为所述拓扑流程图中任意一个分支路径上的任意一个跳转元素所对应的跳转前界面节点,所述拓扑流程图中两个界面节点可以双向跳转;所述测试界面深度的配置值大于或等于以配置的测试起始界面节点为起点的流程图最长深度值,其中,深度配置值等于以配置的测试起始界面节点为起点的流程图最长深度值,若多个所述分支路径之间具有交互,则需要设置界面深度为两条分支流程的深度值之和;
    利用代码引擎对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,在遍历的过程中,当检测到跳转元素时,获取其控件名称,以执行点击跳转操作,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
    将测试代码以符合运行条件的模板形式放入测试运行环境中,运行所述测试代码,得到测试结果,运行所述测试代码的方式包括以下两种:
    云端运行方式:向云端发送运行请求,所述运行请求中包括待测试用户界面;云端服务器根据所述运行请求,获取与所述待测试用户界面对应的测试代码,并将所述测试代码放入项目模版,使其符合云端测试环境的运行要求,比 如,将所述测试代码拷贝到指定地址的文件夹下,并调用所述待测试用户界面的源配置文件,根据所述源配置文件,将所述项目模板中的参数进行自动填充,完成填充后的包括有测试代码的项目模版可以放入云端的测试软件中运行,接收基于所述运行请求在云端的测试软件中运行所述测试代码得到的测试结果;
    本地运行方式:从云端下载所述测试代码到本地计算机中,并在所述计算机中的测试软件中运行所述测试代码,在运行所述测试代码之前,由操作用户完成将所述测试代码放入项目模版的操作,在云端下载测试代码的同时,还一并下载项目模板、源配置文件及操作说明,根据所述操作说明完成项目配置,放入本地测试环境进行运行,得到测试结果;若界面的载体为移动终端,则需要先将所述移动终端与本地计算机连接。
  2. 一种UI自动化功能测试方法,其特征在于,包括以下步骤:
    获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
    获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
    对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
    在测试运行环境中运行所述测试代码,得到测试结果。
  3. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,所述方法还包括在获取拓扑流程图之前或之后获取断言设置结果,所述断言设置结果为对所述跳转前界面节点或跳转后界面节点中的显示元素设置的预期值;
    生成测试代码包括:在跳转到对应于设置有预期值的跳转前界面节点或跳转后界面节点后引用断言操作的程序。
  4. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,所述方法 还包括在获取拓扑流程图之后获取初始化参数配置结果,所述初始化参数配置结果包括测试起始界面节点及其URL,所述初始化参数配置结果用于在生成测试代码时实现参数初始化,包括:将所述遍历起始节点初始化为所述测试起始界面节点,所述测试起始界面节点可以为所述拓扑流程图中任意一个分支路径上的任意一个跳转元素所对应的跳转前界面节点。
  5. 根据权利要求4所述的UI自动化功能测试方法,其特征在于,所述初始化参数配置结果还包括测试界面深度,所述测试界面深度的配置值大于或等于以配置的测试起始界面节点为起点的流程图最长深度值。
  6. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,所述方法还包括在获取拓扑流程图之前或之后获取输入参数配置结果,所述输入参数配置结果包括为实现跳转前界面节点跳转到相应的跳转后界面节点所需输入的参数;
    生成测试代码包括:将上述输入参数配置结果赋值给相应跳转前界面节点处的输入参数元素的程序。
  7. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,所述拓扑流程图的建立步骤包括以下操作:
    对应于同一跳转前界面节点的不同跳转元素形成不同的分支路径,和/或
    基于第一跳转元素对应的跳转后界面节点为第二跳转元素对应的跳转前界面节点的情况,将所述第一跳转元素、第二跳转元素设为同一分支路径上的相邻跳转元素。
  8. 根据权利要求7所述的UI自动化功能测试方法,其特征在于,所述拓扑流程图的局部或全部能够进行移动、复制、剪切和/或粘贴操作。
  9. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,所述在测试运行环境中运行所述测试代码的步骤包括本地运行方式和/或云端运行方式, 所述本地运行方式包括:从云端下载所述测试代码到本地计算机中,并在所述计算机中的测试软件中运行所述测试代码,得到测试结果;
    所述云端运行方式包括:向云端发送运行请求,所述运行请求中包括待测试用户界面;根据所述运行请求,获取对应的测试代码;接收基于所述运行请求在云端的测试软件中运行所述测试代码得到的测试结果。
  10. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,所述测试结果包括视频、图片、和/或文字形式的测试报告,所述测试报告中或者还包括测试失败例情况说明,所述测试失败例包括界面跳转错误和/或断言判断错误的情况。
  11. 根据权利要求2所述的UI自动化功能测试方法,其特征在于,将所述在测试运行环境中运行所述测试代码得到的每一条测试用例中的流程信息与数据信息关联并分离存储。
  12. 一种UI自动化功能测试装置,其特征在于,包括以下模块:
    跳转信息获取模块,用于获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
    流程图获取模块,用于获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
    代码生成模块,用于对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
    代码运行模块,用于在测试运行环境中运行所述测试代码,得到测试结果。
  13. 一种UI自动化功能测试设备,包括处理器以及存储器,所述存储器中存储有程序,其特征在于,在所述处理器执行所述程序时,进行以下操作:
    获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳 转元素及跳转后界面节点;
    获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
    对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
    在测试运行环境中运行所述测试代码,得到测试结果。
  14. 一种存储介质,用于存储程序,其特征在于,所述程序在被执行时进行以下操作:
    获取待测试用户界面的跳转信息,所述跳转信息包括跳转前界面节点、跳转元素及跳转后界面节点;
    获取根据所述跳转信息建立得到的拓扑流程图,所述拓扑流程图包括一个根界面节点和一个或多个分支路径,每个分支路径上至少有一个跳转元素及对应的跳转后界面节点;
    对所述拓扑流程图进行深度遍历,根据自遍历起始节点向后的每一条完整分支路径生成与其对应的测试代码,所述测试代码包括对各个跳转元素执行用户界面跳转操作的程序;
    在测试运行环境中运行所述测试代码,得到测试结果。
PCT/CN2019/118683 2019-02-03 2019-11-15 Ui自动化功能测试方法、测试装置、测试设备及存储介质 WO2020155777A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910108616.3 2019-02-03
CN201910108616.3A CN109857668A (zh) 2019-02-03 2019-02-03 Ui自动化功能测试方法、测试装置、测试设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020155777A1 true WO2020155777A1 (zh) 2020-08-06

Family

ID=66897628

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118683 WO2020155777A1 (zh) 2019-02-03 2019-11-15 Ui自动化功能测试方法、测试装置、测试设备及存储介质

Country Status (2)

Country Link
CN (1) CN109857668A (zh)
WO (1) WO2020155777A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024067039A1 (zh) * 2022-09-27 2024-04-04 中兴通讯股份有限公司 应用程序的拨测方法、电子设备、计算机可读介质

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857668A (zh) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Ui自动化功能测试方法、测试装置、测试设备及存储介质
CN110209593B (zh) * 2019-06-14 2021-05-28 南京大学 一种面向偏好设置的安卓应用测试方法
CN110554962A (zh) * 2019-08-14 2019-12-10 平安普惠企业管理有限公司 回归测试的流程覆盖方法、服务器及计算机可读存储介质
CN110688317A (zh) * 2019-09-27 2020-01-14 支付宝(杭州)信息技术有限公司 应用界面的测试方法及装置
CN112685281A (zh) * 2019-10-17 2021-04-20 拉扎斯网络科技(上海)有限公司 测试方法、装置、电子设备及计算机可读存储介质
CN110750193B (zh) * 2019-10-17 2022-01-14 腾讯科技(深圳)有限公司 一种基于人工智能的场景拓扑确定方法和装置
CN110851201B (zh) * 2019-10-28 2024-01-16 腾讯科技(深圳)有限公司 应用运行控制方法、装置、终端及存储介质
CN111176982B (zh) * 2019-12-12 2023-08-22 中国建设银行股份有限公司 一种测试界面生成方法和装置
CN113220511A (zh) * 2020-02-06 2021-08-06 伊姆西Ip控股有限责任公司 测试bios的方法、设备和计算机可读存储介质
CN111124936B (zh) * 2020-02-28 2023-10-31 师江帆 搭积木式软件测试方法、测试装置、测试设备及存储介质
CN112749081B (zh) * 2020-03-23 2023-09-22 腾讯科技(深圳)有限公司 用户界面测试方法及相关装置
CN111552634A (zh) * 2020-03-30 2020-08-18 深圳壹账通智能科技有限公司 前端系统的测试方法、装置及存储介质
CN112256541A (zh) * 2020-10-12 2021-01-22 麒麟软件有限公司 一种操作系统图形窗口显示性能及压力测试方法
CN112612690B (zh) * 2020-11-30 2024-05-14 北京达佳互联信息技术有限公司 一种用户界面信息处理方法、装置、电子设备及存储介质
CN112506766B (zh) * 2020-12-02 2023-06-20 华南理工大学 交互式测试用例的自动生成方法
CN112835785B (zh) * 2021-01-08 2022-09-27 展讯通信(上海)有限公司 应用程序界面跳转的单向路径锚点记忆方法及装置、存储介质、终端
CN112835786B (zh) * 2021-01-08 2022-06-24 展讯通信(上海)有限公司 应用程序界面跳转的最优路径计算方法及装置、存储介质、终端
CN113069769B (zh) * 2021-04-20 2022-07-29 腾讯科技(深圳)有限公司 云游戏界面显示方法、装置、电子设备以及存储介质
CN113626326B (zh) * 2021-08-09 2022-02-11 三峡高科信息技术有限责任公司 一种基于图像识别的拖拽式的零代码前端自动化测试系统
CN113726610B (zh) * 2021-08-31 2023-08-08 中国平安人寿保险股份有限公司 基于路由协议的ui自动化测试方法、装置、设备及介质
CN114968687A (zh) * 2022-06-09 2022-08-30 腾讯科技(深圳)有限公司 遍历测试方法、装置、电子设备、程序产品以及存储介质
CN115629990B (zh) * 2022-11-15 2023-04-07 四川无限智达科技有限公司 业务测试方法、装置、电子设备及存储介质
CN116932414B (zh) * 2023-09-14 2024-01-05 深圳市智慧城市科技发展集团有限公司 界面测试用例的生成方法、设备及计算机可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130262934A1 (en) * 2012-03-27 2013-10-03 Ge Medical Systems Global Technology Company, Llc Method and apparatus for automatically generating a test script for a graphical user interface
CN106294167A (zh) * 2016-08-16 2017-01-04 济南大学 Android应用程序界面自动遍历方法及系统
CN106326104A (zh) * 2015-07-08 2017-01-11 腾讯科技(深圳)有限公司 终端控件测试方法及装置
CN107957939A (zh) * 2016-10-14 2018-04-24 北京京东尚科信息技术有限公司 网页交互界面测试方法及系统
CN109857668A (zh) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Ui自动化功能测试方法、测试装置、测试设备及存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461855B (zh) * 2013-09-22 2019-03-26 腾讯科技(北京)有限公司 一种Web自动化测试方法、系统及装置
CN106168923A (zh) * 2016-06-30 2016-11-30 北京奇虎科技有限公司 一种功能遍历与界面遍历方法及系统
CN106649100B (zh) * 2016-11-16 2020-08-25 福建天晴数码有限公司 一种自动化测试方法及系统
CN109086204B (zh) * 2018-07-20 2022-03-11 北京小米移动软件有限公司 节点关系树建立、页面标记和识别方法、装置和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130262934A1 (en) * 2012-03-27 2013-10-03 Ge Medical Systems Global Technology Company, Llc Method and apparatus for automatically generating a test script for a graphical user interface
CN106326104A (zh) * 2015-07-08 2017-01-11 腾讯科技(深圳)有限公司 终端控件测试方法及装置
CN106294167A (zh) * 2016-08-16 2017-01-04 济南大学 Android应用程序界面自动遍历方法及系统
CN107957939A (zh) * 2016-10-14 2018-04-24 北京京东尚科信息技术有限公司 网页交互界面测试方法及系统
CN109857668A (zh) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Ui自动化功能测试方法、测试装置、测试设备及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024067039A1 (zh) * 2022-09-27 2024-04-04 中兴通讯股份有限公司 应用程序的拨测方法、电子设备、计算机可读介质

Also Published As

Publication number Publication date
CN109857668A (zh) 2019-06-07

Similar Documents

Publication Publication Date Title
WO2020155777A1 (zh) Ui自动化功能测试方法、测试装置、测试设备及存储介质
WO2020155778A1 (zh) 接口自动化测试方法、测试装置、测试设备及存储介质
CN112270149B (zh) 验证平台自动化集成方法、系统及电子设备和存储介质
CN109739855B (zh) 实现数据表拼接及自动训练机器学习模型的方法和系统
CN110019081A (zh) 数据持久化处理方法、装置、系统及可读存储介质
JP6045134B2 (ja) アプリケーション性能試験のための並列作業負荷シミュレーション
CN110716853A (zh) 一种测试脚本录制方法、应用程序测试方法和相关装置
CN110362490B (zh) 融合iOS与Android移动应用的自动化测试方法及系统
CN103927253A (zh) 多浏览器兼容性测试方法及系统
CN104461898A (zh) 应用测试的方法、中控服务器、测试终端及系统
CN108600311B (zh) 客户端模拟接口数据的方法及装置
CN109815119B (zh) 一种app链接渠道的测试方法及装置
CN102999419B (zh) 一种Android测试事件记录回放方法及装置
CN108809755B (zh) 兼容命令行和web界面的家庭网关自动测试方法及系统
CN107368420A (zh) Api测试方法、装置及电子设备
CN109800135A (zh) 一种信息处理方法及终端
CN114003451B (zh) 一种接口测试方法、装置、系统及介质
CN115658529A (zh) 用户页面的自动化测试方法以及相关设备
CN112905441A (zh) 测试用例生成方法、测试方法、装置及设备
US20150143346A1 (en) Constructing test-centric model of application
CN109542754A (zh) 移动设备的接入方法、应用程序的调试方法、装置和系统
CN106970870B (zh) 网页测试平台、网页测试方法和网页测试系统
CN114218072A (zh) 测试脚本生成方法、装置、存储介质及计算机设备
CN113126993A (zh) 应用于车辆检测软件的自动化测试方法及其系统
CN110825370B (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: 19913651

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19913651

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19913651

Country of ref document: EP

Kind code of ref document: A1