Application testing method, device and equipment and computer readable storage medium

By receiving scripts to generate test scripts sent by the device, using the device connection function and test function to adaptively connect the devices to be tested in different operating systems, the problems of high testing costs and high maintenance costs in the existing technology are solved, and unified testing of different operating systems is realized, reducing the testing costs.

CN119829466APending Publication Date: 2025-04-15CHINA UNIONPAY
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510157659.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-12
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the prior art, the regression testing method is mostly manual testing or automated testing scripts for users, resulting in high testing costs and high maintenance costs for automated testing scripts.

Method used

It provides an application testing method, which generates the test script sent by the device by receiving scripts, uses the device connection function and test function to adaptively connect the devices to be tested in different operating systems, and determines the target test function based on the target operating system to realize automated testing of the application to be tested.

Benefits of technology

It reduces the maintenance cost of automated test scripts, realizes unified testing of equipment to be tested on different operating systems, and reduces the testing cost of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829466A_ABST
    Figure CN119829466A_ABST
Patent Text Reader

Abstract

The invention discloses an application testing method, device and equipment and a computer readable storage medium. The method comprises the steps that a test script corresponding to a to-be-tested function of a to-be-tested application is obtained, and the test script comprises an equipment connection function and a test function; the device connection function is used for connecting a to-be-tested device provided with a to-be-tested application, and the device connection function comprises sub-device connection functions corresponding to a plurality of operating systems; the test function is used for testing a to-be-tested function of the to-be-tested application, and the test function comprises sub-test functions corresponding to a plurality of operating systems; determining a target operating system of the to-be-tested device based on the device connection function and connecting the to-be-tested device; determining a target test function in the plurality of sub-test functions based on the target operating system; and based on the target test function, testing a to-be-tested function of the to-be-tested application in the to-be-tested equipment. According to the embodiment of the invention, the maintenance cost of the automatic test script can be reduced, and the test cost of the application is further reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of application technology, and in particular, relates to an application testing method, device, equipment and computer-readable storage medium. Background Art

[0002] With the rapid development of application technology, the iteration and update of applications are becoming more and more frequent, and regression testing of applications is becoming more and more frequent. Regression testing is to retest the previous functions of the application to ensure that the newly added functions do not affect the previous functions.

[0003] Currently, regression testing methods include manual testing by users and automated testing through automated scripts. However, manual testing by users is time-consuming and labor-intensive, resulting in high labor costs for testing. In addition, the writing methods of automated test scripts are often different for different operating systems. The same application usually releases clients for different operating systems at the same time, and each operating system needs to maintain a separate set of automated test scripts, resulting in high maintenance costs for automated test scripts, which in turn leads to high application testing costs. Summary of the invention

[0004] The embodiments of the present application provide a testing method, apparatus, device, computer-readable storage medium, and computer program product for an application, which can reduce the maintenance cost of automated test scripts and thereby reduce the testing cost of the application.

[0005] In a first aspect, an embodiment of the present application provides an application testing method, which is applied to a testing device, and the method includes:

[0006] A test script corresponding to a function to be tested of an application to be tested and sent by a script generating device is received, wherein the test script includes a device connection function and a test function; the application to be tested is installed in the device to be tested, the device connection function is used to connect the device to be tested based on an operating system of the device to be tested, and the device connection function includes sub-device connection functions corresponding to each of a plurality of operating systems; the test function is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes sub-test functions corresponding to each of the plurality of operating systems;

[0007] Connecting the device under test based on a target device connection function in the device connection function, wherein the target device connection function is any one of the plurality of sub-device connection functions;

[0008] Determine the operating system corresponding to the target device connection function as the target operating system;

[0009] Based on the target operating system, determining a target test function among the plurality of sub-test functions;

[0010] Based on the target test function, the function to be tested of the application to be tested in the device to be tested is tested.

[0011] In a possible implementation, the test script includes a plurality of first test items; after receiving the test script corresponding to the function to be tested of the application to be tested and sent by the script generating device, the method further includes:

[0012] receiving user input for updating the test script;

[0013] In response to the update input, updating the test script;

[0014] The update input includes at least one of the following:

[0015] Add a judgment condition before any of the first test items;

[0016] Adjust the time interval between any two of the first test items.

[0017] In a possible implementation, the target test function includes a plurality of second test items, and the testing of the function to be tested of the application to be tested in the device to be tested based on the target test function includes:

[0018] Execute each of the second test items to obtain an intermediate test result corresponding to each of the second test items;

[0019] Taking a screenshot of the page where each intermediate test result is located to obtain a test picture corresponding to each intermediate test result;

[0020] Based on the multiple test pictures, the function to be tested of the application to be tested in the device to be tested is tested.

[0021] In a possible implementation, the second test item is used to test a click operation of the application to be tested, and the second test item includes a page to be tested and an element to be tested; and executing each of the second test items to obtain an intermediate test result corresponding to each of the second test items includes:

[0022] Searching for a target element matching the element to be tested in the page to be tested;

[0023] Obtaining coordinate information of the target element in the page to be tested;

[0024] Based on the coordinate information of the target element, a click operation is performed on the target element to obtain an intermediate test result corresponding to the click operation.

[0025] In a possible implementation, searching the page to be tested for a target element that matches the element to be tested includes:

[0026] Searching the page to be tested for at least one candidate element that satisfies a shape similarity condition with the element to be tested;

[0027] Performing text extraction on the element to be detected and the at least one candidate element respectively to obtain first text information corresponding to the element to be detected and second text information corresponding to each of the at least one candidate element;

[0028] Performing fuzzy matching on at least one of the second text information and the first text information respectively;

[0029] The candidate element corresponding to the second text information successfully matched with the first text information is determined as the target element.

[0030] In a possible implementation, before searching the page to be tested for at least one candidate element that satisfies a shape similarity condition with the element to be tested, the method further includes:

[0031] Based on an image recognition algorithm, searching for a target element matching the element to be tested in the page to be tested;

[0032] The step of searching, in the page to be tested, for at least one candidate element that satisfies a shape similarity condition with the element to be tested comprises:

[0033] In the case that the image recognition algorithm cannot find the target element, at least one candidate element that satisfies a shape similarity condition with the element to be tested is searched in the page to be tested.

[0034] In a possible implementation, the testing of the function to be tested of the application to be tested in the device to be tested based on the multiple test pictures includes:

[0035] In a case where there is a baseline picture set corresponding to the function to be tested, determining baseline pictures in the baseline picture set corresponding to the plurality of test pictures respectively;

[0036] Performing similarity matching on each of the test images and its corresponding baseline image to obtain a matching result;

[0037] Based on the matching result, generating a test report;

[0038] Based on the test report, the function to be tested of the application to be tested in the device to be tested is tested.

[0039] In a possible implementation, the testing the function to be tested of the application to be tested in the device to be tested based on the test report includes:

[0040] When the test report indicates that the similarity between the test picture and its corresponding baseline picture is less than a preset threshold, receiving a target operation of the user on the test picture;

[0041] In response to the target operation, updating the test report;

[0042] Based on the updated test report, testing the function to be tested of the application to be tested in the device to be tested;

[0043] The target operation includes any of the following:

[0044] Adding the test picture to the baseline picture set;

[0045] The test picture is used to replace the corresponding baseline picture in the baseline picture set.

[0046] In a possible implementation, there are multiple baseline images corresponding to the test image, and the testing of the function to be tested of the application to be tested in the device to be tested based on the updated test report includes:

[0047] Performing similarity matching between the test image and its corresponding multiple baseline images respectively to obtain matching results;

[0048] In a case where the matching result indicates that the test image matches any one of its corresponding baseline images, it is determined that the test result of the function to be tested corresponding to the test image is a test success.

[0049] In a second aspect, an embodiment of the present application provides a method for testing an application, which is applied to a script generation device, wherein a script generation application and an application to be tested are installed in the script generation device, and the method includes:

[0050] In response to a first input of a function to be tested being input by a user in the script generation application, determining the function to be tested;

[0051] In response to a test input of a user for the function to be tested in the application to be tested, acquiring a test parameter;

[0052] Generate a test script corresponding to the function to be tested of the application to be tested based on the test parameters by using the script generation application;

[0053] The test script is sent to the test device.

[0054] In a possible implementation, in response to a user inputting a first input of a function to be tested in the script generation application, after determining the function to be tested, the method further includes:

[0055] Generate an application through the script, and cover the application to be tested with a mask;

[0056] The acquiring of the test parameters in response to the user's test input for the function to be tested in the application to be tested comprises:

[0057] Based on the mask, receiving a test input from a user for the function to be tested in the application to be tested;

[0058] In response to the test input, a test parameter is obtained.

[0059] In a possible implementation, the function to be tested includes a plurality of operation attributes, the test parameters include a plurality of sub-test parameters corresponding to the plurality of operation attributes, and after the application is generated by the script and the mask is overlaid on the application to be tested, the method further includes:

[0060] Display floating controls;

[0061] The acquiring of the test parameters in response to the user's test input for the function to be tested in the application to be tested comprises:

[0062] In response to a second input of the user to the floating control, displaying a plurality of operation attribute controls, each of which corresponds to an operation attribute;

[0063] Receive a selection input of a target operation attribute control selected by a user from among the plurality of operation attribute controls, and a third input based on a target operation attribute in the page to be tested, wherein the target operation attribute is an operation attribute corresponding to the target operation attribute control;

[0064] Responsive to the selection input and the third input, obtaining a subtest parameter;

[0065] The test parameter is determined according to a plurality of the sub-test parameters corresponding to the plurality of operation attributes.

[0066] In a possible implementation, the step of generating the test script corresponding to the function to be tested of the application to be tested based on the test parameters by using the script to generate the application includes:

[0067] Generate test codes corresponding to the plurality of sub-test parameters respectively through the script generation application;

[0068] A test script corresponding to the function to be tested of the application to be tested is generated based on the plurality of test codes through the script generation application.

[0069] In a possible implementation, the operation attribute includes a click operation, and the third input includes an input of clicking an element to be tested on the page to be tested; and the acquiring of sub-test parameters in response to the selection input and the third input includes:

[0070] In response to the selection input and the third input, the script generation application performs the following operations:

[0071] Acquire an operation area corresponding to a user's click operation on the element to be tested;

[0072] Based on the click operation and the operation area, a sub-test parameter is obtained.

[0073] In a possible implementation, before sending the test script to the test device, the method further includes:

[0074] receiving a fourth input of device information input by a user in the script generation application;

[0075] In response to the fourth input, the test device is determined based on the device information.

[0076] In a third aspect, an embodiment of the present application provides an application testing device, which is applied to a testing device, and the device includes:

[0077] A first receiving module is used to receive a test script corresponding to a function to be tested of an application to be tested and sent by a script generating device, wherein the test script includes a device connection function and a test function; the application to be tested is installed in the device to be tested, the device connection function is used to connect the device to be tested based on an operating system of the device to be tested, and the device connection function includes sub-device connection functions corresponding to each of a plurality of operating systems; the test function is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes sub-test functions corresponding to each of the plurality of operating systems;

[0078] A connection module, used for connecting the device under test based on a target device connection function in the device connection function, wherein the target device connection function is any one of the plurality of sub-device connection functions;

[0079] A first determining module, configured to determine the operating system corresponding to the target device connection function as a target operating system;

[0080] The first determination module is further used to determine a target test function among the plurality of sub-test functions based on the target operating system;

[0081] The testing module is used to test the function to be tested of the application to be tested in the device to be tested based on the target testing function.

[0082] In a fourth aspect, an embodiment of the present application provides an application testing device, which is applied to a script generation device, wherein a script generation application and an application to be tested are installed in the script generation device, and the device includes:

[0083] a second determination module, configured to determine the function to be tested in response to a first input of the function to be tested input by a user in the script generation application;

[0084] An acquisition module, configured to acquire test parameters in response to a test input of a user for the function to be tested in the application to be tested;

[0085] A generating module, configured to generate an application through the script, and generate a test script corresponding to the function to be tested of the application to be tested based on the test parameters;

[0086] The sending module is used to send the test script to the test device.

[0087] In a fifth aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;

[0088] When the processor executes the computer program instructions, the method in any possible implementation method of the first aspect or the second aspect is implemented.

[0089] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement a method in any possible implementation method of the first aspect or the second aspect mentioned above.

[0090] In a seventh aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method in any possible implementation method of the first aspect or the second aspect mentioned above.

[0091] In an embodiment of the present application, the test script includes a device connection function, which is used to connect the device to be tested with the application to be tested installed based on the operating system of the device to be tested, and the device connection function includes a plurality of sub-device connection functions corresponding to each operating system. Therefore, by connecting the device to be tested based on any one of the sub-device connection functions in the device connection function, it is possible to achieve adaptive connection of the device to be tested with any operating system installed through a set of test scripts. In addition, the test script also includes a test function, which is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes a plurality of sub-test functions corresponding to each operating system. Therefore, by determining the target test function from the plurality of sub-test functions based on the target operating system of the device to be tested when the test device is successfully connected to the device to be tested, and testing the function to be tested of the application to be tested in the device to be tested based on the target test function, it is possible to achieve automated testing of the function to be tested of the application to be tested in the device to be tested with any operating system installed through a set of test scripts. That is, through the embodiments of the present application, it is possible to maintain a set of automated test scripts for the same function to be tested of the same application to be tested, thereby reducing the maintenance cost of the automated test scripts and further reducing the testing cost of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0092] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0093] Figure 1 It is a flowchart of a testing method for an application of a testing device provided in an embodiment of the present application;

[0094] Figure 2 It is a flowchart of a testing method for an application of a script generation device provided in an embodiment of the present application;

[0095] Figure 3 This is a schematic diagram of the interface of the first script generation device provided in an embodiment of the present application;

[0096] Figure 4 This is a schematic diagram of the interface of the second script generation device provided in the embodiment of the present application;

[0097] Figure 5 This is a schematic diagram of the interface of the third script generation device provided in the embodiment of the present application;

[0098] Figure 6 This is a schematic diagram of the interface of the fourth script generation device provided in the embodiment of the present application;

[0099] Figure 7 This is a schematic diagram of the interface of the fifth script generation device provided in the embodiment of the present application;

[0100] Figure 8 This is a schematic diagram of the interface of the sixth script generation device provided in an embodiment of the present application;

[0101] Fig. 9 It is a structural diagram of a test system for an application provided in an embodiment of the present application;

[0102] Fig.10 It is a flowchart of a test script generation process provided by an embodiment of the present application;

[0103] Fig.11 This is a flowchart of an automated testing process based on click operation provided by an embodiment of the present application;

[0104] Fig.12 It is a flowchart of an automated result judgment process provided by an embodiment of the present application;

[0105] Fig.13 is a schematic diagram of the structure of a test device for use in a test device provided in an embodiment of the present application;

[0106] Fig.14 is a structural schematic diagram of a testing device for an application of a script generation device provided in an embodiment of the present application;

[0107] Fig.15 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0108] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0109] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0110] In addition, the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0111] As mentioned in the background technology section, with the rapid development of application technology, the iteration and update of applications are becoming more and more frequent, and as a result, regression testing of applications is becoming more and more frequent. Regression testing is to retest the previous functions of the application to ensure that the newly added functions do not affect the previous functions.

[0112] Currently, regression testing methods include manual testing by users and automated testing through automated scripts. However, manual testing by users is time-consuming and labor-intensive, resulting in high labor costs for testing. In addition, as testers conduct repetitive testing for a long time, they lose sensitivity to page elements and are unable to capture changes in some details, leading to risks such as missed tests.

[0113] In addition, for different operating systems, such as Android, Hongmeng, and iPhone Operating System (IOS), the way of writing automated test scripts is often different, and the same application usually releases clients for different operating systems at the same time. Each operating system must maintain a set of automated test scripts separately, resulting in high maintenance costs for automated test scripts. In addition, testers often only have front-end functional testing skills, and writing automated test scripts requires a certain amount of learning costs. After the testers are replaced later, it becomes more difficult for newcomers to understand and maintain the scripts. The learning costs of testers and the maintenance costs of automated test scripts lead to high application testing costs.

[0114] In addition, it is difficult for current automated test scripts to determine the accuracy of test results. If the conditions for successful testing are set too loosely, the credibility of the case execution results will be insufficient, and there is a risk of missing defects; if the conditions are set too harshly, with the development and replacement of the business, the maintenance of the case will become extremely complicated, which will increase resource investment in disguise and is inconsistent with the original intention of automated testing.

[0115] In addition, the resolutions of different devices may be different, resulting in different display effects for the same content. For example, if the image is compressed or stretched, or the text is omitted, the script written based on device A will not run perfectly on device B. Each device also needs to maintain its own set of automated test scripts, resulting in high maintenance costs for automated test scripts.

[0116] In addition, during the testing process, when there are animated images on the application page, the existing automated testing framework cannot make a good judgment on whether the test results are correct.

[0117] In addition, current application testing includes asserting each clickable element in the application page to determine whether the element is abnormal. However, during the test, if the non-clickable area in the application page changes, it is not easy to be captured, and there may be a risk of missing the test.

[0118] Thus, in order to solve the problems of the prior art, the embodiments of the present application provide a method, apparatus, device, computer-readable storage medium and computer program product for testing an application. The method for testing an application can be applied to a scenario of performing automated testing on an application to be tested based on a test script.

[0119] In addition, the test method of the application can be executed by the test system of the application. The test system of the application may include a script generation device, a test device and a device to be tested. Among them, the device to be tested may be installed with an application to be tested. The script generation device can be used to generate a test script and send the test script to the test device. The test device can establish a communication connection with the device to be tested based on the test script, and perform regression testing on the application to be tested in the device to be tested. Among them, the test device and the script generation device can be a mobile phone, a tablet computer, a handheld computer, an in-vehicle electronic device, etc. The device to be tested and the script generation device can be the same or different, which is not limited here. In addition, the test device can be a server, a desktop computer, a laptop computer, etc.

[0120] The following is an introduction to the testing method for an application of a testing device provided in an embodiment of the present application.

[0121] Figure 1 FIG. 1 is a flow chart of a test method for an application of a test device provided in an embodiment of the present application. The test method for the application can be executed by the test device. Figure 1As shown, the application testing method provided in the embodiment of the present application includes the following steps:

[0122] S110, receiving a test script corresponding to the function to be tested of the application to be tested sent by the script generating device, the test script including a device connection function and a test function; the application to be tested is installed in the device to be tested, the device connection function is used to connect the device to be tested based on the operating system of the device to be tested, and the device connection function includes sub-device connection functions corresponding to each of the multiple operating systems; the test function is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes sub-test functions corresponding to each of the multiple operating systems;

[0123] S120, connecting the device under test based on a target device connection function in the device connection function, where the target device connection function is any one of the multiple sub-device connection functions;

[0124] S130, determining the operating system corresponding to the target device connection function as the target operating system;

[0125] S140, determining a target test function from a plurality of sub-test functions based on a target operating system;

[0126] S150 : Based on the target test function, test the function to be tested of the application to be tested in the device to be tested.

[0127] In an embodiment of the present application, the test script includes a device connection function, which is used to connect the device to be tested with the application to be tested installed based on the operating system of the device to be tested, and the device connection function includes a plurality of sub-device connection functions corresponding to each operating system. Therefore, by connecting the device to be tested based on any one of the sub-device connection functions in the device connection function, it is possible to achieve adaptive connection of the device to be tested with any operating system installed through a set of test scripts. In addition, the test script also includes a test function, which is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes a plurality of sub-test functions corresponding to each operating system. Therefore, by determining the target test function from the plurality of sub-test functions based on the target operating system of the device to be tested when the test device is successfully connected to the device to be tested, and testing the function to be tested of the application to be tested in the device to be tested based on the target test function, it is possible to achieve automated testing of the function to be tested of the application to be tested in the device to be tested with any operating system installed through a set of test scripts. That is, through the embodiments of the present application, it is possible to maintain a set of automated test scripts for the same function to be tested of the same application to be tested, thereby reducing the maintenance cost of the automated test scripts and further reducing the testing cost of the application.

[0128] The specific implementation methods of the above steps are introduced below.

[0129] In some embodiments, in S110, the script generation device may be a device for generating a test script, and a script generation application and an application to be tested may be installed in the script generation device. The script generation application may monitor the user's test input for the function to be tested in the application to be tested, obtain test parameters in response to the test input, and generate a test script corresponding to the function to be tested of the application to be tested based on the test parameters. The test parameters may include parameter information corresponding to the test content and the test method. That is, the test script may include the test content and the test method. In addition, the test script may include multiple first test items.

[0130] The following is a specific example to illustrate this.

[0131] For example, if the function to be tested is to test the transfer operation, the test script can be used to describe: 1) click the "transfer" icon on the first page, and after the application to be tested jumps to the second page corresponding to the transfer, take a screenshot of the second page; 2) click the "convert to bank card" icon on the second page, and after the application to be tested jumps to the third page corresponding to "convert to bank card", take a screenshot of the third page; 3) fill in the transfer information on the third page and click the "confirm transfer" icon, and after the application to be tested jumps to the fourth page corresponding to "transfer successful", take a screenshot of the fourth page. Among them, the multiple first test items may include test items corresponding to 1), 2), and 3). The test content may include testing the click operation on the "transfer" icon, testing the click operation on the "convert to bank card" icon, testing the filling operation of the transfer information, testing the click operation on the "confirm transfer" icon, etc. The test method may first test the click operation on the "transfer" icon, and then test the click operation on the "convert to bank card" icon, etc.

[0132] After generating the test script, the script generating device may send the test script to the testing device, so that the testing device can perform regression testing on the function to be tested of the application to be tested based on the test script.

[0133] In addition, as described above, the test script may be automatically generated by the script generation application based on the user's test input. Therefore, in order to make the test script more in line with the user's expectations and further improve the automated testing process, in some embodiments, after receiving the test script corresponding to the function to be tested of the application to be tested sent by the script generation device, the method may further include:

[0134] Receive user input for test script updates;

[0135] In response to the update input, updating the test script;

[0136] The update input includes at least one of the following:

[0137] Add a judgment condition before any first test item;

[0138] Adjust the time interval between any two first test items.

[0139] Here, in the actual test process, the test results may be affected by network problems. Therefore, in order to ensure the accuracy of the test results, the judgment condition can be used to determine whether the network is available. The added judgment condition can be, for example: after clicking an icon, if it has not jumped to the next page within 10 seconds, click the icon again; or, after clicking an icon, if the screenshot shows the words "Network Unavailable", click the icon again.

[0140] In addition, in the automatically generated test script, the time interval between two first test items may be 2 seconds by default. The user can modify the time interval between two first test items to 20 seconds to better meet the user's expectations.

[0141] As an example, when the test device is a server, after the server receives the test script, the user can open the test script on the server side and make custom modifications, so that subsequent automated tests can be performed based on the updated test script.

[0142] The embodiment of the present application updates the test script so that the test script can better meet user expectations and further improve the automated testing process.

[0143] On this basis, in order to implement the test device to test the application to be tested, the application to be tested can be installed in the device to be tested. That is, the device to be tested can be a device with the application to be tested installed. The device to be tested can include a script generation device.

[0144] The operating system of the device under test may be any one of Hongmeng OS, Android OS and IOS OS. Among them, Hongmeng OS can implement automated testing based on hypium framework. Android OS and IOS OS can implement automated testing based on Airtest framework. Since different operating systems use different frameworks for automated testing, the device connection code and test code in the test script are different for the same test content and test method.

[0145] Based on this, in order to realize the automated testing of the functions to be tested of the application to be tested in the device to be tested installed with any operating system through a set of test scripts, the embodiment of the present application encapsulates the device connection function and the test function in the test script. Among them, the device connection function can be used to connect the device to be tested based on the operating system of the device to be tested, and the device connection function can include sub-device connection functions corresponding to multiple operating systems. The device connection function can specifically be the device connection method connectDevice() method. The device connection function can specifically be encapsulated by the first sub-device connection function corresponding to the Hongmeng operating system, and the second sub-device connection function corresponding to the Android operating system and the IOS operating system.

[0146] In addition, the test function can be used to test the function to be tested of the application to be tested based on the operating system of the device to be tested. The test function can include sub-test functions corresponding to multiple operating systems.

[0147] As an example, the function to be tested may include multiple operation attributes. Multiple operation attributes may include click operation, sliding operation, input operation and key operation. Among them, the key operation may be a simulated key operation. In addition, the embodiment of the present application may take a screenshot of the intermediate test results of each step of the operation involved in the test process to determine the test results by taking a screenshot. Therefore, the test function may include test functions corresponding to multiple operation attributes, and the test function corresponding to each operation attribute may be encapsulated by the sub-test functions corresponding to each of the multiple operating systems. The test functions corresponding to multiple operation attributes may include, for example: touchAndSnapshot (click and screenshot), swipeAndSnapshot (slide and screenshot), keyeventAndSnapshot (simulate key operation and screenshot) and textAndSnapshot (input and screenshot).

[0148] In some embodiments, in S120, the test device may cyclically call multiple sub-device connection functions in the device connection function, and connect the devices to be tested based on the multiple sub-device connection functions respectively, until the test device and the device to be tested are successfully connected based on one of the sub-device connection functions (i.e., the target device connection function).

[0149] In some embodiments, in S130, based on the correspondence between the sub-device connection function and the operating system, the operating system corresponding to the target device connection function may be determined, and the operating system corresponding to the target device connection function may be determined as the target operating system.

[0150] In some embodiments, in S140, based on the correspondence between the operating system and the sub-test function, the sub-test function corresponding to the target operating system may be determined, and the test function corresponding to the target operating system may be determined as the target test function.

[0151] In some embodiments, in S150 , after the target test function is determined, the function to be tested of the application to be tested in the device to be tested may be tested based on the target test function.

[0152] The target test function may include multiple second test items. The test content of the second test item may be the same as that of the first test item, which will not be described in detail here. The coding method of the second test item may be determined based on the target operating system of the device under test.

[0153] Based on this, in order to ensure the integrity of the test and the accuracy of the test results, in some embodiments, the above S150 may specifically include:

[0154] Execute each second test item to obtain an intermediate test result corresponding to each second test item;

[0155] Take a screenshot of the page where each intermediate test result is located to obtain the test picture corresponding to each intermediate test result;

[0156] Based on multiple test images, the functions under test of the application under test in the device under test are tested.

[0157] Here, the second test item may include an operation attribute. The intermediate test result may be an execution result obtained after executing the operation corresponding to the operation attribute. For different operation attributes, the intermediate test results may be the same or different. For example, for a click operation, the intermediate test result may be a page jump result. For an input operation, the intermediate test result may be the input content.

[0158] The embodiment of the present application obtains a test image by taking a screenshot of the page where the intermediate test results are located, rather than only taking a screenshot of the elements to be tested involved in the operation corresponding to the operation attribute, and tests the functions to be tested of the application to be tested in the device to be tested based on the test image including the entire page. In each test, not only the elements to be tested but also the entire page where the elements to be tested are located can be focused on, thereby avoiding missed tests and ensuring the integrity of the test and the accuracy of the test results.

[0159] In some embodiments, the second test item can be used to test the click operation of the application to be tested, and the second test item can include the page to be tested and the element to be tested. The second test item can be specifically described as: in the page to be tested of the application to be tested, a click operation is performed on the target element that matches the element to be tested, and a screenshot is taken of the page that jumps after the click operation.

[0160] Based on this, in order to determine the intermediate test result corresponding to the click operation, in some embodiments, executing each second test item to obtain the intermediate test result corresponding to each second test item may specifically include:

[0161] Find the target element that matches the element to be tested in the page to be tested;

[0162] Get the coordinate information of the target element in the page to be tested;

[0163] Based on the coordinate information of the target element, a click operation is performed on the target element to obtain an intermediate test result corresponding to the click operation.

[0164] Here, the element to be tested may be an element to be click-tested included in the test script. The element to be tested may be a page element captured in a script generating device. The target element may be an element to be click-tested in a page to be tested of the application to be tested. The target element may be displayed in the device to be tested. Ideally, the target element and the element to be tested may be exactly the same. However, due to the different resolutions of different devices, the display effects of the same page element in different devices may be different, resulting in differences between the target element and the element to be tested. Therefore, if the target element matches the element to be tested, it can be determined that the target element and the element to be tested are the same page element.

[0165] After the target element is found, the coordinate information of the target element in the page to be tested can be obtained, and based on the coordinate information of the target element, a click operation is performed on the target element, thereby obtaining an intermediate test result corresponding to the click operation.

[0166] As an example, the method of searching for a target element that matches the element to be tested in the page to be tested can be: using the image recognition algorithm of the Airtest framework or the hypium framework to perform target matching and determine the target element that matches the element to be tested. However, as mentioned above, due to the different resolutions of different devices, the display effects of the same page element in different devices may be different, resulting in differences between the target element and the element to be tested. Therefore, the method of performing target matching based on the image recognition algorithm may not necessarily find the target element.

[0167] Based on this, in order to ensure the accuracy of searching for the target element, in some embodiments, searching for the target element matching the element to be tested in the page to be tested may specifically include:

[0168] Searching for at least one candidate element in the page to be tested that satisfies a shape similarity condition with the element to be tested;

[0169] Perform text extraction on the element to be tested and at least one candidate element respectively to obtain first text information corresponding to the element to be tested and second text information corresponding to at least one candidate element;

[0170] Performing fuzzy matching on at least one second text information and the first text information respectively;

[0171] The candidate element corresponding to the second text information that successfully matches the first text information is determined as the target element.

[0172] Here, the candidate element and the element to be detected satisfying the shape similarity condition may include that the similarity between the shapes of the candidate element and the element to be detected is greater than a shape similarity threshold, and the similarity between the sizes is greater than a size similarity threshold.

[0173] As an example, the YOLO11 target detection algorithm can be used to search for at least one candidate element in the page to be tested that meets the shape similarity condition with the element to be tested, and retain the coordinate information of the candidate element.

[0174] As a more specific example, the YOLO11 target detection algorithm adopts the Distribution Focal Loss (DFL) classification improvement method. The uniqueness of the regression task prediction makes it difficult for the model to accurately regress to the target value. Instead, the probability distribution is obtained to make the predicted value have a greater probability of being at the target, thereby achieving a method similar to "fuzzy" positioning to improve the speed of model convergence and the accuracy of the detection model.

[0175] The DFL formula in the YOLO11 target detection algorithm is shown in equations (1) and (2), and the cross entropy loss function is shown in equation (3):

[0176]

[0177] If the number of candidate elements is one, the candidate element can be determined as the target element. If the number of candidate elements is multiple, in order to avoid the inaccurate test results caused by the similar appearance of multiple candidate elements, the text information in the candidate elements can be identified by text recognition technology, and the unique target element can be determined based on the text information. Among them, the text recognition technology can be, for example, optical character recognition (OCR) technology. In addition, if the number of candidate elements is one, text recognition can also be performed on the candidate element, and whether the candidate element is the target element can be determined based on the identified text information to ensure the accuracy of the target element.

[0178] As an example, after determining at least one candidate element, at least one candidate element can be first intercepted from the page to be tested, and then the coordinate information of at least one candidate element on the page to be tested can be obtained, and then OCR text recognition can be performed on at least one candidate element to extract the second text information corresponding to each of the at least one candidate element. On the other hand, OCR text recognition is performed on the element to be tested to extract the first text information of the element to be tested. The at least one second text information is compared with the first text information respectively, and regular expressions are used to perform string fuzzy matching, and the candidate element corresponding to the second text information with the highest matching degree with the first text information is determined as the target element.

[0179] The embodiment of the present application can ensure the accuracy of finding the target element by first searching in the page to be tested at least one candidate element that meets the shape similarity condition with the element to be tested, and then determining the target element based on the matching degree of text information between the at least one candidate element and the element to be tested.

[0180] Based on this, in order to improve the search efficiency of the target element, in some embodiments, before searching the page to be tested for at least one candidate element that satisfies the shape similarity condition with the element to be tested, the method may further include:

[0181] Based on the image recognition algorithm, the target element matching the element to be tested is searched in the page to be tested.

[0182] Based on this, searching the page to be tested for at least one candidate element that satisfies a shape similarity condition with the element to be tested may specifically include:

[0183] When the image recognition algorithm cannot find the target element, at least one candidate element that satisfies the shape similarity condition with the element to be tested is searched in the page to be tested.

[0184] In an embodiment of the present application, the search process of the target element can be encapsulated as a function findImage(Image). The function findImage(Image) will first use the image recognition algorithm of airtest and hypium to match the target. When it returns no result found, it will use the above method (first search for at least one candidate element in the page to be tested that meets the shape similarity condition with the element to be tested, and then determine the target element based on the matching degree of the text information between at least one candidate element and the element to be tested) to find the target element and return the coordinates of the target element for clicking.

[0185] The embodiment of the present application can improve the efficiency of searching for target elements by preferentially searching for target elements based on an image recognition algorithm.

[0186] In addition, in order to ensure the accuracy of the test results, in some embodiments, the above-mentioned testing of the function to be tested of the application to be tested in the device to be tested based on multiple test pictures may specifically include:

[0187] In the case where there is a baseline picture set corresponding to the function to be tested, determining baseline pictures in the baseline picture set corresponding to the plurality of test pictures respectively;

[0188] Perform similarity matching on each test image and its corresponding baseline image to obtain a matching result;

[0189] Generate a test report based on the matching results;

[0190] Based on the test report, the functions under test of the application under test in the device under test are tested.

[0191] Here, the baseline picture set may include multiple baseline pictures. The baseline pictures may be used to determine the accuracy of the test pictures. If there is no baseline picture set corresponding to the function to be tested, it can be determined that in this regression test, it is the first time to test the function to be tested, and the first generated test picture set can be determined as the baseline picture set. In order to ensure the accuracy of the baseline picture set, the test picture set generated for the first time can be reviewed by the test personnel, and if the review is passed, the first generated test picture set can be determined as the baseline picture set.

[0192] After that, each time the test script is executed, multiple test images can be generated, and the baseline images in the baseline image set corresponding to the multiple test images are first determined, and then each test image is matched with its corresponding baseline image for similarity to obtain a matching result. Among them, the test image and its corresponding baseline image can belong to the same first test item. For example, if the operation attribute in the first test item is a click operation, the test image and its corresponding baseline image can be the image obtained by taking a screenshot of the entire page after the jump after performing the same click operation on the same element to be tested on the same page to be tested.

[0193] The test report may include the similarity between each test image and its corresponding baseline image. If the similarity is greater than or equal to a preset threshold, the test result of the function to be tested corresponding to the test image may be determined to be a test success. If the similarity is less than the preset threshold, the test result of the function to be tested corresponding to the test image may be determined to be a test failure.

[0194] The embodiment of the present application generates a test report based on the similarity between each test image and its corresponding baseline image, and tests the function to be tested of the application to be tested in the device to be tested based on the test report, thereby ensuring the accuracy of the test results.

[0195] In actual situations, there may be animated images on the page. If there are animated images on the page, for the same first test item, the test image and the baseline image may be accurate, but the test image is different from the baseline image. In addition, during regression testing, the application may be continuously updated, so if the test image is inconsistent with the baseline image, it may be caused by the application update.

[0196] Based on this, in order to further improve the accuracy of the test results, in some embodiments, the above-mentioned testing of the function to be tested of the application to be tested in the device to be tested based on the test report may specifically include:

[0197] When the test report indicates that the similarity between the test image and its corresponding baseline image is less than a preset threshold, receiving a target operation of the user on the test image;

[0198] In response to the target operation, updating the test report;

[0199] Based on the updated test report, test the functions to be tested of the application to be tested in the device to be tested;

[0200] The target operation includes any of the following:

[0201] Add the test image to the baseline image set;

[0202] Use the test image to replace its corresponding baseline image in the baseline image set.

[0203] Here, the user can determine whether the test image meets expectations based on the actual situation of the test image. If it is found that there is a dynamic image on the page when the test image is captured, it can be determined whether the test image matches the dynamic image. If they match, it indicates that both the test image and the baseline image meet the user's expectations, so the test image can be added to the baseline image collection.

[0204] In addition, if the user finds that the test image meets expectations but the baseline image does not meet expectations (caused by continuous updates of the application during regression testing), the test image can be used to replace the corresponding baseline image in the baseline image set.

[0205] The embodiment of the present application can take into account the scenario of continuous application update and the scenario of the presence of animated images in the page during the regression test process. In this way, by updating the test report based on user operations, and testing the tested function of the tested application in the tested device based on the updated test report, the accuracy of the test results can be further improved.

[0206] As mentioned above, in the scenario where there are animated images on the page, there may be multiple baseline images corresponding to the same test image.

[0207] Based on this, in order to further improve the accuracy of the test results, in some embodiments, the above-mentioned testing of the function to be tested of the application to be tested in the device to be tested based on the updated test report may specifically include:

[0208] Perform similarity matching between the test image and its corresponding multiple baseline images respectively to obtain matching results;

[0209] When the matching result indicates that the test image matches any one of its corresponding baseline images, it is determined that the test result of the function to be tested corresponding to the test image is a test success.

[0210] Here, if there are multiple baseline images corresponding to the test image, the test image and the multiple corresponding baseline images can be matched for similarity. If the similarity between the test image and any of its corresponding baseline images is greater than or equal to a preset threshold, the test result of the function to be tested corresponding to the test image can be determined to be a successful test.

[0211] The embodiment of the present application can further improve the accuracy of the test result by jointly determining the test result based on the matching result between the test image and its corresponding multiple baseline images in a scenario where there is a dynamic image on the page.

[0212] It should be noted that, in the embodiment of the present application, regression testing includes multiple tests on a function to be tested, and a test report can be generated for each test.

[0213] The following is an introduction to a test method for an application applied to a script generation device provided in an embodiment of the present application. The script generation device is installed with a script generation application and an application to be tested.

[0214] Figure 2 FIG. 1 is a flow chart of a method for testing an application of a script generating device provided in an embodiment of the present application. The method for testing the application can be executed by the script generating device. Figure 2 As shown, the application testing method provided in the embodiment of the present application includes the following steps:

[0215] S210, in response to a first input of a function to be tested being input by a user in a script generation application, determining the function to be tested;

[0216] S220, acquiring test parameters in response to a test input of a user for a function to be tested in the application to be tested;

[0217] S230, generating an application through a script, and generating a test script corresponding to the function to be tested of the application to be tested based on the test parameters;

[0218] S240: Send the test script to the test device.

[0219] The embodiment of the present application determines the function to be tested by responding to the first input of the function to be tested input by the user in the script generation application, and obtains the test parameters in response to the test input of the function to be tested by the user in the application to be tested. Through the script generation application, based on the test parameters, a test script corresponding to the function to be tested of the application to be tested is generated, and the test script can be automatically generated in response to the user operation without the need for the user to manually write it, so that the generated test script has universality. In addition, compared with manual writing by the user, the automatic generation of the test script improves the generation efficiency of the test script, reduces the learning cost of the user to learn how to write the test script, and thus reduces the testing cost of the application. In addition, by sending the test script to the test device, the automated testing of the function to be tested of the application to be tested in the device to be tested can be achieved through the test device.

[0220] The specific implementation methods of the above steps are introduced below.

[0221] In some embodiments, in S210, the user may first start the script generation application and the application to be tested in the script generation device. After starting the script generation application, Figure 3 As shown, the script generation application can display a prompt message of "Please enter the function to be tested" and an input box for entering the function to be tested. The first input can be an input of the function to be tested entered by the user in the input box. After the user enters the function to be tested and clicks "OK", the script generation device can determine the function to be tested.

[0222] In some embodiments, in S220, after the script generation device determines the function to be tested, it can receive the user's test input for the function to be tested in the application to be tested, and obtain test parameters in response to the test input. The test input may include clicking a certain image, inputting certain text, performing a sliding operation in a certain page of the application to be tested, simulating a certain key operation, etc. The test parameters may include clicked position information, clicked picture information, input text information, start and end position information of the sliding operation, specific key information, etc.

[0223] To better understand test input, let's take a concrete example.

[0224] For example, if the function to be tested is to test the transfer operation, the test input may include: 1) clicking the "transfer" icon on the first page, and after the application to be tested jumps to the second page corresponding to the transfer, 2) clicking the "convert to bank card" icon on the second page, and after the application to be tested jumps to the third page corresponding to "convert to bank card", 3) filling in the transfer information on the third page, and clicking the "confirm transfer" icon. Among them, the test parameters may include icon information corresponding to the "transfer" icon, the "convert to bank card" icon, the "confirm transfer" icon, etc., and the transfer information filled in by the user.

[0225] Based on this, in order to ensure accurate collection of the user's test input and thus ensure the accuracy of the automatically generated test script, in some embodiments, after the above S210, the method may further include:

[0226] Generate an application through a script and overlay the mask on the application to be tested.

[0227] Based on this, the above S220 may specifically include:

[0228] Based on the mask, receiving the user's test input for the function to be tested in the application to be tested;

[0229] In response to the test input, a test parameter is obtained.

[0230] Here, the mask can be used to collect the user's test input. After the script generation device determines the function to be tested, the script generation application can automatically retreat to the background and open a mask to cover the application to be tested.

[0231] In this way, the embodiment of the present application receives the user's test input for the function to be tested in the application to be tested based on the mask, which can ensure the accurate collection of the user's test input and further ensure the accuracy of the automatically generated test script.

[0232] In addition, as described above, the function to be tested may include multiple operation attributes, and the multiple operation attributes may include click operation, slide operation, input operation and simulated key operation. In addition, the test parameters may include multiple sub-test parameters corresponding to the multiple operation attributes.

[0233] Based on this, in order to ensure the accuracy of the test parameters, in some embodiments, after the application is generated by the script and the mask is covered on the application to be tested, the method may further include:

[0234] Display floating controls;

[0235] Based on this, the above S220 may specifically include:

[0236] In response to a second input of the user to the floating control, a plurality of operation attribute controls are displayed, each operation attribute control corresponding to an operation attribute;

[0237] Receiving a selection input of a user selecting a target operation attribute control from among a plurality of operation attribute controls, and a third input based on the target operation attribute in the page to be tested, where the target operation attribute is an operation attribute corresponding to the target operation attribute control;

[0238] Responsive to the selection input and the third input, obtaining a subtest parameter;

[0239] The test parameters are determined according to the multiple sub-test parameters corresponding to the multiple operation attributes.

[0240] Here, the script-generated application can automatically retreat to the background and open a mask to cover the application under test, such as Figure 4 As shown, a floating control 41 may also be displayed on the desktop of the device under test. The floating control may be used to control the start and end of collecting the test input of the user.

[0241] The second input may be an input when the user clicks on the floating control. After the user clicks on the floating control, on the one hand, the user's test input can be collected; on the other hand, Figure 5 As described above, operation attribute controls corresponding to a plurality of operation attributes may be displayed.

[0242] After multiple operation attribute controls are displayed, the user can click any one of the multiple operation attribute controls. The operation attribute control clicked by the user is the target operation attribute control.

[0243] As an example, if the target operation attribute control is an input control, the third input may be an input of text information entered by the user in the input box. After the user clicks the input control, a Figure 6 The user can enter text information in the input box. In addition, after the user clicks the input control, the current page can be exited and the page to be tested in the application to be tested can be displayed. The user can enter text information in the input box of the page to be tested. In addition, the sub-test parameter can include the input text information.

[0244] As an example, if the target operation attribute control is a click control, the third input may be an input of a user clicking on an element to be tested in a page to be tested of the application to be tested. In addition, the sub-test parameters may include clicked position information and clicked image information.

[0245] As an example, if the target operation attribute control is a sliding control, the third input may be a sliding input of the user in the page to be tested of the application to be tested. In addition, the sub-test parameter may include the start and end position information of the sliding operation.

[0246] As an example, if the target operation attribute control is a simulated key control, the third input may be a simulated key input by the user. After the user clicks the simulated key control, a Figure 7 The interface shown in the figure. The user can select one or more keys to simulate a single key press or a combination of key presses. In addition, the sub-test parameters can include key press information.

[0247] The embodiment of the present application determines the test parameters according to a plurality of sub-test parameters corresponding to a plurality of operation attributes, thereby ensuring the accuracy of the test parameters.

[0248] In addition, as described above, the operation attribute may include a click operation, and the third input may include an input of clicking the element to be tested on the page to be tested.

[0249] Based on this, in order to ensure the accuracy of the sub-test parameters, in some embodiments, the above-mentioned obtaining of the sub-test parameters in response to the selection input and the third input may specifically include:

[0250] In response to the selection input and the third input, the script generation application performs the following operations:

[0251] Get the operation area corresponding to the user's click operation on the element to be tested;

[0252] Get subtest parameters based on the click operation and operation area.

[0253] Here, the script generation application can monitor the coordinates of the user's click, determine the 1 square centimeter area around the coordinates as the operation area, capture the image in the operation area as the element to be tested, and determine the image information of the element to be tested as the sub-test parameter.

[0254] In some embodiments, in S230, after the test parameters are obtained, an application can be generated through a script, and the test parameters can be filled into a pre-set code framework to generate a test script corresponding to the function to be tested of the application to be tested.

[0255] As an example, after the operation is completed, the user can long press the floating control to make the script generation application finish collecting user input and generate a test script based on the test parameters.

[0256] Based on this, in order to ensure the accuracy of the test script, in some embodiments, the above S230 may specifically include:

[0257] Generate test codes corresponding to multiple sub-test parameters respectively through script generation application;

[0258] A test script corresponding to the function to be tested of the application to be tested is generated based on a plurality of test codes through a script generation application.

[0259] As an example, if the operation attribute is a click operation, the script generation application can monitor the coordinates of the user's click, and capture a 1 square centimeter image around the coordinates as the click target, that is, the element to be tested, and then generate a test code for clicking the element to be tested and taking a screenshot of the page to be tested after clicking the element to be tested. The code generation format of the test code can be pre-generated. Generating the test code can specifically be filling the element to be tested into the pre-generated code generation format.

[0260] As an example, if the operation attribute is a key operation, the script generation application can automatically fill in the key option selected by the user in the preset code corresponding to the key operation to generate a test code. The preset code corresponding to the key operation can be a pre-set code generation format for executing the key operation.

[0261] As an example, if the operation attribute is a sliding operation, the script generation application can automatically fill in the start and end coordinates of the user operation in the preset code corresponding to the sliding operation to generate the test code. The preset code corresponding to the sliding operation can be a pre-set code generation format for performing the sliding operation.

[0262] As an example, if the operation attribute is an input operation, the script generation application can automatically fill in the text input by the user in the preset code corresponding to the input operation to generate the test code. The preset code corresponding to the input operation can be a pre-set code generation format for performing the input operation.

[0263] The embodiment of the present application generates a test script corresponding to the function to be tested of the application to be tested based on multiple test codes, thereby ensuring the accuracy of the test script.

[0264] In some embodiments, in S240 , after the test script is generated, the test script may be sent to the test device.

[0265] Based on this, in order to implement sending the test script to the test device, in some embodiments, before the above S240, the method may further include:

[0266] receiving a fourth input of device information input by a user in the script generation application;

[0267] In response to a fourth input, a test device is determined based on the device information.

[0268] Here, if the test device is a server, the device information may include a server address and a server directory. The fourth input may be an input of the device information input by a user in the script generation application.

[0269] As an example, after the user opens the script generation application, the script generation application may first display the following Figure 8 The device information input interface shown in the figure can also be displayed after the user long presses the floating control and ends the test input. Figure 8 The device information input interface shown is not limited here. Users can Figure 8 The device input interface shown is used to input device information. After the user clicks the "OK" control, the script generation device can determine the test device based on the device information, thereby sending the test script to the test device after the test script is generated.

[0270] In order to better describe the entire solution, some specific examples are given based on the above embodiments.

[0271] For example, Fig. 9 As shown, the application testing system 900 in the embodiment of the present application may include an automated script generation module 91 , an automated case execution module 92 and an automated result determination module 93 .

[0272] In the automation script generation module, the user first selects the scenario that needs to be automated (i.e. the function to be tested), then starts recording user operations, and automatically generates a python automation script and uploads it to the server. The user can make some fine-tuning to the script as needed.

[0273] The automated case execution module encapsulates methods for connecting to iOS, Android, and Hongmeng devices, so users do not need to worry about device connections. After the automated task is started, the deep learning image comparison solution will be used to automatically find the images in the script on devices with different operating systems and resolutions, and complete the click operation. After the script is completed, the running screenshots of each step will be transmitted to the automated result judgment module.

[0274] In the automated result judgment module, the baseline image of each test task (i.e., the execution result image that the user considers to be correct) is maintained. When a new automated test task is completed, the newly generated result image will be compared with the baseline image. If it reaches the preset threshold, it is considered to have passed the comparison. If it does not reach the set threshold, it will be sent to the user through the result report. Through the report, the user can confirm whether the failed image also meets expectations. If it does, the image can be added to the baseline or the baseline image can be replaced.

[0275] In the automated script generation module, the test script generation process can be as follows: Fig.10 As shown:

[0276] S101, start script generation application and application to be tested;

[0277] S102, the user selects a function to be tested in the script generation application and clicks a start generation button (i.e., a floating control);

[0278] S103, the user selects an operation mode: click, slide, input or simulate key press;

[0279] S104, the user performs corresponding operations in the application to be tested based on the operation mode;

[0280] S105. The user completes all test operations and clicks the end button (such as long pressing the floating control);

[0281] S106, the script generation application automatically generates a test script related to all operations of the user from the beginning to the end, and transmits the test script to the server;

[0282] S107: The user fine-tunes the test script in the server to obtain a final test script.

[0283] In the embodiment of the present application, after the script generation application is started, it will retreat to the background and cover the application under test with a mask. Through this mask, the user's operation on the application under test is monitored. After capturing the user's click or slide operation, the code will be generated locally according to the pre-set code format. After the user operation is completed, the module will transfer the generated code file to the server background. After the user gets the file, he can fine-tune the code, such as increasing the waiting time between steps or adding judgment conditions, etc., to achieve automatic generation of test scripts.

[0284] In the automated case execution module, the click-based automated testing process can be Fig.11 As shown:

[0285] S111, start the automated testing task;

[0286] S112, automatically connecting the device to be tested through the device connection method encapsulated in the test script, determining the target operating system of the device to be tested, and switching to the driver corresponding to the target operating system to execute the relevant script function for testing the click operation;

[0287] S113, performing image matching based on deep learning algorithms (including image recognition algorithms, YOLO11 target detection algorithms, and OCR algorithms), searching for target elements that are consistent in the page to be tested and the test script, and performing a click operation;

[0288] S114, completing a click operation on a target element matching the element to be tested in the test script;

[0289] S115, packaging the full-page screenshots of each step in the script execution process and sending them to the automatic result determination module.

[0290] The embodiments of the present application adopt deep learning technology combined with OCR and target detection algorithms to improve the success rate of matching screenshots in automation codes under different systems and resolution environments; and encapsulate the functions and methods of connecting test devices of different operating systems (Android, IOS, Hongmeng) for unified processing, automatically adapt to the corresponding drivers, and make it user-friendly; at the same time, operations such as clicking, sliding, inputting, and simulating keys on different operating systems are also encapsulated into a unified function to reduce learning costs, so that one set of code can be used on all ends.

[0291] In the automatic result judgment module, the automatic result judgment process can be as follows Fig.12As shown:

[0292] S121, decompressing the picture collection sent by the automated case execution module;

[0293] S122, determining whether there is a baseline image set under the automated test task, if not, executing S123, if yes, executing S124;

[0294] S123, determining the picture set as a baseline picture set;

[0295] S124, performing similarity matching between each test image in the image set and its corresponding baseline image;

[0296] S125, generating a test report based on the similarity matching result;

[0297] S126, determining whether there is a test image in the test report whose similarity is lower than a preset threshold, if yes, executing S127, if no, ending;

[0298] S127, determining whether the test image meets expectations, if not, executing S128, if yes, executing S129;

[0299] S128, troubleshooting failure reasons;

[0300] S129: Replace the original baseline image with the test image or add the test image to the baseline image set.

[0301] In an embodiment of the present application, each time the automated script runs a round, a screenshot of the page after each step of the run will be generated. The screenshot completed for the first execution will be used as the baseline, and the results of each subsequent run will be matched with the baseline image through the image recognition algorithm. If the match fails, the user can view the reason through the report. If the user thinks that the current result is also in line with expectations, the image can be added to the baseline. After the next script run, the result will be matched with all the images in the baseline. As long as one of them is matched, it is considered successful. Through multiple baselines, the success rate of animated scene can be greatly improved; through full page comparison, the risk of missing page elements can be minimized.

[0302] In summary, compared with the traditional regression testing method, the embodiment of the present application has the following advantages:

[0303] (1) Testers only need to operate the application to be tested, and the background will automatically generate the corresponding automated test code. It supports Hongmeng, Android and IOS systems, which is easy to use and has a low learning cost. Since the automated code is uniformly generated and the code style is unified, new employees can quickly master it after the handover;

[0304] (2) The same set of code can run on devices with different operating systems and different resolutions at the same time. By combining deep learning algorithms, the target detection success rate can reach more than 96%, greatly improving the stability of script operation and reducing the maintenance cost of the script;

[0305] (3) The proposed multi-baseline graph solution can better adapt to the scenario where the page contains animated images. Compared with the existing solution, the more animated images the page contains, the greater the advantage of this solution in result judgment, and the judgment success rate is at least doubled. At the same time, based on full-page image comparison, it can better identify changes in any area of ​​the entire page, which can minimize the risk of missing page elements.

[0306] Based on the test method for an application of a test device provided in the above embodiment, the present application also provides a specific implementation of a test device for an application of a test device. Please refer to the following embodiment.

[0307] like Fig.13 As shown, the application testing device 1300 provided in the embodiment of the present application includes the following modules:

[0308] The first receiving module 1310 is used to receive a test script corresponding to the function to be tested of the application to be tested and sent by the script generating device, the test script including a device connection function and a test function; the application to be tested is installed in the device to be tested, the device connection function is used to connect the device to be tested based on the operating system of the device to be tested, and the device connection function includes sub-device connection functions corresponding to each of the multiple operating systems; the test function is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes sub-test functions corresponding to each of the multiple operating systems;

[0309] A connection module 1320, configured to connect the device under test based on a target device connection function in the device connection function, where the target device connection function is any one of the multiple sub-device connection functions;

[0310] A first determining module 1330, configured to determine the operating system corresponding to the target device connection function as the target operating system;

[0311] The first determination module 1330 is further configured to determine a target test function from among the plurality of sub-test functions based on the target operating system;

[0312] The testing module 1340 is used to test the function to be tested of the application to be tested in the device to be tested based on the target test function.

[0313] The test device 1300 of the above application is described in detail below, as shown below:

[0314] In some embodiments, the test script includes a plurality of first test items. Based on this, the application test device 1300 may further include:

[0315] The first receiving module is further used to receive a user's update input on the test script after receiving the test script corresponding to the function to be tested of the application to be tested sent by the script generating device;

[0316] An update module, for updating the test script in response to an update input;

[0317] The update input includes at least one of the following:

[0318] Add a judgment condition before any first test item;

[0319] Adjust the time interval between any two first test items.

[0320] In some embodiments, the target test function includes multiple second test items. Based on this, the test module 1340 may specifically include:

[0321] An execution submodule, used for executing each second test item and obtaining an intermediate test result corresponding to each second test item;

[0322] The screenshot submodule is used to take a screenshot of the page where each intermediate test result is located to obtain the test picture corresponding to each intermediate test result;

[0323] The test submodule is used to test the functions to be tested of the application to be tested in the device to be tested based on multiple test images.

[0324] In some embodiments, the second test item is used to test the click operation of the application to be tested, and the second test item includes the page to be tested and the element to be tested. Based on this, the execution submodule may specifically include:

[0325] A search unit, used to search for a target element matching the element to be tested in the page to be tested;

[0326] An acquisition unit, used to acquire the coordinate information of the target element in the page to be tested;

[0327] The click unit is used to perform a click operation on the target element based on the coordinate information of the target element, and obtain an intermediate test result corresponding to the click operation.

[0328] In some embodiments, the searching unit may specifically include:

[0329] A search subunit, used to search in the page to be tested at least one candidate element that satisfies a shape similarity condition with the element to be tested;

[0330] An extraction subunit is used to perform text extraction on the element to be detected and at least one candidate element respectively, to obtain first text information corresponding to the element to be detected and second text information corresponding to each of the at least one candidate element;

[0331] A matching subunit, used for performing fuzzy matching on at least one second text information and the first text information respectively;

[0332] The determination subunit is used to determine the candidate element corresponding to the second text information that successfully matches the first text information as the target element.

[0333] In some embodiments, the searching unit may further include:

[0334] The search subunit is also used to search for a target element matching the element to be tested in the page to be tested based on an image recognition algorithm before searching for at least one candidate element that meets a shape similarity condition with the element to be tested in the page to be tested; when the image recognition algorithm cannot find the target element, search for at least one candidate element that meets a shape similarity condition with the element to be tested in the page to be tested.

[0335] In some embodiments, the test submodule may specifically include:

[0336] A determination unit, configured to determine, when there is a baseline picture set corresponding to the function to be tested, baseline pictures in the baseline picture set corresponding to the plurality of test pictures respectively;

[0337] A matching unit, used to perform similarity matching between each test image and its corresponding baseline image to obtain a matching result;

[0338] A generating unit, used for generating a test report based on the matching result;

[0339] The test unit is used to test the function to be tested of the application to be tested in the device to be tested based on the test report.

[0340] In some embodiments, the test unit may specifically include:

[0341] A receiving subunit, configured to receive a target operation of a user on a test image when the test report indicates that the similarity between the test image and its corresponding baseline image is less than a preset threshold;

[0342] An updating subunit, used for updating the test report in response to the target operation;

[0343] The test subunit is used to test the function to be tested of the application to be tested in the device to be tested based on the updated test report;

[0344] The target operation includes any of the following:

[0345] Add the test image to the baseline image set;

[0346] Use the test image to replace its corresponding baseline image in the baseline image set.

[0347] In some embodiments, there are multiple baseline images corresponding to the test image. Based on this, the test subunit can be specifically used for:

[0348] Perform similarity matching between the test image and its corresponding multiple baseline images respectively to obtain matching results;

[0349] When the matching result indicates that the test image matches any one of its corresponding baseline images, it is determined that the test result of the function to be tested corresponding to the test image is a test success.

[0350] In an embodiment of the present application, the test script includes a device connection function, which is used to connect the device to be tested with the application to be tested installed based on the operating system of the device to be tested, and the device connection function includes a plurality of sub-device connection functions corresponding to each operating system. Therefore, by connecting the device to be tested based on any one of the sub-device connection functions in the device connection function, it is possible to achieve adaptive connection of the device to be tested with any operating system installed through a set of test scripts. In addition, the test script also includes a test function, which is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes a plurality of sub-test functions corresponding to each operating system. Therefore, by determining the target test function from the plurality of sub-test functions based on the target operating system of the device to be tested when the test device is successfully connected to the device to be tested, and testing the function to be tested of the application to be tested in the device to be tested based on the target test function, it is possible to achieve automated testing of the function to be tested of the application to be tested in the device to be tested with any operating system installed through a set of test scripts. That is, through the embodiments of the present application, it is possible to maintain a set of automated test scripts for the same function to be tested of the same application to be tested, thereby reducing the maintenance cost of the automated test scripts and further reducing the testing cost of the application.

[0351] Based on the test method for an application applied to a script generation device provided in the above embodiment, the present application also provides a specific implementation of a test device for an application applied to a script generation device. Please refer to the following embodiment. The script generation device is installed with a script generation application and an application to be tested.

[0352] like Fig.14 As shown, the application testing device 1400 provided in the embodiment of the present application includes the following modules:

[0353] The second determination module 1410 is configured to determine the function to be tested in response to a first input of the function to be tested input by a user in the script generation application;

[0354] An acquisition module 1420 is used to acquire test parameters in response to a test input of a user for a function to be tested in the application to be tested;

[0355] A generating module 1430, configured to generate an application through a script, and based on the test parameters, generate a test script corresponding to the function to be tested of the application to be tested;

[0356] The sending module 1440 is used to send the test script to the test device.

[0357] The test device 1400 of the above application is described in detail below, as shown below:

[0358] In some of the embodiments, the application testing device 1400 may further include:

[0359] The covering module is used for covering the application to be tested with a mask by using the script generating application after determining the function to be tested in response to a first input of the function to be tested input by the user in the script generating application.

[0360] Based on this, the acquisition module 1420 may specifically include:

[0361] A receiving submodule, used for receiving a test input for a function to be tested in the application to be tested by a user based on a mask;

[0362] The acquisition submodule is used to acquire test parameters in response to the test input.

[0363] In some embodiments, the function to be tested includes multiple operation attributes, and the test parameter includes multiple sub-test parameters corresponding to the multiple operation attributes. Based on this, the applied test device 1400 may also include:

[0364] The display module is used to display the floating control after the application is generated through the script and the mask is covered on the application to be tested.

[0365] Based on this, the acquisition module 1420 may specifically include:

[0366] A display submodule, configured to display a plurality of operation attribute controls in response to a second input of the user to the floating control, each operation attribute control corresponding to an operation attribute;

[0367] The receiving submodule is further used to receive a selection input of a user selecting a target operation attribute control from a plurality of operation attribute controls, and a third input based on the target operation attribute in the page to be tested, where the target operation attribute is an operation attribute corresponding to the target operation attribute control;

[0368] The acquisition submodule is further used to acquire sub-test parameters in response to the selection input and the third input;

[0369] The determination submodule is further used to determine the test parameters according to the multiple sub-test parameters corresponding to the multiple operation attributes.

[0370] In some embodiments, the generating module 1430 may specifically include:

[0371] A generation submodule, used to generate an application through a script, and generate test codes corresponding to a plurality of sub-test parameters;

[0372] The generation submodule is further used to generate an application through a script, and to generate a test script corresponding to the function to be tested of the application to be tested based on multiple test codes.

[0373] In some embodiments, the operation attribute includes a click operation, and the third input includes an input of clicking an element to be tested on the page to be tested.

[0374] Based on this, the acquisition submodule may specifically include:

[0375] The execution unit is configured to, in response to the selection input and the third input, generate the following operations through the script application:

[0376] Get the operation area corresponding to the user's click operation on the element to be tested;

[0377] Get subtest parameters based on the click operation and operation area.

[0378] In some of the embodiments, the application testing device 1400 may further include:

[0379] A second receiving module, configured to receive a fourth input of device information input by a user in a script generation application before sending the test script to the test device;

[0380] The second determination module is further configured to determine the test device based on the device information in response to a fourth input.

[0381] The embodiment of the present application determines the function to be tested by responding to the first input of the function to be tested input by the user in the script generation application, and obtains the test parameters in response to the test input of the function to be tested by the user in the application to be tested. Through the script generation application, based on the test parameters, a test script corresponding to the function to be tested of the application to be tested is generated, and the test script can be automatically generated in response to the user operation without the need for the user to manually write it, so that the generated test script has universality. In addition, compared with manual writing by the user, the automatic generation of the test script improves the generation efficiency of the test script, reduces the learning cost of the user to learn how to write the test script, and thus reduces the testing cost of the application. In addition, by sending the test script to the test device, the automated testing of the function to be tested of the application to be tested in the device to be tested can be achieved through the test device.

[0382] Based on the application testing method provided in the above embodiment, the embodiment of the present application also provides a specific implementation of the electronic device. Fig.15 A schematic diagram of an electronic device 1500 provided in an embodiment of the present application is shown.

[0383] The electronic device 1500 may include a processor 1510 and a memory 1520 storing computer program instructions.

[0384] Specifically, the processor 1510 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0385] The memory 1520 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1520 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 1520 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 1520 may be inside or outside the electronic device 1500. In a particular embodiment, the memory 1520 is a non-volatile solid-state memory.

[0386] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present application.

[0387] The processor 1510 implements any one of the application testing methods in the above embodiments by reading and executing computer program instructions stored in the memory 1520 .

[0388] In one example, the electronic device 1500 may further include a communication interface 1530 and a bus 1540. Fig.15 As shown, the processor 1510, the memory 1520, and the communication interface 1530 are connected via a bus 1540 and communicate with each other.

[0389] The communication interface 1530 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0390] Bus 1540 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1540 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.

[0391] Exemplarily, the electronic device 1500 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).

[0392] The electronic device can execute the test method of the application in the embodiment of the present application, thereby realizing the combination Figures 1 to 14 Describe the applied test methods and apparatus.

[0393] In addition, in combination with the application test method in the above embodiment, the present application embodiment can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any application test method in the above embodiment is implemented.

[0394] In combination with the application testing method in the above embodiments, the present application embodiment may provide a computer program product to implement the above embodiments. When the instructions in the computer program product are executed by a processor of an electronic device, the application testing method in any one of the above embodiments is implemented.

[0395] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0396] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0397] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0398] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.

[0399] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A testing method for application, characterized in that: Applied to testing equipment, the method comprises: A test script corresponding to a function to be tested of an application to be tested and sent by a script generating device is received, wherein the test script includes a device connection function and a test function; the application to be tested is installed in the device to be tested, the device connection function is used to connect the device to be tested based on an operating system of the device to be tested, and the device connection function includes sub-device connection functions corresponding to each of a plurality of operating systems; the test function is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes sub-test functions corresponding to each of the plurality of operating systems; Connecting the device under test based on a target device connection function in the device connection function, wherein the target device connection function is any one of the plurality of sub-device connection functions; Determine the operating system corresponding to the target device connection function as the target operating system; Based on the target operating system, determining a target test function among the plurality of sub-test functions; Based on the target test function, the function to be tested of the application to be tested in the device to be tested is tested.

2. The method according to claim 1, characterized in that The test script includes a plurality of first test items; After receiving the test script corresponding to the function to be tested of the application to be tested sent by the script generating device, the method further includes: receiving user input for updating the test script; In response to the update input, updating the test script; The update input includes at least one of the following: Add a judgment condition before any of the first test items; Adjust the time interval between any two of the first test items.

3. The method according to claim 1, characterized in that The target test function includes a plurality of second test items, and the testing of the function to be tested of the application to be tested in the device to be tested based on the target test function includes: Execute each of the second test items to obtain an intermediate test result corresponding to each of the second test items; Taking a screenshot of the page where each intermediate test result is located to obtain a test picture corresponding to each intermediate test result; Based on the multiple test pictures, the function to be tested of the application to be tested in the device to be tested is tested.

4. The method according to claim 3, characterized in that The second test item is used to test the click operation of the application to be tested, and the second test item includes a page to be tested and an element to be tested; The executing each of the second test items to obtain an intermediate test result corresponding to each of the second test items includes: Searching for a target element matching the element to be tested in the page to be tested; Obtaining coordinate information of the target element in the page to be tested; Based on the coordinate information of the target element, a click operation is performed on the target element to obtain an intermediate test result corresponding to the click operation.

5. The method according to claim 4, characterized in that The step of searching the page to be tested for a target element that matches the element to be tested includes: Searching the page to be tested for at least one candidate element that satisfies a shape similarity condition with the element to be tested; Performing text extraction on the element to be detected and the at least one candidate element respectively to obtain first text information corresponding to the element to be detected and second text information corresponding to each of the at least one candidate element; Performing fuzzy matching on at least one of the second text information and the first text information respectively; The candidate element corresponding to the second text information successfully matched with the first text information is determined as the target element.

6. The method according to claim 5, characterized in that Before searching the page to be tested for at least one candidate element that satisfies a shape similarity condition with the element to be tested, the method further includes: Based on an image recognition algorithm, searching for a target element matching the element to be tested in the page to be tested; The step of searching, in the page to be tested, for at least one candidate element that satisfies a shape similarity condition with the element to be tested comprises: In the case that the image recognition algorithm cannot find the target element, at least one candidate element that satisfies a shape similarity condition with the element to be tested is searched in the page to be tested.

7. The method according to any one of claims 3 to 6, characterized in that: The testing of the function to be tested of the application to be tested in the device to be tested based on the multiple test pictures includes: In a case where there is a baseline picture set corresponding to the function to be tested, determining baseline pictures in the baseline picture set corresponding to the plurality of test pictures respectively; Performing similarity matching on each of the test images and its corresponding baseline image to obtain a matching result; Based on the matching result, generating a test report; Based on the test report, the function to be tested of the application to be tested in the device to be tested is tested.

8. The method according to claim 7, characterized in that The testing of the function to be tested of the application to be tested in the device to be tested based on the test report includes: When the test report indicates that the similarity between the test picture and its corresponding baseline picture is less than a preset threshold, receiving a target operation of the user on the test picture; In response to the target operation, updating the test report; Based on the updated test report, testing the function to be tested of the application to be tested in the device to be tested; The target operation includes any of the following: Adding the test picture to the baseline picture set; The test picture is used to replace the corresponding baseline picture in the baseline picture set.

9. The method according to claim 8, characterized in that There are multiple baseline images corresponding to the test image, and the testing of the function to be tested of the application to be tested in the device to be tested based on the updated test report includes: Performing similarity matching between the test image and its corresponding multiple baseline images respectively to obtain matching results; In a case where the matching result indicates that the test image matches any one of its corresponding baseline images, it is determined that the test result of the function to be tested corresponding to the test image is a test success.

10. A testing method for application, characterized in that: Applied to a script generation device, wherein a script generation application and an application to be tested are installed in the script generation device, the method comprises: In response to a first input of a function to be tested being input by a user in the script generation application, determining the function to be tested; In response to a test input of a user for the function to be tested in the application to be tested, acquiring a test parameter; Generate a test script corresponding to the function to be tested of the application to be tested based on the test parameters by using the script generation application; The test script is sent to the test device.

11. The method according to claim 10, characterized in that In response to a user inputting a first input of a function to be tested in the script generation application, after determining the function to be tested, the method further includes: Generate an application through the script, and cover the application to be tested with a mask; The acquiring of the test parameters in response to the user's test input for the function to be tested in the application to be tested comprises: Based on the mask, receiving a test input from a user for the function to be tested in the application to be tested; In response to the test input, a test parameter is obtained.

12. The method according to claim 11, characterized in that The function to be tested includes a plurality of operation attributes, the test parameters include a plurality of sub-test parameters corresponding to the plurality of operation attributes, and after the application is generated by the script and the mask is covered on the application to be tested, the method further includes: Display floating controls; The acquiring of the test parameters in response to the user's test input for the function to be tested in the application to be tested comprises: In response to a second input of the user to the floating control, a plurality of operation attribute controls are displayed, each of which corresponds to an operation attribute; Receive a selection input of a target operation attribute control selected by a user from among the plurality of operation attribute controls, and a third input based on a target operation attribute in the page to be tested, wherein the target operation attribute is an operation attribute corresponding to the target operation attribute control; Responsive to the selection input and the third input, obtaining a subtest parameter; The test parameter is determined according to a plurality of the sub-test parameters corresponding to the plurality of operation attributes.

13. The method according to claim 12, characterized in that The step of generating an application through the script and generating a test script corresponding to the function to be tested of the application to be tested based on the test parameters includes: Generate test codes corresponding to the plurality of sub-test parameters respectively through the script generation application; A test script corresponding to the function to be tested of the application to be tested is generated based on the plurality of test codes through the script generation application.

14. The method according to claim 12, characterized in that The operation attribute includes a click operation, and the third input includes an input of clicking an element to be tested on the page to be tested; and the sub-test parameter is obtained in response to the selection input and the third input, including: In response to the selection input and the third input, the script generation application performs the following operations: Acquire an operation area corresponding to a user's click operation on the element to be tested; Based on the click operation and the operation area, a sub-test parameter is obtained.

15. The method according to any one of claims 10 to 14, characterized in that: Before sending the test script to the test device, the method further includes: receiving a fourth input of device information input by a user in the script generation application; In response to the fourth input, the test device is determined based on the device information.

16. A testing device for application, characterized in that: Applied to testing equipment, the device comprises: A first receiving module is used to receive a test script corresponding to a function to be tested of an application to be tested and sent by a script generating device, wherein the test script includes a device connection function and a test function; the application to be tested is installed in the device to be tested, the device connection function is used to connect the device to be tested based on an operating system of the device to be tested, and the device connection function includes sub-device connection functions corresponding to each of a plurality of operating systems; the test function is used to test the function to be tested of the application to be tested based on the operating system of the device to be tested, and the test function includes sub-test functions corresponding to each of the plurality of operating systems; A connection module, used for connecting the device under test based on a target device connection function in the device connection function, wherein the target device connection function is any one of the plurality of sub-device connection functions; A first determining module, configured to determine the operating system corresponding to the target device connection function as a target operating system; The first determination module is further used to determine a target test function among the plurality of sub-test functions based on the target operating system; The testing module is used to test the function to be tested of the application to be tested in the device to be tested based on the target testing function.

17. A testing device for application, characterized in that: Applied to a script generation device, wherein a script generation application and an application to be tested are installed in the script generation device, the device comprises: a second determination module, configured to determine the function to be tested in response to a first input of the function to be tested input by a user in the script generation application; An acquisition module, configured to acquire test parameters in response to a test input of a user for the function to be tested in the application to be tested; A generating module, configured to generate an application through the script, and generate a test script corresponding to the function to be tested of the application to be tested based on the test parameters; The sending module is used to send the test script to the test device.

18. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the test method for the application as described in any one of claims 1-9 or 10-15 is implemented.

19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the test method for the application described in any one of claims 1-9 or 10-15 is implemented.

20. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the test method for the application as described in any one of claims 1-9 or 10-15.

Citation Information

Patent Citations

  • UI test method and device, electronic equipment and computer readable storage medium

    CN109840201A

  • Test script recording method, application program test method and related devices

    CN110716853A

  • Interface interaction test method, device, equipment and storage medium

    CN113836037A

  • Test method and device suitable for multiple operating systems

    CN113986751A

  • Automated test on applications or websites in mobile devices

    US20150026665A1