Automated testing method and device

By writing configuration parameters in automated tests and generating unique control IDs, the communication barrier problem between the automated test platform and the application is solved, and the coverage and testing efficiency of test cases are improved.

CN113609002BActive Publication Date: 2025-02-25GUANGZHOU BAIGUOYUAN NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110802888.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-15
Publication Date
2025-02-25
Estimated Expiration
2041-07-15

AI Technical Summary

Technical Problem

During the automated testing process, there is a communication barrier between the automated test platform and the application, and there is a lack of effective communication channels and parameter configuration channels, which leads to the inability to cover special situations in the test cases.

Method used

Before starting the test case, the configuration parameters are written into the folder of the target application, and when the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained through the processing unit to store them in memory, the configuration parameters in the memory are read for testing, and when the target application generates an interactive interface, a unique control ID is generated for each control.

Benefits of technology

It provides a parameter configuration communication channel for automated testing, improves the coverage of automated test cases, reduces the time cost of manually setting control IDs, and improves the efficiency of automated testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113609002B_ABST
    Figure CN113609002B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an automated testing method and device. The technical solution provided by the embodiment of the present application is to write the configuration parameters corresponding to the test case into the folder of the target application through the test platform before starting the test case, start the target application through the test platform when the test case is started, and obtain the configuration parameters in the folder through the first processing unit and store them in the memory, and when the second processing unit obtains the configuration parameters, read the configuration parameters stored in the memory, test the target application according to the configuration parameters, and generate a unique control ID for each control of the target application when the target application generates an interactive interface, and provide a parameter configuration communication channel for automated testing by automatically adding the configuration parameters to the target application, which can effectively improve the test case coverage of automated testing, automatically generate control IDs, reduce the time cost of manually setting control IDs, and improve the efficiency of automated testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to an automated testing method and device. Background Art

[0002] With the development of modern technology, smart devices are increasingly being used in all aspects of life. Smart devices refer to any device with computer processing capabilities, thinking, judgment and data processing capabilities. In addition to hardware integration, the realization of various functions of smart devices also requires the support of application software.

[0003] In the information age where technology is constantly updated, the applications in smart devices are also frequently updated and iterated. In the process of application iteration of smart devices, automated testing plays an important role. Automated testing can not only ensure the quality of each application, but also reduce repeated and frequent manual operations, thereby reducing time and labor costs.

[0004] In the process of automated testing, the automated testing platform needs to obtain the corresponding UI elements through the preset control ID, which is a necessary step in the subsequent process of automated testing. However, it is relatively time-consuming to develop automated test cases. One of the reasons is that there is a certain communication barrier between the automated testing platform and the application, and there is a lack of effective communication channels and parameter configuration methods, which makes it impossible to cover special situations in the test cases. Summary of the invention

[0005] The embodiments of the present application provide an automated testing method and device to provide a configuration parameter communication channel during the automated testing process and improve the coverage of automated testing cases.

[0006] In a first aspect, an embodiment of the present application provides an automated testing method, comprising:

[0007] Before starting the test case, the configuration parameters corresponding to the test case are written into the folder of the target application through the test platform;

[0008] When the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained and stored in the memory through the first processing unit;

[0009] When the second processing unit acquires the configuration parameters, it reads the configuration parameters stored in the memory, tests the target application according to the configuration parameters, and generates a unique control ID for each control of the target application when the target application generates an interactive interface.

[0010] In a second aspect, an embodiment of the present application provides an automated testing device, including:

[0011] Configuration parameter generation module: used to write the configuration parameters corresponding to the test case into the folder of the target application through the test platform before starting the test case;

[0012] Configuration parameter storage module: used for starting the target application through the test platform when the test case is started, and obtaining the configuration parameters in the folder through the first processing unit and storing them in the memory;

[0013] Target application testing module: used for reading the configuration parameters stored in the memory when the second processing unit acquires the configuration parameters, testing the target application according to the configuration parameters, and generating a unique control ID for each control of the target application when the target application generates an interactive interface.

[0014] In a third aspect, an embodiment of the present application provides an automated testing device, including: a memory and one or more processors;

[0015] The memory is used to store one or more programs;

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the automated testing method as described in the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a storage medium storing computer executable instructions, which, when executed by a computer processor, are used to execute the automated testing method as described in the first aspect.

[0018] In an embodiment of the present application, before starting the test case, the configuration parameters corresponding to the test case are first written into the folder of the target application through the test platform. When the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained and stored in the memory through the first processing unit. When the second processing unit obtains the configuration parameters, the configuration parameters stored in the memory are read, the target application is tested according to the configuration parameters, and when the target application generates an interactive interface, a unique control ID is generated for each control of the target application. By automatically adding the configuration parameters to the target application, a parameter configuration communication channel for automated testing is provided, which can effectively improve the test case coverage of automated testing, automatically generate control IDs, reduce the time cost of manually setting control IDs, and improve the efficiency of automated testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a flow chart based on an automated testing method provided in an embodiment of the present application;

[0020] Figure 2is another flow chart based on the automated testing method provided in an embodiment of the present application;

[0021] Figure 3 It is a module structure diagram of the functional components integrated in the target application operating system provided by the embodiment of the present application;

[0022] Figure 4 It is an execution framework diagram of the automated testing method in the prior art;

[0023] Figure 5 An execution framework diagram of the automated testing method provided in the embodiment of the present application;

[0024] Figure 6 A diagram of an execution framework for configuring parameters in the automated testing method provided in an embodiment of the present application;

[0025] Figure 7 It is a structural schematic diagram of an automated testing device provided in an embodiment of the present application;

[0026] Figure 8 It is a structural diagram of an automated testing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0028] Figure 1 A flow chart of an automated testing method provided in an embodiment of the present application is given. The automated testing method provided in an embodiment of the present application can be executed by an automated testing device, which can be implemented by hardware and / or software and integrated in an automated testing device.

[0029] The following description takes the automated testing method performed by an automated testing device as an example. Figure 1 , the automated testing method includes:

[0030] Step 101, before starting the test case, write the configuration parameters corresponding to the test case into the folder of the target application through the test platform.

[0031] The embodiment is mainly used to perform automated testing on the performance and functions of various applications of smart devices. Smart devices include smart phones, tablet computers, and laptops. In the above, the test case is a set of documents composed of preconditions, inputs, execution conditions, expected results, etc., which embody the test scheme, method, etc. The test case is used to complete the detection of data for a specific requirement or target test. In the embodiment, the test case is used to detect the process to be executed by the corresponding target application. For example, the target application is an app application in a smart phone. In the app application, there is a function that can draw a rectangular box. In order to test each different way of generating the rectangular box, a set of test cases is set respectively. When the app application is automatically tested, the test case is automatically executed to test the implementation of the process. In the above, the configuration parameter is used to limit the function corresponding to the process to be detected by the test case. In a set of test cases, multiple configuration parameters may be included. Test cases are often written in fixed software targets. In addition to configuration parameters, test cases may also include numbers, dates, testers, priorities, titles, test targets, test environments, etc. The entire test case can be divided into three parts, including test parameters, expected results, and configuration. Among them, the configuration includes configuration parameters.

[0032] In this embodiment, a functional component adapted to the operating system is first constructed and integrated into the engineering code of the operating system to improve the efficiency of automated testing. The operating system is the operating system of the application, and in this embodiment, it is the operating system of the target application. Specifically, the module structure of the functional component is as follows: Figure 3 As shown, it includes a first processing unit and a third processing unit, wherein the third processing unit is used to inherit the first processing unit and process the configuration parameters configured by the test platform at the business layer, including cloud control configuration, local configuration, language code, country code, etc. The first processing unit is configured for comprehensive management of automated testing, which can obtain the configuration parameters configured by the test platform and control whether to start the function of automatically generating control IDs. In addition, it also includes a fourth processing unit, a fifth processing unit, a sixth processing unit and a seventh processing unit. The fourth processing unit is used to implement the interface called when the application generates an interactive interface to realize the automatic generation of control IDs. The fifth processing unit provides the fourth processing unit with a method for obtaining the variable name of the control in the source code. The sixth processing unit provides a functional interface. The seventh processing unit is used to handle list anomalies that occur after automated testing.

[0033] In the execution framework of the existing automated testing method, the automated testing platform simulates the interaction with the application, and then determines whether the code logic is normal based on the corresponding interaction status of the device, such as Figure 4 In the execution framework shown, the automated testing platform simulates interaction with the ios application, which is an application in the ios operating system. The automated testing platform sends a control signal to simulate a user clicking an interactive button of the ios application. When a button of the ios application is clicked, an interactive change usually occurs, such as jumping to another page. In the embodiment, the ios application performs an interactive response according to the simulated user button click operation, that is, a UI response. The embodiment is not limited to the ios operating system, but is also applicable to other operating systems. Figure 3 The iOS application in the example is just an example. The automated test platform is the test platform described in the embodiment. This embodiment includes a functional component, which provides the function of configuring parameters. When the application reads the relevant configuration, it will give priority to reading the parameters processed by the functional component, thereby improving the coverage of the test case. And it can automatically generate a control ID to reduce the time cost of manual operation. Figure 5 An execution framework of an automated testing method is shown, in which the functional component is embodied by a first processing unit, and the automated testing platform implements the writing of configuration parameters, which are written into an ios application. Here, the ios application is only used as an example to represent an application in the ios operating system. Later, when the test case is started, the target application is started by the test platform, and the configuration parameters in the ios application are obtained and stored by the first processing unit of the functional component. A control signal is sent by the automated testing platform to simulate a user clicking a button of the ios application, and then the ios application responds interactively according to the simulated button click operation, such as jumping to other pages. Assume that user A is a registered member of the ios application and has privileges that distinguish registered members from non-registered members. For example, the privilege is a button that can only be clicked by registered members. At this time, the ios application decides whether to visually display the button based on the parameter configuration. Figure 5 The automated testing platform transmits the parameter configuration to the first processing unit, indicating that the current user is a registered member. At this time, when the iOS application reads the parameter configuration, it first obtains the parameter configuration from the first processing unit, and knows that the current user is a registered member through the parameter configuration, so the button is displayed, that is, the automated testing platform can control whether the iOS application displays a certain function. Figure 5 The automated testing platform is the testing platform described in this embodiment.

[0034] The configuration parameters of the embodiment are generated by the test platform. Specifically, before starting the test case, the configuration parameters are configured through the test platform. In the embodiment, the application generally refers to application software, which is a collection of various programming languages ​​that can be used by users and application programs compiled in various programming languages. Correspondingly, the target application is the application currently selected from among the many applications in the smart device to be tested using the test case.

[0035] In this step, the configuration parameters corresponding to the test case are written into the folder of the target application through the test platform. Specifically, the path of the sandbox file of the target application is obtained through the test platform, and the configuration parameters of the test case corresponding to the target application are obtained. The configuration parameters are written into the configuration file and stored in the sandbox file.

[0036] The above-mentioned sandbox file is a folder of the target application, and the sandbox is used to limit the code access rights of the application. Each application corresponds to its own sandbox file. The embodiment first obtains the path of the sandbox file and writes the configuration parameters into the configuration file. Among them, the configuration parameters can be obtained by input by the staff. Corresponding to different applications, each has its own unique ID code, through which the path of the sandbox file used by the target can be obtained. After obtaining the path, the configuration file can be sent to the sandbox folder.

[0037] like Figure 6 An execution framework diagram of configuration parameters in an automated testing method is shown. In the diagram, the automated testing platform is also the testing platform described in the embodiment. In the diagram, the iOS operating system is taken as an example, and the iOS application is an application on the iOS operating system. The test platform writes the configuration parameters into the configuration file, and sends the configuration file to the sandbox file of the iOS application. When the test case is started, the test platform starts the target application, and then the first processing unit obtains the configuration parameters from the sandbox file. After that, the second processing unit reads the configuration parameters from the first processing unit and tests the target application according to the configuration parameters. The configuration parameters are configured with corresponding keys, that is, Figure 6 The key shown enables the second processing unit to open the relevant business through the specified key, obtain the configuration parameters in the corresponding configuration file, and perform matching tests on the target application.

[0038] Step 102, when the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained by the first processing unit and stored in the memory.

[0039] When an automated test is to be performed, a test case needs to be started, and the target application corresponding to the test case is started through the test platform. The first processing unit described in the embodiment is a comprehensive management module for automated testing, which can obtain configuration parameters configured by the test platform and control whether to start the function of automatically generating a control ID.

[0040] The above configuration parameters may include a language code. In this embodiment, in addition to integrating the functional component in the operating system of the application and configuring the main configuration parameters of the test case through the third processing unit in the functional component, the third processing unit may also configure the language code, which is used to configure the language mode of the application. For example, when the language code is set to English, the language mode of the application corresponding to the configuration parameter is English.

[0041] In this step, the test platform starts the target application including normal start and cold start. Normal start means that when the target application is currently completely closed and needs to be opened, the process of opening the target application is to start the target application normally. In another case, when the target application has been used before, that is, the target application is not completely closed, the next start is a cold start. For example, an application on a tablet computer was minimized in the background after it was started before, and the application was not closed. When the application is to be started next time, it is a cold start process.

[0042] In this embodiment, when the configuration parameters are stored in the memory, the configuration parameters are stored in the memory in the form of a dictionary. The form of a dictionary is that, for example, if each parameter in the configuration parameters is named in English characters, each parameter is stored in the order of the 26 letters of the English alphabet for easy subsequent search.

[0043] Step 103, when the second processing unit acquires configuration parameters, it reads the configuration parameters stored in the memory, tests the target application according to the configuration parameters, and generates a unique control ID for each control of the target application when the target application generates an interactive interface.

[0044] In the embodiment, the second processing unit is a unit module in the target application, which may belong to the business layer, and the second processing unit may read the local or cloud control configuration. In this step, the second processing unit of the target application reads the configuration parameters in the memory, and then performs an automated test on the target application according to the limitations of the configuration parameters.

[0045] In the process of automated testing, a control ID is also automatically generated, and the control ID corresponds to each different control as an identification code of the control. The control is an object displayed in the interactive interface in the target application that the user can interact with to input or operate data, and usually appears in a dialog box or toolbar. The embodiment is to write the configuration parameters corresponding to the test case into the folder of the target application through the test platform before starting the test case. When the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained by the first processing unit and stored in the memory. When the second processing unit obtains the configuration parameters, the configuration parameters stored in the memory are read, and the target application is tested according to the configuration parameters. When the target application generates an interactive interface, a unique control ID is generated for each control of the target application. By automatically adding the configuration parameters to the target application, a parameter configuration communication channel for automated testing is provided, which can effectively improve the test case coverage of automated testing, automatically generate control IDs, reduce the time cost of manually setting control IDs, and improve the efficiency of automated testing.

[0046] Figure 2 Another embodiment of the present invention provides an automated testing method, see Figure 2 , the automated testing method includes:

[0047] Step 201, before starting the test case, obtain the path of the sandbox file of the target application through the test platform, and obtain the configuration parameters of the test case corresponding to the target application, write the configuration parameters into the configuration file, and store it in the sandbox file.

[0048] In this step, before starting the test case, the test platform obtains the path of the sandbox file of the target application, then obtains the corresponding configuration parameters, and stores the configuration file containing the configuration parameters in the sandbox file. The sandbox file is the folder of the target application, and each application has its own sandbox file.

[0049] Step 202, when the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained by the first processing unit and stored in the memory.

[0050] Similarly, the first processing unit is a comprehensive management module for automated testing, which can obtain configuration parameters of the test platform configuration and control whether to start the function of automatically generating a control ID.

[0051] Step 203: When the second processing unit acquires configuration parameters, the configuration parameters stored in the memory are read.

[0052] Correspondingly, the second processing unit is a unit module in the target application, and the second processing unit can read the local or cloud control configuration. In this step, the second processing unit of the target application reads the configuration in the memory, and in the subsequent steps, the target application is automatically tested according to the configuration parameter limit.

[0053] Step 204 , determining whether the target application currently supports automated testing, and if it does, obtaining and adding configuration parameters to the target application for testing the target application.

[0054] During the automated testing process, a control ID is also automatically generated, which corresponds to each different control and serves as an identification code for the control. The control is an object displayed in the interactive interface of the target application with which the user can interact to input or operate data, usually appearing in a dialog box or toolbar.

[0055] However, before automatically generating the control ID, the present embodiment first detects and determines whether the target application currently supports automated testing. Only when it is detected that the current target application supports automated testing, the configuration parameters are further obtained and added to the target application to perform automated testing on the target application in combination with the test case.

[0056] In this embodiment, a switch supporting automated testing may be set in the target application, and the switch is equivalent to a key. When the switch is turned on, automated testing is supported. Specifically, whether the target application currently supports automated testing is determined by detecting whether the test start switch of the target application is turned on. When the test start switch is turned off, it corresponds to not supporting automated testing, and when the test start switch is turned on, it corresponds to supporting automated testing.

[0057] In another example, whether the target application currently supports automated testing is determined by reading configuration parameters and detecting whether the configuration parameters are empty.

[0058] When the configuration parameter is empty, it means that automated testing is not supported. When the configuration parameter is not empty, it means that automated testing is supported.

[0059] Under the premise that it is detected that the target application supports automated testing, the configuration parameters are obtained and added to the target application for testing the target application according to the configuration parameters. To detect whether the target application supports automated testing, the detection is performed in the target application itself. In another case, when the target application currently does not support automated testing, the configuration parameters corresponding to the test case itself are read. Automated testing is not supported, that is, the test start switch of the target application is turned off or the configuration parameters are empty. When automated testing is not supported, the target application automatically reads the configuration parameters of the test case itself, which are usually entered by the user when starting to write the test case.

[0060] Step 205: When the target application generates an interactive interface, a unique control ID is generated for each control of the target application.

[0061] In the embodiment, the interactive interface is a channel for information exchange between the user and the device. Through the interactive interface, the user can be presented with operation buttons and information can be provided for the user to read, analyze, judge, and improve the operation entry for the next operation. As the generation timing of the control ID, the corresponding control ID is generated for each control only when the target application generates the interactive interface.

[0062] This step specifically includes:

[0063] When the target application generates an interactive interface, the view controller class name corresponding to the view controller that controls the target application to display the interactive interface, as well as the control class name and control variable name of the target application are obtained; based on the view controller class name, control class name and control variable name, and in combination with preset rules, a control ID is generated, and the preset rules include sorting the view controller class name, control class name, and control variable name in sequence.

[0064] In the above, the view controller is used to control the target application to display the interactive interface. The view controller corresponds to a unique view controller class name. The view controller class name will not change in subsequent operations, and it has uniqueness and reliability. Correspondingly, the control currently being tested by the target application also has a corresponding control class name and control variable name. The control class name and control variable name are unique and fixed like the view controller class name, and will not change in subsequent operation processes. This embodiment generates a control ID by obtaining the view controller class name, control class name, and control variable name, thereby ensuring the uniqueness of the control ID and avoiding the impact of changes in the UI element hierarchy.

[0065] Specifically, the preset rule includes sorting the view controller class name, the control class name, and the control variable name in sequence. Exemplarily, assuming that the view controller class name is v1, the control class name is a2, and the control variable name is c3, v1a2c3 can be generated as the control ID according to the preset rule. In another exemplary embodiment, assuming that the view controller class name is v1, the space class name is a2, and the control variable name is c3, v1.a2.c3 can also be generated as the control ID, that is, a separator is set between the view controller class name and the control class name, and between the control class name and the control variable name. In other exemplary embodiments, the preset rule can also be set to sort the control variable name, the control class name, and the view controller class name in sequence, and a separator is set between the control variable name and the control class name, and between the control class name and the view controller. Then, according to the case where the view controller class name is v1, the control class name is a2, and the control variable name is c3, the generated control ID is c3.a2.v1.

[0066] In the above, obtaining the control variable name of the target application specifically includes: detecting whether the value of the control variable name is empty; when the value of the control variable name is empty and the current control corresponding to the target application is an image, obtaining the image file name of the current control as the value of the control variable name; when the value of the control variable name is not empty, obtaining the control variable name.

[0067] As a further preferred implementation, before executing when the target application generates an interactive interface, obtaining the view controller class name corresponding to the view controller that controls the target application to display the interactive interface and the control class name and control variable name of the target application, the following steps are also performed:

[0068] Detect whether the ID of the current control corresponding to the target application is empty; when the ID of the current control is empty and the target application generates an interactive interface, obtain the view controller class name of the view controller that controls the target application to generate the interactive interface and obtain the control class name of the target application; when the ID of the current control is not empty, end the process. The above-mentioned current control can be understood as one of the controls of the target application, and whether the ID of the control is currently being generated is being executed.

[0069] Before automatically generating a control ID, the embodiment first detects whether a unique ID corresponding to the control already exists. If so, there is no need to generate it again, thus avoiding duplication of work and wasting time. When the ID of the current control is empty, it means that the unique ID of the control has not yet been generated. At this time, the control ID needs to be automatically generated, and the next step is executed. When the control ID generation timing is met, that is, when the target application generates an interactive interface, the operation flow of obtaining the view controller class name of the view controller that controls the target application to generate the interactive interface and obtaining the control class name of the target application is executed.

[0070] Figure 7 An automated testing device provided in an embodiment of the present application is shown. Figure 7 As shown, the automated testing device includes a configuration parameter generation module 701, a configuration parameter storage module 702 and a target application test module 703. The configuration parameter generation module 701 is used to write the configuration parameters corresponding to the test case into the folder of the target application through the test platform before starting the test case; the configuration parameter storage module 702 is used to start the target application through the test platform when the test case is started, and obtain the configuration parameters in the folder through the first processing unit and store them in the memory; the target application test module 703 is used to read the configuration parameters stored in the memory when the second processing unit obtains the configuration parameters, test the target application according to the configuration parameters, and generate a unique control ID for each control of the target application when the target application generates an interactive interface.

[0071] Correspondingly, in the configuration parameter generation module 701, the path of the sandbox file of the target application is obtained through the test platform, and the configuration parameters of the test case corresponding to the target application are obtained, and the configuration parameters are written into the configuration file and stored in the sandbox file.

[0072] In the target application testing module 703, when the second processing unit reads the configuration parameters stored in the memory, it is determined whether the target application currently supports automated testing. If it supports automated testing, the configuration parameters contained in the configuration file are obtained and added to the target application for testing the target application. When the target application currently does not support automated testing, the configuration parameters corresponding to the test case itself are read.

[0073] Specifically, determining whether the target application currently supports automated testing includes: detecting whether the test start switch of the target application is turned on, or reading and detecting whether the configuration parameters are empty; wherein, when the test start switch is turned off or the configuration parameters are empty, it corresponds to not supporting automated testing, and when the test start switch is turned on or the configuration parameters are not empty, it corresponds to supporting automated testing.

[0074] In the target application test module 703, when the target application generates an interactive interface, a unique control ID is generated for each control of the target application, including: when the target application generates an interactive interface, the view controller class name corresponding to the view controller that controls the target application to display the interactive interface and the control class name and control variable name of the target application are obtained; based on the view controller class name, the control class name and the control variable name, the control ID is generated in combination with preset rules, and the preset rules include sorting the view controller class name, the control class name, and the control variable name in sequence. The above-mentioned acquisition of the control variable name of the target application includes: detecting whether the value of the control variable name is empty; when the value of the control variable name is empty and the current control corresponding to the target application is an image, the image file name of the current control is obtained as the value of the control variable name; when the value of the control variable name is not empty, the control variable name is obtained.

[0075] The technical effects that can be achieved by this embodiment are the same as the technical effects that can be achieved by the automated testing method provided in the embodiment of the present application, and will not be repeated here.

[0076] like Figure 8 As shown, an embodiment of the present application also provides an automated testing device, including: a memory 801 and one or more processors 802; the memory 801 is used to store one or more programs; when the one or more programs are executed by the one or more processors 802, the one or more processors implement the automated testing method as described in the present application.

[0077] An embodiment of the present application also provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to execute the automated testing method provided in the above embodiment.

[0078] Of course, the storage medium containing computer executable instructions provided in the embodiment of the present application, whose computer executable instructions are not limited to the automated testing method described above, can also execute related operations in the automated testing method provided in any embodiment of the present application.

[0079] The automated testing apparatus, device and storage medium provided in the above embodiments can execute the automated testing method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the automated testing method provided in any embodiment of the present application.

[0080] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. An automated testing method, characterized in that: include: Before starting the test case, the configuration parameters corresponding to the test case are written into the folder of the target application through the test platform, which includes: obtaining the path of the sandbox file of the target application through the test platform, and obtaining the configuration parameters of the test case corresponding to the target application, writing the configuration parameters into the configuration file, and storing them in the sandbox file; When the test case is started, the target application is started through the test platform, and the configuration parameters in the folder are obtained and stored in the memory through the first processing unit; When the second processing unit acquires configuration parameters, the configuration parameters stored in the memory are read, the target application is tested according to the configuration parameters, and when the target application generates an interactive interface, a unique control ID is generated for each control of the target application, the control ID is generated based on the acquired view controller class name, control class name and control variable name, and the process of acquiring the control variable name includes: detecting whether the value of the control variable name is empty, when the value of the control variable name is empty and the current control corresponding to the target application is an image, acquiring the image file name of the current control as the value of the control variable name, and when the value of the control variable name is not empty, acquiring the control variable name.

2. The automated testing method according to claim 1, characterized in that: The reading the configuration parameters stored in the memory and testing the target application according to the configuration parameters includes: When reading the configuration parameters stored in the memory, it is determined whether the target application currently supports automated testing. If it supports automated testing, the configuration parameters are obtained and added to the target application for testing the target application.

3. The automated testing method according to claim 2, characterized in that: The determining whether the target application currently supports automated testing includes: Check whether the test start switch of the target application is turned on, or Read the configuration parameters and detect whether the configuration parameters are empty; Among them, when the test start switch is turned off or the configuration parameter is empty, it corresponds to not supporting automated testing, and when the test start switch is turned on or the configuration parameter is not empty, it corresponds to supporting automated testing.

4. The automated testing method according to claim 3, characterized in that: Also includes: When the target application currently does not support automated testing, configuration parameters corresponding to the test case itself are read.

5. The automated testing method according to claim 1, characterized in that: When the target application generates an interactive interface, generating a unique control ID for each control of the target application includes: When the target application generates an interactive interface, obtaining a view controller class name corresponding to a view controller that controls the target application to display the interactive interface and a control class name and a control variable name of the target application; Based on the view controller class name, the control class name and the control variable name, and in combination with preset rules, a control ID is generated. The preset rules include sorting the view controller class name, the control class name and the control variable name in sequence.

6. The automated testing method according to claim 1, characterized in that: When the target application generates an interactive interface, before obtaining the view controller class name corresponding to the view controller that controls the target application to display the interactive interface and the control class name and control variable name of the target application, it also includes: Detect whether the ID of the current control corresponding to the target application is empty; When the ID of the current control is empty and the target application generates an interactive interface, obtain the view controller class name of the view controller that controls the target application to generate the interactive interface and obtain the control class name of the target application; When the ID of the current control is not empty, the process ends.

7. An automated testing device, characterized in that: include: Configuration parameter generation module: used to write the configuration parameters corresponding to the test case into the folder of the target application through the test platform before starting the test case. The configuration parameter generation module is specifically used to obtain the path of the sandbox file of the target application through the test platform, and obtain the configuration parameters of the test case corresponding to the target application, write the configuration parameters into the configuration file, and store them in the sandbox file; Configuration parameter storage module: used for starting the target application through the test platform when the test case is started, and obtaining the configuration parameters in the folder through the first processing unit and storing them in the memory; Target application testing module: used for reading the configuration parameters stored in the memory when the second processing unit acquires the configuration parameters, testing the target application according to the configuration parameters, and generating a unique control ID for each control of the target application when the target application generates an interactive interface, wherein the control ID is generated based on the acquired view controller class name, control class name and control variable name. The target application testing module is specifically used for detecting whether the value of the control variable name is empty. When the value of the control variable name is empty and the current control corresponding to the target application is an image, the image file name of the current control is obtained as the value of the control variable name. When the value of the control variable name is not empty, the control variable name is obtained.

8. An automated testing device, characterized in that: include: memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the automated testing method as described in any one of claims 1-6.

9. A storage medium storing computer executable instructions, characterized in that: The computer executable instructions are used to execute the automated testing method according to any one of claims 1 to 6 when executed by a computer processor.

Citation Information

Patent Citations

  • Visualized automatic testing method and system thereof

    CN104035859A

  • Control identifier generation method and device, computer equipment and storage medium

    CN112162735A