Test method, device, electronic device and storage medium
By querying and receiving element positioning information of target page elements from the server, the problem of frequent changes in icons in user interface automation testing is solved, and the effect of reducing labor costs and improving testing efficiency is achieved.
Patent Information
- Application Number
- CN202110501156.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-08
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2041-05-08
AI Technical Summary
In user interface automation testing, application icons are frequently changed, resulting in frequent modification of test scripts, which increases labor costs and maintenance costs, and is inefficient.
By sending the current version information of the target page element to the server, querying and receiving the corresponding element positioning information, and using this information to test the test equipment, the element positioning information of the page element is centrally managed and maintained in the server.
It reduces the cost of page elements maintenance and update efficiency during the testing process, improves testing efficiency, reduces manual maintenance costs, and improves the adaptability to frequently changing page elements.
Smart Images

Figure CN113190451B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to application testing technology, page development technology, etc., and specifically to a testing method, device, electronic device and storage medium. Background Art
[0002] With the development of computer technology and the diversification of terminal functions, more and more application icons are used on the user interface, and the styles of the same icon change frequently.
[0003] When developers conduct click tests on icons on the user interface, they can use the test tool to generate user click operations and act on the corresponding position of the icon to simulate the effect of the user clicking the icon. The test tool needs to obtain the accurate position of the icon before it can generate the user click operation. Summary of the invention
[0004] The present application provides a testing method, device, electronic device and storage medium.
[0005] According to one aspect of the present application, a testing method is provided, comprising:
[0006] Sending current version information corresponding to the target page element to the server, so that the server queries the element location information corresponding to the current version information;
[0007] Receiving element location information sent by the server;
[0008] The test equipment is tested according to the element positioning information.
[0009] According to another aspect of the present application, a testing method is provided, comprising:
[0010] Receive the current version information corresponding to the target page element sent by the client,
[0011] Querying the element location information of the target page element under the current version information, and determining the element location information corresponding to the current version information;
[0012] The corresponding element location information is sent to the client, so that the client tests the test device according to the corresponding element location information.
[0013] According to another aspect of the present application, a testing device is provided, comprising:
[0014] A current version information sending module, used to send the current version information corresponding to the target page element to the server, so that the server queries the element location information corresponding to the current version information;
[0015] An element location information receiving module, used for receiving the element location information sent by the server;
[0016] The page function testing module is used to test the testing device according to the element positioning information.
[0017] According to another aspect of the present application, a testing device is provided, comprising:
[0018] The current version information receiving module is used to receive the current version information corresponding to the target page element sent by the client;
[0019] An element location information query module, used to query the element location information of the target page element under the current version information, and determine the element location information corresponding to the current version information;
[0020] The element positioning information feedback module is used to send the corresponding element positioning information to the client, so that the client tests the test device according to the corresponding element positioning information.
[0021] According to another aspect of the present application, there is provided an electronic device, including:
[0022] at least one processor; and
[0023] a memory communicatively connected to the at least one processor; wherein,
[0024] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the testing method described in any embodiment of the present application.
[0025] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the test method described in any embodiment of the present application.
[0026] According to another aspect of the present application, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the test method described in any embodiment of the present application is implemented.
[0027] The embodiments of the present application can reduce the maintenance and update efficiency costs of page elements during the testing process and improve testing efficiency.
[0028] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0030] Figure 1 is a schematic diagram of a testing method according to an embodiment of the present application;
[0031] Figure 2 is a schematic diagram of a testing method according to an embodiment of the present application;
[0032] Figure 3 is a schematic diagram of a method for storing element location information according to an embodiment of the present application;
[0033] Figure 4 is a schematic diagram of a method for acquiring element positioning information according to an embodiment of the present application;
[0034] Figure 5 is a schematic diagram of a testing method according to an embodiment of the present application;
[0035] Figure 6 is a schematic diagram of a testing method according to an embodiment of the present application;
[0036] Figure 7 is a schematic diagram of a testing method according to an embodiment of the present application;
[0037] Figure 8 is a schematic diagram of a testing device according to an embodiment of the present application;
[0038] Fig. 9 is a schematic diagram of a testing device according to an embodiment of the present application;
[0039] Fig.10 It is a block diagram of an electronic device used to implement the testing method of an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0041] Figure 1This is a flow chart of a test method disclosed in an embodiment of the present application. This embodiment can be applied to obtain the location information of the page element and simulate the user's triggering operation of the page element when testing the page element function of the test device. The method of this embodiment can be executed by a test device, which can be implemented in software and / or hardware, and is specifically configured in an electronic device with a certain data computing capability, which can be a client device, a mobile phone, a tablet computer, a vehicle terminal, a desktop computer, etc.
[0042] S101, sending current version information corresponding to a target page element to a server, so that the server queries element location information corresponding to the current version information.
[0043] The server is used to store the element location information of the page elements, and stores the element location information of multiple page elements and the element location information of the page elements under various version information. The server can be understood as a cloud database, which is used to store, modify, query and delete element location information. The page element can refer to a component unit of the user interface. The page element can refer to an object that a user can operate in the user interface. When the operation object is clicked, slid or detected, the page element corresponding to the operation object is actually operated. Exemplarily, the page element may include an icon, a table or an area, etc., which are displayed on the user interface in the form of a page element. For example, the page element is an icon of an application or an avatar of a chat object. The element location information is used to uniquely identify the page element. The page element is a visual image on the user interface and is in a fixed position on the user interface, and this information can uniquely determine the page element and can be used as the element location information of the page element. The current version information is used to identify the element location information to identify the page element corresponding to the element location information. For example, the current version information is used to identify the element location information of the same application under different versions, and the page element can be uniquely determined according to the element location information. The current version information is a query parameter of the element location information. The client can also send other query parameters corresponding to the target page element to the server, so that the server can query the element location information corresponding to the target page element in combination with the current version information. Other query parameters refer to query parameters other than the current version information. Exemplarily, other query parameters include at least one of the following: identification information of the test script file, identification information of the execution step, and information of the test device, etc.
[0044] The element location information may include at least one of the following: an image of the page element, area information of the page element, and identification information of the page element. The image of the page element may refer to an image obtained by intercepting the page element in the user interface image. The area information of the page element may refer to the position information of the page element in the user interface image. Exemplarily, the position information may be determined by key points (e.g., two diagonal vertices) of the rectangular area of the image including the page element. The identification information of the page element may refer to information that distinguishes the page element, for example, the identification number (Identity, ID) of the page element in the user interface image, wherein the same page element may have different identification numbers in different user interface images.
[0045] S102: Receive element location information sent by the server.
[0046] The server queries the element location information based on the current version information and feeds it back to the client.
[0047] S103: Testing the test equipment according to the element positioning information.
[0048] The element location information is also used to test the test device, so as to query the corresponding target page element in the user interface according to the element location information, and generate a simulated user trigger operation on the target page element for the target page element, and act on the target page element in the test device to test the function of the test device, for example, the function may include a system function, and / or the function of the application corresponding to the target page element, etc. The client can generate a simulated user trigger operation on the target page element through a test module. The client is connected to the test device for communication. The test module of the client can simulate the operation of the user operating the test device. The test device is a device for the function to be tested, and the test device can display a user interface image. Exemplarily, the client is configured in a desktop computer, and the test device is a mobile terminal electrically connected to the desktop computer, such as a mobile phone or a tablet computer.
[0049] In a specific example, to test the chat function of an application, for example, the chat message sending function in application A, you need to (1) click the icon of application A on the user interface to jump to the application page, (2) click the chat object icon on the application page to jump to the chat page, (3) click the dialog box on the chat page, (4) enter the test text in the dialog box, and (5) click the send icon to complete the sending of the chat message. Among them, the icon of application A, the chat object icon, the dialog box, and the send icon are all page elements of the page they are on. For example, the icon of application A is a page element of the user interface; the chat object icon is a page element of the application page; the dialog box is a page element of the chat page; and the send icon is a page element of the chat page.
[0050] In the prior art, application icons on the user interface of mobile terminals change frequently. For example, the icon of an e-commerce application will adjust the icon image with holidays. When testing the automated user interface of a mobile terminal, frequent changes in application icons require manual modification of the test script accordingly, and the positioning data of the application icon must be maintained before the test module can correctly locate the application icon in the user interface, simulate user operations, act on the application icon, and perform subsequent functional tests. Frequent changes in application icons result in high labor and maintenance costs for testing, and manual modifications are inefficient.
[0051] According to the technical solution of the present application, by sending the current version information corresponding to the target page element to the server, receiving the element location information corresponding to the current version information fed back by the server, and providing the element location information to the test module to test the test device, the latest version of the element location information can be obtained through the server during the testing of the test device, so as to accurately locate the target page element to implement the triggering operation of the target page element, thereby accurately implementing the functional test of the test device, and the element location information of the page elements can be centrally managed and maintained in the server, reducing the labor cost of maintaining the page elements and improving the maintenance and update efficiency of the page elements.
[0052] Figure 2It is a flowchart of another test method disclosed in the embodiment of the present application, which is further optimized and expanded based on the above technical solution, and can be combined with the above optional implementation methods. Sending the current version information corresponding to the target page element to the server, specifically: executing the execution steps in the test script file with the target page element as the operation object, obtaining the current version information corresponding to the target page element; sending the current version information corresponding to the target page element to the server; and, according to the element positioning information, testing the test device, specifically: according to the element positioning information, continue to execute the execution steps in the test script file with the target page element as the operation object, call the test module, and test the test device.
[0053] S201, sending current version information corresponding to a target page element to a server, so that the server queries element location information corresponding to the current version information.
[0054] S202: Receive element location information sent by the server.
[0055] S203: Test the test equipment according to the element positioning information.
[0056] S204: Acquire a user interface image of the test device.
[0057] The user interface image may refer to an image of a user interface generated by the test device, which may be displayed on a display screen of the test device. Exemplarily, the user interface image may be a user interface image of an Android operating system.
[0058] S205: Detect the target page element in the user interface image to obtain element update information.
[0059] The element update information is used to update the element location information corresponding to the target page element in the server. The element update information may refer to the element location information corresponding to the target page element under the current version information. Detecting the target page element in the user interface image may include image detection, location detection, and identification detection, etc. Specifically, at least one of the information such as the image of the target page element, the area of the target page element in the user interface image, and the identification information of the target page element in the user interface may be obtained and determined as the element update information.
[0060] Optionally, the testing method also includes: sending the current version information corresponding to the target page element to the server, including: executing the execution steps in the test script file with the target page element as the operation object, and obtaining the current version information corresponding to the target page element; sending the current version information corresponding to the target page element to the server; testing the test device according to the element positioning information, including: continuing to execute the execution steps in the test script file with the target page element as the operation object according to the element positioning information, calling the test module, and testing the test device.
[0061] The test script file is used to be executed by the client to implement automated testing of the test device, where automated testing refers to automated testing of the user interface. The test script file includes multiple execution steps. The test script file is configured with identification information to distinguish different test script files. Each execution step is configured with identification information to distinguish different execution steps. Different execution steps are used to test different functions. For example, different page elements can be used as operation objects for operation, or different trigger operations can be performed on the same page element to test different functions, etc.
[0062] The execution step with the target page element as the operation object is used to execute the trigger operation of the target page element. When the execution step is executed, the version information of the application represented by the target page element on the user interface of the test device is obtained, the current version information corresponding to the target page element is determined, and sent to the server, the element location information of the target page element sent by the server is received, and the test module is called according to the element location information, and the user trigger operation is generated to act on the target page element.
[0063] In addition, when the execution step for which the target page element is the operation object is completed, the next execution step in the test script file is continued to be executed.
[0064] By executing the test script file and when executing the execution steps with the target page element as the operation object, the current version information is obtained and sent, the element location information is obtained, and the test module is called to test the test equipment. During the execution of the test script file, the element location information is obtained and automated testing is performed. In the scenario of automated testing application, the automatic acquisition of element location information can be achieved, which can reduce the labor cost of automated testing, improve the adaptability of automated testing to different frequently changing page elements, and improve the stability of the automated testing system and the test accuracy.
[0065] In a specific example, Figure 3 As shown, the method for storing element location information in the process of writing a test script file may include:
[0066] S210, write a test script file.
[0067] The user enters the code and writes the test script file.
[0068] S211, confirm the clicked icon.
[0069] On the user interface of the test device, determine the icon of the application that is clicked as a page element, where the click can be replaced by other triggering operations such as sliding.
[0070] S212, record the icon of the clicked area, and execute S213 and S214.
[0071] The icon of the recorded clicked area may refer to information such as the identification information of the test script file, the identification information of the execution step, the information of the test device, the current version information, and the element location information. The identification information of the test script file uniquely identifies the test script file. The identification information of the execution step uniquely identifies the execution step. The information of the test device may include the device model or size, etc. The current version information may refer to the version model of the application to be tested, and the icon of the application to be tested in the user interface is the target page element.
[0072] S213, generating a test script file locally.
[0073] The user continues to input code, write test script files, complete the development process, and generate test script files.
[0074] S214, cloud storage.
[0075] The identification information of the test script file, the identification information of the execution steps, the information of the test device, the current version information and the element location information are uploaded to the server for storage.
[0076] S215, record data and configure the upper limit value of weight.
[0077] The server stores information such as identification information of the test script file, identification information of the execution step, information of the test device, current version information, and element location information, and configures the weight value of the element location information to be the upper limit of the weight, such as 100.
[0078] In a specific example, Figure 4 As shown, the method for obtaining element location information during the execution of the test script file may include:
[0079] S220, executing the test script file.
[0080] The client executes the test script file.
[0081] S221, executing the execution step with the target page element as the operation object.
[0082] The client executes the execution steps in the test script file in sequence. The client executes the execution step with the target page element as the operation object.
[0083] S222: Obtain element location information of the target page element.
[0084] The client obtains the element location information of the target page element by interacting with the server.
[0085] S223, click the target page element according to the element location information.
[0086] The client calls the test module based on the element location information, generates simulated user click operations, and clicks the target page elements.
[0087] S224, execution completed, report generated.
[0088] The client executes all execution steps in the test script file and generates a test report. The test report is used for the execution results of each execution step, as well as exception location information, etc.
[0089] S225: Query element location information based on the received current version information and provide feedback.
[0090] The server interacts with the client to obtain the current version information of the target page element, as well as the identification information of the test script file, the identification information of the execution steps, and the information of the test device, etc., and queries the corresponding element location information in the pre-stored multiple element location information and feeds it back to the client.
[0091] Optionally, when the test script file is executed, the test method further includes: generating and displaying an element update information confirmation item for the execution steps with the target page element as the operation object; receiving user input information for the element update information confirmation item; and sending the input information of the element update information confirmation item to the server, so that the server updates the element location information of the target page element under the current version information.
[0092] The element update information confirmation item is used by the user to determine whether the element update information is the element location information of the target page element under the current version information. The element update information confirmation item corresponds to the execution step, and for each execution step with the page element as the operation object, an element update information confirmation item of the page element is configured. The input information is used by the server to determine whether the element update information is the element location information of the target page element under the current version information. Exemplarily, the element update information confirmation item includes: a confirmation button and a denial button, and the input information is which button the user inputs the trigger operation (click or press, etc.). When the user clicks the confirmation button, it indicates that the element update information is determined to be the element location information of the target page element under the current version information, and the server can store the element update information as the element location information of the target page element under the current version information; when the user clicks the denial button, it indicates that the element update information is not determined to be the element location information of the target page element under the current version information, and the server can use the historically stored element location information as the element location information of the target page element under the current version information.
[0093] By obtaining the user's element update information confirmation item for the target page element, the element positioning information of the target page element under the current version information stored on the server is updated. The element positioning information of the target page element under the current version information can be quickly adjusted manually, and the element positioning information of the target page element under the current version information stored in the server can be corrected. The manual intervention option is added to improve the accuracy of the element positioning information.
[0094] S206: Send the element update information to the server, so that the server updates the element location information of the target page element under the current version information according to the element update information.
[0095] The server stores element location information of the same page element in different versions. The element location information of the target page element in the server is updated through element update information. The element location information stored in the server can be automatically updated in real time, reducing the labor cost of updating the element location information and improving the updating efficiency of the element location information.
[0096] Optionally, testing the test device according to the element positioning information includes: calling a test module according to the element positioning information, and testing the test device, the test module being used to generate a user-triggered operation according to the element positioning information, and acting on the test device to operate the target page element in the user interface.
[0097] The user trigger operation is used to trigger the target page element on the user interface of the test device, such as clicking, sliding or detecting operations. The user trigger operation is different from the actual operation performed by the user on the user interface. The user trigger operation is an operation generated by the test module to simulate the actual operation of the user. In fact, on the user interface, when the operation object is clicked and other operations are performed, the page element corresponding to the operation object is actually operated. The test module can query the target page element on the user interface according to the element positioning information, and determine the target page element as the operation object, and generate a trigger operation that simulates the user, and act on the target page element. The test module may include an adb command module or a monkeyrunner module, etc.
[0098] User-triggered operations are generated through the test module and act on the test device to trigger the target page elements on the user interface of the test device. User operations can be simulated to implement functional testing of the test device, realize automated testing, improve test efficiency, and reduce test labor costs.
[0099] According to the technical solution of the present application, by detecting the target page elements, element update information is obtained and sent to the server to update the element positioning information corresponding to the target page elements stored on the server, thereby realizing real-time updating of the element positioning information of the page elements, reducing the labor cost of updating the element positioning information, and improving the updating efficiency of the element positioning information.
[0100] Figure 5 This is a flow chart of a test method disclosed in an embodiment of the present application. This embodiment can be applied to the case of obtaining version information of page elements from a client and feeding back element location information when testing page element functions of a test device. The method of this embodiment can be executed by a test device, which can be implemented in software and / or hardware and is specifically configured in an electronic device with certain data computing capabilities, which can be a server-side device.
[0101] S301, receiving current version information corresponding to a target page element sent by a client.
[0102] Reference may be made to the preceding description for similar or identical features.
[0103] S302: Query the element location information of the target page element under the current version information, and determine the element location information corresponding to the current version information.
[0104] The element location information of the target page element can be queried through the current version information. In addition, the server can also receive other query parameters sent by the client, and in combination with the current version information, query the element location information of the target page element under the current version information. Other query parameters include at least one of the following: identification information of the test script file, identification information of the execution step, and information of the test equipment, etc. If the server does not store the element location information under the current version information, the server can query the element location information under the historical version information stored historically to determine the element location information corresponding to the current version information.
[0105] S303: Send the corresponding element location information to the client, so that the client tests the test device according to the corresponding element location information.
[0106] According to the technical solution of the present application, the current version information of the target page element is received by the server, and the corresponding element location information is queried and sent to the client. During the testing process of the test device, the latest version of the element location information can be sent to the client, so as to accurately locate the target page element to implement the trigger operation of the target page element, thereby realizing the functional testing of the test device. At the same time, the element location information of the page elements is centrally managed and maintained in the server, reducing the labor cost of maintaining the page elements and improving the maintenance and update efficiency of the page elements.
[0107] Figure 6 It is a flowchart of another test method disclosed in the embodiment of the present application, which is further optimized and expanded based on the above technical solution, and can be combined with the above optional implementation methods. Determine the element location information corresponding to the current version information, specifically: when the query result is not empty, obtain the element location information of the target page element under the current version information; when the query result is empty, query the element location information of the target page element under the historical version information, and determine the element location information corresponding to the current version information, and the historical version information and the current version information are adjacent version information.
[0108] S401, receiving current version information corresponding to a target page element sent by a client.
[0109] S402: Query the element location information of the target page element under the current version information.
[0110] S403: When the query result is not empty, obtain the element location information of the target page element under the current version information.
[0111] If the query result is not empty, it indicates that the server has stored the element location information of the target page element under the current version information. When the server has stored multiple element location information of the target page element under the current version information, it can filter one element location information according to the weight value configured for each element location information and feed it back to the client.
[0112] S404, when the query result is empty, query the element location information of the target page element under the historical version information, and determine the element location information corresponding to the current version information, the historical version information and the current version information are adjacent version information.
[0113] The query result is empty, indicating that the server does not store the element location information of the target page element under the current version information. The historical version information may refer to the version information before the current version information, and the release time is adjacent to the release time of the current version information, that is, there is no other version information between the historical version information and the current version information.
[0114] In fact, the element location information under the historical version information is the same or similar to the element location information under the current version information. When the query result is empty, the element location information under the historical version information can be provided to the client in advance, which can avoid no information provision and improve the stability of automated testing.
[0115] Optionally, the querying of the element location information of the target page element under the historical version information and determining the element location information corresponding to the current version information includes: obtaining the weight values configured for each element location information of the target page element under the historical version information; selecting the element location information with the highest weight value, and determining it to be stored as the element location information corresponding to the current version information; configuring the weight value of the element location information with the highest weight value as a first weight value, and the first weight value is less than the upper limit value of the weight.
[0116] There are multiple element location information of the target page element under the historical version information, and different element location information are configured with different weight values. The weight value configured for the element location information is used to filter out the element location information of the target page element under a certain version information, wherein the filtered element location information is the element location information that best represents the target page element under the version information, such as the element location information that most accurately locates the target page element, and / or the element location information that is most similar to the visual image of the target page element. The element location information with the highest weight value may refer to the element location information that best represents the target page element under the historical version information.
[0117] The element location information with the highest weight value is stored as the element location information corresponding to the current version information. The next time the element location information corresponding to the current version information is queried, the element location information corresponding to the current version information can be directly obtained, thereby realizing the iteration from the element location information corresponding to the historical version information to the element location information corresponding to the current version information, realizing automatic generation of the element location information corresponding to the current version information, and avoiding manual addition of the element location information corresponding to the current version information.
[0118] Configuring the weight value of the element locating information with the highest weight value as the first weight value means that while the element locating information with the highest weight value is stored as the element locating information corresponding to the current version information, the first weight value is configured for the element locating information corresponding to the current version information. The upper weight limit value is the maximum weight of the element locating information. The weight value of the element locating information can be changed, but will not be greater than the upper weight limit value. Configuring the weight value of the element locating information with the highest weight value as the first weight value that is less than the upper weight limit value can configure a higher weight value for more accurate element locating information when updating the element locating information corresponding to the current version information, so that the server can filter out the most accurate element locating information based on the higher weight value and provide it to the client, thereby improving the accuracy of generating and updating the element locating information.
[0119] By configuring weight values for element location information, and when the element location information corresponding to the current version information is not stored, the element location information under the historical version information is used as the element location information corresponding to the current version information, and a first weight value that is less than the upper limit of the weight is configured, modification space is provided for the subsequent addition of more accurate element location information corresponding to the current version information, so that the server can update and iterate to obtain more accurate element location information corresponding to the current version information, realize automatic updating and adaptation to the modified content of the element location information, improve the modification accuracy of the element location information, and thus improve the testing accuracy of the client.
[0120] S405: Send the corresponding element location information to the client, so that the client tests the test device according to the corresponding element location information.
[0121] Optionally, the testing method further includes: receiving element update information corresponding to the target page element; and updating element location information of the target page element under the current version information according to the element update information.
[0122] Updating the element location information of the target page element under the current version information according to the element update information means storing the element update information as the element location information under the current version, detecting the page elements on the user interface of the test device, obtaining accurate element location information as the element update information, and storing it in the server as the element location information under the current version, and updating the element location information under the current version information in real time according to the changes of the page elements. If the element location information identical to the element update information has been pre-stored under the current version, the element update information does not need to be stored repeatedly.
[0123] By updating the element location information under the current version information according to the element update information sent by the client, the update real-time of the element location information under the current version information is improved. The most accurate element location information under the current version information is provided to the client, thereby ultimately improving the test accuracy of the client.
[0124] Optionally, updating the element location information of the target page element under the current version information according to the element update information includes: when there is target element location information that is the same as the element update information under the current version information of the target page element, increasing the weight value of the target element location information; when each element location information of the target page element under the current version information is different from the element update information, determining the element update information as the element location information under the current version for storage, configuring a second weight value, and reducing the weight value of each element location information under the current version information.
[0125] The target element location information is the same as the element update information. The target element location information is the element location information of the target page element under the current version information. The existence of the target element location information indicates that the element update information is the same as a certain element location information stored under the current version information, so that the target element location information is the element location information that best represents the target page element among all the element location information under the current version information. Increasing the weight value of the target element location information is used to increase the probability that the server determines the target element location information as the element location information under the current version information and sends it to the client.
[0126] Each element location information under the current version information is different from the element update information, indicating that the element update information is new element location information under the current version information. The element update information is added to each element location information under the current version information, and a second weight value is configured for the element update information. The second weight value can be configured arbitrarily, and can be the same as or different from the first weight value. Reducing the weight value of each element location information under the current version information is used to reduce the probability that the server determines the element location information other than the element update information as the element location information under the current version information and sends it to the client.
[0127] By relatively increasing the weight value of the element update information and / or relatively reducing the weight values of other element location information based on whether the element update information is stored as the detection result of each element location information under the current version information, the probability of the element update information being used as the element location information under the current version information and sent to the client is increased, and / or the probability of other element location information being used as the element location information under the current version information and sent to the client is reduced. According to the element update information, continuous iteration is performed to increase the weight value of the element update information so that the server finally selects the element update information to send to the client, thereby updating the element location information of the target page element, improving the accuracy of the automatically updated element location information, improving the real-time update of the element location information, and improving the adaptation efficiency of the automated test.
[0128] Optionally, the testing method also includes: upon receiving input information of the element update information confirmation item, configuring the weight value of the element update information to a weight upper limit value; and reducing the configured weight value for other element location information of the target page element except the element update information under the current version information.
[0129] The server receives input information of the element update information confirmation item, indicating that the manually determined element update information best represents the element location information of the target page element. The weight value of the element update information is configured as the upper limit value of the weight, and the weight value of other element location information except the element update information is reduced, which can increase the weight value of the element update information and reduce the weight value of other element location information, increase the probability that the element update information is used as the element location information under the current version information and sent to the client to the maximum probability, and reduce the probability that other element location information is used as the element location information under the current version information and sent to the client.
[0130] By updating the element positioning information of the target page element under the current version information stored in the server according to the input information, the element positioning information of the target page element under the current version information can be quickly adjusted manually, the element positioning information of the target page element under the current version information stored in the server can be corrected, and a manual intervention option can be added to further improve the accuracy of the element positioning information. Through manual adjustment, the iteration speed can be increased, and the updating efficiency of the element positioning information can be improved.
[0131] In a specific example, Figure 7 As shown, the method for adaptively updating element positioning information includes:
[0132] S410, executing the test script file.
[0133] S411, executing the execution step with the target page element as the operation object.
[0134] S412, obtaining element location information of the target page element.
[0135] The client sends the current version information to the server and obtains the element location information under the current version information fed back by the server.
[0136] S413, querying the element location information of the target page element under the current version information.
[0137] The server queries the element location information of the target page element under the current version information.
[0138] S414, determine whether there is element location information under the current version information; if yes, execute S416; otherwise, execute S415.
[0139] The server queries the element location information of the target page element under the current version information.
[0140] S415 , copy the element location information with the highest weight value in the historical version information as the element location information in the current version information, and configure the weight value to be 90.
[0141] The upper limit of the weight is 100. When the query result is empty, the server queries the element location information of the target page element under the historical version information, and determines the element location information corresponding to the current version information. The historical version information and the current version information are adjacent version information.
[0142] S416, obtaining element location information under the current version information.
[0143] When the query result is not empty, the server obtains the element location information of the target page element under the current version information.
[0144] S417, click the target page element according to the element positioning information.
[0145] The client calls the test module based on the element location information, generates simulated user click operations, and clicks the target page elements.
[0146] S418, generating element update information.
[0147] The client obtains the user interface image of the test device; detects the target page element in the user interface image to obtain element update information.
[0148] S419, cloud storage.
[0149] The client uploads the element update information to the server for storage.
[0150] S420, determine whether there is the same element location information; if yes, execute S421; otherwise, execute S422.
[0151] The server determines whether the target page element has target element location information that is the same as the element update information under the current version information.
[0152] S421, weight of element location information*1.2.
[0153] When the target element location information that is the same as the element update information exists in the target page element under the current version information, the server increases the weight value of the target element location information.
[0154] S422, the weight of the element update information is 50, and the weight of the remaining element positioning information is -10.
[0155] When the element location information of the target page element under the current version information is different from the element update information, the server determines the element update information as the element location information under the current version for storage, configures a second weight value, and reduces the weight value of each element location information under the current version information.
[0156] S423, execution completed, report generated.
[0157] The client executes the test script file and generates a report.
[0158] S424, the report provides the user element update information confirmation item.
[0159] The client generates an element update information confirmation item for the execution step with the target page element as the operation object, and displays
[0160] S425, uploading input information of the element update information confirmation item.
[0161] The client uploads the input information of the element update information confirmation item to the server.
[0162] S426, the weight of the element update information is configured to 100, and the weight of the remaining element location information is modified to 50.
[0163] When receiving the input information of the element update information confirmation item, the server configures the weight value of the element update information as the upper limit value of the weight; and reduces the configured weight value for other element location information of the target page element except the element update information under the current version information.
[0164] According to the technical solution of the present application, through the query result of the element location information of the target page element under the current version information, it is determined whether the element location information returned by the server is the element location information under the current version information or the element location information under the historical version information. When the element location information under the current version information is not stored, the element location information under the historical version information can be provided in advance to avoid no information provision and improve the stability of automated testing. At the same time, the server stores the element location information of the historical version, which can trace back to the element location information of the lower version, adapt to the test application scenarios of the lower version of the page elements, and improve the compatibility of the application test with the lower version.
[0165] According to an embodiment of the present application, Figure 8 : is a structural diagram of a test device in an embodiment of the present application. The embodiment of the present application is applicable to obtaining the location information of a page element and simulating the operation of a user triggering the page element when testing the page element function of the test device. The device is implemented by software and / or hardware and is specifically configured in an electronic device with certain data computing capabilities.
[0166] like Figure 8 The test device 500 shown in the figure comprises: a current version information sending module 501, an element location information receiving module 502 and a page function testing module 503; wherein,
[0167] The current version information sending module 501 is used to send the current version information corresponding to the target page element to the server, so that the server queries the element location information corresponding to the current version information;
[0168] The element location information receiving module 502 is used to receive the element location information sent by the server;
[0169] The page function testing module 503 is used to test the testing device according to the element positioning information.
[0170] According to the technical solution of the present application, by sending the current version information corresponding to the target page element to the server, receiving the element location information corresponding to the current version information fed back by the server, and providing the element location information to the test module to test the test device, the latest version of the element location information can be obtained through the server during the testing of the test device, so as to accurately locate the target page element, so as to realize the triggering operation of the target page element, thereby realizing the functional testing of the test device, and the element location information of the page elements can be centrally managed and maintained in the server, thereby reducing the labor cost of maintaining the page elements and improving the maintenance and update efficiency of the page elements.
[0171] Furthermore, the testing device also includes: a user interface image acquisition module, used to acquire the user interface image of the testing device; an element update information acquisition module, used to detect the target page element in the user interface image to obtain element update information; an element update information sending module, used to send the element update information to the server, so that the server updates the element location information of the target page element under the current version information according to the element update information.
[0172] Furthermore, the current version information sending module 501 includes: a script execution unit, which is used to execute the execution steps in the test script file with the target page element as the operation object, and obtain the current version information corresponding to the target page element; a current version information sending unit, which is used to send the current version information corresponding to the target page element to the server; the page function testing module 503 includes: a script testing unit, which is used to continue to execute the execution steps in the test script file with the target page element as the operation object according to the element positioning information, call the test module, and test the test device.
[0173] Furthermore, the testing device also includes: an element update information confirmation and display module, which is used to generate and display an element update information confirmation item for the execution steps with the target page element as the operation object when the execution of the test script file is completed; a user input information receiving module, which is used to receive user input information for the element update information confirmation item; and a user input information sending module, which is used to send the input information of the element update information confirmation item to the server, so that the server updates the element location information of the target page element under the current version information.
[0174] Furthermore, the page function test module 503 includes: a test module calling unit, used to call the test module according to the element positioning information and test the test device, the test module is used to generate a user trigger operation according to the element positioning information, and act on the test device to operate the target page element in the user interface.
[0175] The above-mentioned target detection device can execute the test method provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects for executing the test method.
[0176] According to an embodiment of the present application, Fig. 9 This is a structural diagram of a test device in an embodiment of the present application. The embodiment of the present application is applicable to the case where, when testing the page element function of the test device, the version information of the page element is obtained from the client and the element location information is fed back. The device is implemented by software and / or hardware and is specifically configured in an electronic device with certain data computing capabilities.
[0177] like Fig. 9 A test device 600 shown includes: a current version information receiving module 601, an element location information query module 602 and an element location information feedback module 603; wherein,
[0178] The current version information receiving module 601 is used to receive the current version information corresponding to the target page element sent by the client;
[0179] The element location information query module 602 is used to query the element location information of the target page element under the current version information, and determine the element location information corresponding to the current version information;
[0180] The element location information feedback module 603 is used to send the corresponding element location information to the client, so that the client tests the test device according to the corresponding element location information.
[0181] According to the technical solution of the present application, the current version information of the target page element is received by the server, and the corresponding element location information is queried and sent to the client. During the testing process of the test device, the latest version of the element location information can be sent to the client, so as to accurately locate the target page element to implement the trigger operation of the target page element, thereby realizing the functional testing of the test device. At the same time, the element location information of the page elements is centrally managed and maintained in the server, reducing the labor cost of maintaining the page elements and improving the maintenance and update efficiency of the page elements.
[0182] Furthermore, the element location information query module 602 includes: a current element location information acquisition unit, which is used to obtain the element location information of the target page element under the current version information when the query result is not empty; a historical element location information acquisition unit, which is used to query the element location information of the target page element under the historical version information when the query result is empty, and determine the element location information corresponding to the current version information, and the historical version information and the current version information are adjacent version information.
[0183] Furthermore, the historical element location information acquisition unit includes: an element location information weight acquisition subunit, used to obtain the weight value configured for each element location information of the target page element under the historical version information; an element location information screening subunit, used to select the element location information with the highest weight value, and determine it as the element location information corresponding to the current version information for storage; an element location information weight update subunit, used to configure the weight value of the element location information with the highest weight value as a first weight value, and the first weight value is less than the weight upper limit value.
[0184] Furthermore, the testing device also includes: an element update information acquisition module, used to receive element update information corresponding to the target page element; a current version element location information update module, used to update the element location information of the target page element under the current version information according to the element update information.
[0185] Furthermore, the current version element location information update module includes: an element update information weight increasing unit, which is used to increase the weight value of the target element location information when the target page element has target element location information that is the same as the element update information under the current version information; an element update information adding unit, which is used to determine the element update information as the element location information under the current version for storage and configure a second weight value when the element location information of the target page element under the current version information is different from the element update information, and reduce the weight value of each element location information under the current version information.
[0186] Furthermore, the testing device also includes: an element update information weight configuration module, which is used to configure the weight value of the element update information to the weight upper limit value when receiving the input information of the element update information confirmation item; and another element location information weight reduction module, which is used to reduce the configured weight value of the other element location information of the target page element except the element update information under the current version information.
[0187] The above-mentioned target detection device can execute the test method provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects for executing the test method.
[0188] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0189] Fig.10 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0190] like Fig.10 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0191] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0192] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as test methods. For example, in some embodiments, the test method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the test method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the test method in any other appropriate manner (e.g., by means of firmware).
[0193] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0194] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0195] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0196] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0197] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0198] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0199] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0200] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A testing method comprising: Sending the current version information corresponding to the target page element to the server, so that the server queries the element location information corresponding to the current version information; wherein, in the case where the server query result is empty, the element location information is the element location information with the highest weight value among the various element location information of the target page element under the historical version information; the weight value adjustment method includes: by detecting whether the element update information is stored as the various element location information under the current version information, relatively increasing the weight value of the element update information, and / or relatively reducing the weight value of other element location information; the element update information is used to update the element location information corresponding to the target page element in the server; Receiving element location information sent by the server; The test equipment is tested according to the element positioning information.
2. The method according to claim 1, further comprising: Acquire a user interface image of the test device; Detecting the target page element in the user interface image to obtain element update information; The element update information is sent to the server, so that the server updates the element location information of the target page element under the current version information according to the element update information.
3. The method according to claim 1, wherein: The sending of the current version information corresponding to the target page element to the server includes: Execute the execution steps in the test script file with the target page element as the operation object to obtain the current version information corresponding to the target page element; Sending the current version information corresponding to the target page element to the server; The step of testing the test device according to the element positioning information includes: According to the element location information, the execution steps in the test script file with the target page element as the operation object are continued to be executed, the test module is called, and the test device is tested.
4. The method according to claim 3, when the test script file is executed, further comprising: For the execution steps with the target page element as the operation object, an element update information confirmation item is generated and displayed; For the element update information confirmation item, receiving user input information; The input information of the element update information confirmation item is sent to the server, so that the server updates the element location information of the target page element under the current version information.
5. A testing method comprising: Receive the current version information corresponding to the target page element sent by the client; Query the element location information of the target page element under the current version information, and determine the element location information corresponding to the current version information; wherein, when the server query result is empty, the element location information is the element location information with the highest weight value among the element location information of the target page element under the historical version information; The weight value adjustment method includes: when the target page element has the same target element location information as the element update information under the current version information, increasing the weight value of the target element location information; In the case where each element location information of the target page element under the current version information is different from the element update information, the element update information is determined to be the element location information under the current version information for storage, a second weight value is configured, and the weight value of each element location information under the current version information is reduced; The element update information is used to update the element location information corresponding to the target page element in the server; The corresponding element location information is sent to the client, so that the client tests the test device according to the corresponding element location information.
6. The method according to claim 5, wherein: The determining the element location information corresponding to the current version information includes: If the query result is not empty, obtaining the element location information of the target page element under the current version information; When the query result is empty, the element location information of the target page element under the historical version information is queried, and the element location information corresponding to the current version information is determined, and the historical version information and the current version information are adjacent version information.
7. The method according to claim 6, wherein: The querying of the element location information of the target page element under the historical version information and determining the element location information corresponding to the current version information includes: Obtaining the weight value of each element location information configuration of the target page element under the historical version information; Select the element location information with the highest weight value, and determine it as the element location information corresponding to the current version information for storage; The weight value of the element positioning information with the highest weight value is configured as a first weight value, and the first weight value is less than the upper weight limit value.
8. The method according to claim 5, further comprising: Receive element update information corresponding to the target page element; According to the element update information, the element location information of the target page element under the current version information is updated.
9. The method according to claim 8, further comprising: Upon receiving input information of the element update information confirmation item, configuring the weight value of the element update information as a weight upper limit value; For other element location information of the target page element except the element update information under the current version information, the configured weight value is reduced.
10. A testing device comprising: The current version information sending module is used to send the current version information corresponding to the target page element to the server, so that the server queries the element location information corresponding to the current version information; wherein, when the server query result is empty, the element location information is the element location information with the highest weight value among the element location information of the target page element under the historical version information; the weight value adjustment method includes: by detecting whether the element update information is stored as the result of each element location information under the current version information, relatively increasing the weight value of the element update information, and / or relatively reducing the weight value of other element location information; the element update information is used to update the element location information corresponding to the target page element in the server; An element location information receiving module, used for receiving the element location information sent by the server; The page function testing module is used to test the testing device according to the element positioning information.
11. A testing device comprising: The current version information receiving module is used to receive the current version information corresponding to the target page element sent by the client; An element location information query module, used to query the element location information of the target page element under the current version information, and determine the element location information corresponding to the current version information; wherein, when the server query result is empty, the element location information is the element location information with the highest weight value among the element location information of the target page element under the historical version information; The current version element location information updating module includes: an element update information weight increasing unit, used to increase the weight value of the target element location information when the target page element has target element location information that is the same as the element update information under the current version information; an element update information adding unit, used to determine the element update information as the element location information under the current version information for storage and configure a second weight value when each element location information of the target page element under the current version information is different from the element update information, and reduce the weight value of each element location information under the current version information; the element update information is used to update the element location information corresponding to the target page element in the server; The element positioning information feedback module is used to send the corresponding element positioning information to the client, so that the client tests the test device according to the corresponding element positioning information.
12. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the testing method according to any one of claims 1 to 9.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the testing method according to any one of claims 1-9.
14. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the testing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
User interface automatic test method and device, computer equipment and storage medium
CN110287101A
User interface testing method and device, electronic equipment and computer readable medium
CN111897740A