A testing method, device, storage medium and electronic device
By determining the location of the target component elements on the terminal screen of a specified size, combined with the screen size of the terminal device, the problems of waste of computing resources and low transmission efficiency caused by full-screen recognition are solved, and efficient testing efficiency is achieved.
Patent Information
- Application Number
- CN202410905036.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2044-07-05
AI Technical Summary
The prior art requires the full screen of the terminal device to be identified during testing applications, resulting in waste of computing resources and low transmission efficiency, affecting the testing efficiency.
By determining the position of the target component element on the terminal screen of a specified size as a reference position, combining the screen size of the terminal device, the position of the target component element on the target terminal device is calculated, and then the test task is performed.
It shortens the time to detect target component elements, saves computing resources, and improves testing efficiency.
Smart Images

Figure CN118885386B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of software engineering, and particularly to a testing method, apparatus, storage medium, and electronic device. Background Art
[0002] With the continuous development of the field of software engineering, technicians have developed more and more applications for users to use. For example, games, music software, etc.
[0003] However, terminal devices produced by different manufacturers are often different. Even for the same application, when running on different terminal devices, the stability shown is also different. Based on this, it is extremely necessary to test the application to verify that the application can run normally on different terminal devices. Taking a game as an example, if a technician wants to test whether the game can perform an operation of clicking on the backpack in the game interface to open the backpack and display specific items on a smart phone, during the test, it is necessary to identify the backpack element in the game interface, and then simulate the user operation to click on the backpack element, and then identify the specific item element in the game interface. If it is identified, the verification is successful; if not, the verification fails. However, since the screen sizes of different terminal devices are often difficult to unify, for a component element to be identified, the current testing method needs to identify the entire game interface, or even the entire terminal screen, to determine the accurate position of the component element to be identified.
[0004] This testing method that requires full-screen identification will cause waste of computing resources. Moreover, when identifying images, the large amount of data transmitted by the images will also lead to a reduction in transmission efficiency, thereby affecting the testing efficiency.
[0005] Therefore, how to improve the testing efficiency is an urgent problem to be solved. Summary of the Invention
[0006] This specification provides a testing method, apparatus, storage medium, and electronic device to partially solve the above problems existing in the prior art.
[0007] This specification adopts the following technical solutions:
[0008] This specification provides a testing method, including:
[0009] Receiving a test request;
[0010] According to the test request, determining the position of a target component element in a target client in the interface when the interface of the target client is displayed through a terminal screen of a specified size as a reference position;
[0011] Running the target client on a target terminal device and determining the screen size of the target terminal device;
[0012] Determine the position of the target component element in the interface displayed by the target client when the target terminal device runs, based on the specified size, the screen size, and the reference position, as the target position;
[0013] Execute a test task according to the target position.
[0014] Optionally, according to the test request, determine the position of the target component element in the target client in the interface when the interface of the target client is displayed through the terminal screen with the specified size, specifically including:
[0015] Install the target client on the terminal device with the specified size, run the target client on the terminal device with the specified size, and display the interface of the target client;
[0016] Capture the image area corresponding to the target component element in the target client on the terminal screen of the terminal device with the specified size to obtain an initial image, where the initial image is an image with a preset size containing the target component element;
[0017] Identify the initial image to obtain the position of the target component element in the initial image in the target client;
[0018] Determine the position of the target component element in the interface in the target client according to the position of the target component element in the initial image in the target client.
[0019] Optionally, according to the specified size, the screen size, and the reference position, determine the position of the target component element in the interface displayed by the target terminal device when running the target client, specifically including:
[0020] Determine the screen area conversion relationship between the terminal screen with the specified size and the screen of the target terminal device according to the screen size and the specified size;
[0021] Convert the reference position according to the screen area conversion relationship to determine the position of the target component element in the interface displayed by the target terminal device when running the target client.
[0022] Optionally, according to the specified size, the screen size, and the reference position, determine the position of the target component element in the interface displayed by the target terminal device when running the target client, specifically including:
[0023] Determine the initial position corresponding to the target component element in the interface displayed by the target client when running on the target terminal device according to the specified size, the screen size, and the reference position;
[0024] Determine the layout and typesetting method of the target terminal device according to the type of the target terminal device;
[0025] Adjust the initial position according to the layout and typesetting method to obtain the position of the target component element in the interface displayed by the target client when running on the target terminal device.
[0026] Optionally, perform a test task according to the target position, specifically including:
[0027] Taking the target position as the center, when the interface of the target client is displayed on the terminal screen of the target terminal device, intercept an image area of a preset size to obtain the image to be recognized corresponding to the target component element;
[0028] Recognize the image to be recognized, and perform a simulated touch operation on the recognized target component element;
[0029] Perform a test task according to the interface displayed by the target client after responding to the simulated touch operation.
[0030] Optionally, recognize the image to be recognized, and perform a simulated touch operation on the recognized target component element, specifically including:
[0031] Recognize the image to be recognized, and determine at least one component element to be recognized included in the image to be recognized;
[0032] For each component element to be recognized, match the image corresponding to the component element to be recognized with the standard image corresponding to the target component element to determine the matching degree between the component element to be recognized and the target component element;
[0033] Recognize the target component element according to the matching degree between each component element to be recognized and the target component element, and perform a simulated touch operation on the target component element.
[0034] Optionally, for each component element to be recognized, match the image corresponding to the component element to be recognized with the standard image corresponding to the target component element to determine the matching degree between the component element to be recognized and the target component element, specifically including:
[0035] Extract features from the standard image corresponding to the target component element to obtain each feature point corresponding to the standard image. For each component element to be recognized, extract features from the image corresponding to the component element to be recognized to obtain each original feature point corresponding to the component element to be recognized, and perform image transformation on the image corresponding to the component element to be recognized, and extract features from the transformed image corresponding to the component element to be recognized to obtain each transformed feature point corresponding to the component element to be recognized;
[0036] For each component element to be recognized, determine the feature points for matching from each original feature point corresponding to the component element to be recognized according to the matching degree between each original feature point corresponding to the component element to be recognized and each transformed feature point corresponding to the component element to be recognized;
[0037] Determine the matching degree between each component element to be recognized and the target component element according to the matching degree between the feature points for matching corresponding to each component element to be recognized and each feature point corresponding to the standard image.
[0038] This specification provides a testing device, including:
[0039] Receiving module: used to receive a test request;
[0040] First determination module: used to determine, according to the test request, the position of the target component element in the target client in the interface when the interface of the target client is displayed through a terminal screen of a specified size, as the reference position;
[0041] Running module: used to run the target client in the target terminal device and determine the screen size of the target terminal device;
[0042] Second determination module: used to determine, according to the specified size, the screen size, and the reference position, the position of the target component element in the interface displayed when the target client is running in the target terminal device, as the target position;
[0043] Testing module: used to execute a test task according to the target position.
[0044] Optionally, the first determination module is specifically used for,
[0045] Install the target client on the terminal device with the specified size, run the target client on the terminal device with the specified size and display the interface of the target client; intercept the image area corresponding to the target component element in the target client on the terminal screen of the terminal device with the specified size to obtain an initial image, where the initial image is an image with a preset size containing the target component element; recognize the initial image to obtain the position of the target component element in the target client in the initial image; determine the position of the target component element in the target client in the interface according to the position of the target component element in the target client in the initial image.
[0046] Optionally, the second determination module is specifically configured to,
[0047] Determine the screen area conversion relationship between the terminal screen with the specified size and the screen of the target terminal device according to the screen size and the specified size; convert the reference position according to the screen area conversion relationship to determine the position of the target component element in the interface displayed by running the target client on the target terminal device.
[0048] Optionally, the second determination module is specifically configured to,
[0049] Determine the initial position corresponding to the target component element in the interface displayed by running the target client on the target terminal device according to the specified size, the screen size and the reference position; determine the layout and layout method of the target terminal device according to the type of the target terminal device; adjust the initial position according to the layout and layout method to obtain the position of the target component element in the interface displayed by running the target client on the target terminal device.
[0050] Optionally, the test module is specifically configured to,
[0051] With the target position as the center, intercept an image area with a preset size when the interface of the target client is displayed on the terminal screen of the target terminal device to obtain the image to be recognized corresponding to the target component element; recognize the image to be recognized and perform a simulated touch operation on the recognized target component element; perform a test task according to the interface displayed by the target client after responding to the simulated touch operation.
[0052] Optionally, the test module is specifically configured to,
[0053] Identify the image to be recognized, and determine at least one component element to be recognized included in the image to be recognized; for each component element to be recognized, match the image corresponding to the component element to be recognized with the standard image corresponding to the target component element, and determine the matching degree between the component element to be recognized and the target component element; according to the matching degree between each component element to be recognized and the target component element, identify the target component element, and perform a simulated touch operation on the target component element.
[0054] Optionally, the test module is specifically configured to,
[0055] Extract features from the standard image corresponding to the target component element to obtain each feature point corresponding to the standard image. For each component element to be recognized, extract features from the image corresponding to the component element to be recognized to obtain each original feature point corresponding to the component element to be recognized, and perform image transformation on the image corresponding to the component element to be recognized, and extract features from the transformed image corresponding to the component element to be recognized to obtain each transformed feature point corresponding to the component element to be recognized; for each component element to be recognized, determine the feature points for matching from each original feature point corresponding to the component element to be recognized according to the matching degree between each original feature point corresponding to the component element to be recognized and each transformed feature point corresponding to the component element to be recognized; according to the matching degree between the feature points for matching corresponding to each component element to be recognized and each feature point corresponding to the standard image, determine the matching degree between each component element to be recognized and the target component element.
[0056] This specification provides a computer-readable storage medium, and the storage medium stores a computer program, and when the computer program is executed by a processor, the above test method is implemented.
[0057] This specification provides an electronic device, including a processor and a computer program stored in a memory and executable on the processor, and when the processor executes the program, the above test method is implemented.
[0058] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:
[0059] In the test method provided in this specification, after receiving a test request, the server displays the target client through the terminal screen of a specified size to determine the position of the target component element in the client interface as a reference position, and then runs the target client on the target terminal device, and determines the screen size of the target terminal device. Furthermore, according to the specified size, the screen size of the target terminal device, and the reference position, determine the position of the target component element in the interface displayed by running the target client on the target terminal device as the target position, and then perform a test task according to the target position.
[0060] As can be seen from the above method, after the server obtains the position of the target component element in the terminal screen of the specified size, it can determine the position of the target component element in the screen of the target client according to the determined position in the terminal screen of the specified size, the specified size, and the screen size of the target terminal device. This can effectively reduce the time required to detect the target component element and save computing resources, thereby improving the test efficiency. Description of the Drawings
[0061] The drawings described herein are used to provide a further understanding of the present specification and form a part of the present specification. The schematic embodiments of the present specification and their descriptions are used to explain the present specification and do not constitute an improper limitation of the present specification. In the drawings:
[0062] Figure 1 It is a schematic flowchart of a test method provided by the present specification;
[0063] Figure 2 It is a schematic diagram of an image to be recognized displayed on a target terminal device provided by the present specification;
[0064] Figure 3 It is a schematic structural diagram of a test device provided by the present specification;
[0065] Figure 4 It is provided in the present specification corresponding to Figure 1 a schematic structural diagram of an electronic device. Detailed Embodiments
[0066] To make the purpose, technical solutions, and advantages of the present specification clearer, the technical solutions of the present specification will be clearly and completely described below in conjunction with specific embodiments of the present specification and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present specification, rather than all of the embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present specification.
[0067] Testing is an important part of the software engineering field. Programs written by developers often need to undergo a series of tests to ensure that the programs can run properly on various target devices. With the increasingly rapid development of the software engineering field, the demand for automated testing has gradually grown. During the automated testing process, the device needs to identify the target component elements in the device screen and click on them. In this process, existing recognition methods often can only recognize the target component elements by recognizing the full screen, and the cost of intercepting and recognizing the full screen image is relatively high, which greatly increases the time and computing resources required for automated testing, resulting in low efficiency of automated testing.
[0068] Based on this, this specification provides a testing method. By first determining the screen size of the target terminal device and the position of the target component element in the interface when the target client is displayed on the terminal screen of the specified size as the reference position, the position of the target component element in the interface displayed when the target terminal device runs the target client can be determined through the reference position, the specified size, and the target size. Thus, the testing task can be executed according to the determined position, which improves the efficiency of identifying the target component element from the screen of the target terminal device, and further improves the testing efficiency based on the identified target component element.
[0069] The following will, with reference to the accompanying drawings, elaborate on the technical solutions provided by each embodiment of this specification.
[0070] Figure 1 It is a schematic flowchart of a testing method provided by this specification, including:
[0071] S101: Receive a test request.
[0072] The execution entity of a testing method provided by this specification can be a terminal device such as a laptop computer or a desktop computer, or a client installed in the terminal device, or a server. For the sake of convenience in description, hereinafter, only the case where the server is the execution entity will be used to illustrate a testing method provided by this specification.
[0073] It should be noted that the target terminal device to which a testing method provided by this specification is applied can be a terminal device such as a mobile phone, a tablet computer, a computer, a smart watch, etc., or a smart device equipped with a display screen. Since there are too many types included in the target software to be tested, target clients such as game clients, music clients, fitness clients, video clients, etc. can all be tested. For the sake of convenience in description, hereinafter, this specification will take the software to be tested as a game client and the target running device of the game as a mobile phone as an example to illustrate the testing method provided by this specification. Of course, for the testing of any testable software on the target terminal device, the efficiency of testing can be improved through the method provided by this specification.
[0074] During the testing process, the server needs to first receive a test request. The test request includes the model of the target terminal device to be tested and the test tasks to be executed. Among them, the test tasks include multiple test steps, and each test step includes a simulated operation. The simulated operation may be: simulating a click on a component element in the interface, or simulating a swipe on a component element in the interface. This component element is the target component element in this test step. The simulated operation on the component element is not specifically limited in this specification, as long as it is an operation that can be simulated. Of course, for the test request, the request may only include a command to start the test, and the model of the target terminal device to be tested and the test tasks to be executed may also be preset in advance. Moreover, the software to be tested for the test tasks executed by the server can be preset. Of course, information such as the name and version number of the software can also be carried in the test request to set the software to be tested through the test request. It should be noted that a test step may include multiple simulated operations to be executed at the same time point, which is not specifically limited in this specification.
[0075] After receiving the test request, the server can start the test process. Specifically, the server performs simulated operations in sequence according to the multiple test steps included in the test task. For the sake of easy explanation, below, the test method provided in this specification will be described by taking simulating a click on a backpack component element as a test step.
[0076] S102: According to the test request, determine the position of the target component element in the target client in the interface when the interface of the target client is displayed on the terminal screen with a specified size, as the reference position.
[0077] After the server starts the test process according to the test request, it can determine each test step, as well as the simulated operation and the component element to be operated corresponding to each test step, according to the test task included in the test request.
[0078] Continuing with the above example, taking simulating a click on a backpack component element as a test step as an example. If the existing method is used to execute the test step of simulating a click on a backpack component element, it is necessary to capture the full screen of the terminal screen of the target terminal device when the game is running on the target terminal device, and then identify the backpack component element in the whole full-screen screenshot. During this process, both the transmission efficiency of the screenshot data and the recognition speed are reduced due to the overly large capture area.
[0079] In the test method provided in this specification, the test steps can be executed by only recognizing a partial area of the terminal screen of the target terminal device. Before performing this test process, it is necessary to run the target client on a terminal device that can normally run the target client and display the target client interface, and the size of the terminal screen of this terminal device is known, and the screen size of this terminal device is the specified size. Specifically, the server needs to first install the target client, that is, the game, on the terminal device with the specified size. Below, an example will be given where the terminal device with the specified size is a mobile phone with a 4-inch screen.
[0080] After the server installs the target client on the terminal device with the specified size, it can run the target client on the terminal device with the specified size and display the interface of the target client. Then, the server needs to intercept the image area corresponding to the target component element in the target client on the terminal screen of the terminal device with the specified size to obtain the initial image. The initial image contains the target component element and is an image of a preset size. Regarding the method of intercepting the initial image, this specification does not make specific restrictions. Of course, the server can also obtain the initial image in other ways, such as obtaining the image obtained by a technician's pre-partitioning of the image area corresponding to the target component element on the terminal screen of the terminal device with the specified size as the obtained initial image.
[0081] After the server obtains the initial image, it can identify the initial image to obtain the position of the target component element in the target client in the initial image. Further, based on the position of the target component element in the target client in the initial image and the positional relationship between the interface displayed on the terminal screen and the initial image, the server can determine the position of the target component element in the target client in the running interface of the terminal device with the specified size as the reference position. Of course, other methods can also be used to pre-determine the position of the target component element in the running interface of the terminal device with the specified size, and this specification does not make specific restrictions.
[0082] After the server determines the reference position, when the target terminal device runs the target client, it can determine the position of the target component element in the interface displayed when the target terminal device runs the target client according to the reference position, the specified size, and the screen size of the target client.
[0083] It can be seen that although the test method described in this specification may also involve screen capture, the screen capture operation is performed in advance, and its main purpose is to determine the reference position based on the captured image. After determining the reference position, the server does not need to perform a screen capture operation on the interface displayed by the target terminal device when the target client is running on the target terminal device. Instead, it can directly determine the position of the target component element in the interface of the target terminal device according to the reference position, the specified size, and the screen size of the target terminal device, and perform simulation operations according to the determined position to execute the test task. Moreover, since in actual testing, a software is often tested on multiple target terminal devices, after determining the above reference position by the method provided in this specification, the position of the target component element can be quickly determined on multiple target terminal devices, thus achieving rapid testing and greatly improving the test efficiency.
[0084] S103: Run the target client on the target terminal device and determine the screen size of the target terminal device.
[0085] S104: Determine the position of the target component element in the interface displayed by the target terminal device when the target client is running as the target position according to the specified size, the screen size, and the reference position.
[0086] After determining the reference position, the server can run the target client on the target terminal device and determine the screen size of the target terminal device. Then, according to the screen size of the target terminal device and the specified size, determine the screen area conversion relationship between the screen of the target terminal device and the screen of the terminal with the specified size, and thus determine the position of the target component element in the interface displayed by the target terminal device when the target client is running as the target position according to the determined screen area conversion relationship and the reference position.
[0087] Specifically, continuing with the above example and taking a mobile phone with a screen size of 6 inches as the target terminal device. After running the target client on the target terminal device, the server can convert the reference position according to the determined screen area conversion relationship between the screen of the 4-inch mobile phone and the screen of the 6-inch mobile phone, and then determine the position of the target component element in the 6-inch mobile phone.
[0088] It should be noted that when the screen ratio of the target terminal device is the same as the screen aspect ratio of the terminal device with the specified size, the ratio relationship between 4 inches and 6 inches can be directly used as the screen area conversion relationship between the two, and then direct conversion can be performed according to the screen area conversion relationship. However, when the screen aspect ratio of the target terminal device is different from the screen aspect ratio of the terminal device with the specified size, the corresponding screen area conversion relationship between the two is not a simple ratio relationship. The reason is that even for two mobile phones with the same screen size, if the screen aspect ratios of the two mobile phones are different, when the two mobile phones run the same game, the relative positions of the component elements in the game in the pictures displayed on the respective screens of the two mobile phones may be very different. For example, when a 6-inch mobile phone with a 16:9 aspect ratio and a 6-inch mobile phone with an 18:9 aspect ratio run the same game, the displayed pictures are different. On this basis, when using the ratio relationship as the screen area conversion relationship, if the screen aspect ratios of the two mobile phones are different, the position determined according to the ratio relationship can be adjusted according to the screen aspect ratios of the two mobile phones, and the adjusted position can be used as the target position.
[0089] In addition to the screen size and the screen aspect ratio, the screen resolution may also affect the interface displayed when the mobile phone runs a game. For example, the screen resolutions of two 6-inch mobile phones may be 1920*1080 and 1280*720 respectively. When these two mobile phones run the same game, even for the same target component element in the game, due to the different screen resolutions, the position of the target component element on the interfaces of the two mobile phones of the same size or the size of the component element on the interfaces of the two mobile phones may be different. In this case, the server can adjust the resolution of the terminal device with the specified size to make the resolution of the terminal device with the specified size the same as the resolution of the target terminal device, and then determine the reference position. The target position determined based on this reference position can avoid the influence caused by different screen resolutions.
[0090] Of course, the position of the target component element is often also affected by the layout method of the terminal device. Based on this, the position corresponding to the target component element determined according to the specified size, screen size, and reference position in the interface displayed when the target client runs on the target terminal device can also be used as the initial position. Then, the initial position is adjusted according to the determined layout method of the target terminal device to obtain the position of the target component element in the interface displayed when the target client runs on the target terminal device, which is used as the target position. Among them, when the layout method corresponding to the target terminal device is the same as the layout method corresponding to the terminal screen of the specified size, the initial position is the position of the target component element in the interface displayed when the target client runs on the target terminal device. At this time, no adjustment is required. Therefore, when obtaining the layout method of the target terminal device, the layout method of the terminal device with the specified size can also be obtained synchronously to determine that no adjustment is required when the two are the same.
[0091] After the server determines the target position according to the reference position, it can test the test task included in the test request according to the target position.
[0092] S105: Execute the test task according to the target position.
[0093] For each test step included in the test task, the server can perform a simulated operation on the target component element displayed on the screen of the target terminal device that runs the target client and displays the interface according to the target position to complete the test step. After completing the simulated operation corresponding to each test step through the target position corresponding to each test step, the test result can be obtained according to the operation result corresponding to each test step. Of course, when not all test steps can be completed, the test result can be obtained according to the interface at the time point when the test steps stop being completed. This specification does not make specific limitations.
[0094] Taking clicking on the backpack component element as an example of a test step, the server can center on the target position corresponding to the backpack component element and capture an image area of a preset size when the interface of the target client is displayed on the terminal screen of the target terminal device to obtain the image to be recognized corresponding to the target component element. Further, the server recognizes the image to be recognized and then can perform a simulated touch operation on the recognized target component element. According to the interface displayed by the target client after responding to the simulated operation, the test result can be obtained, thus completing the test task.
[0095] Figure 2 It is a schematic diagram of the image to be recognized displayed by a target terminal device provided in this specification.
[0096] It includes two mobile phones, namely a terminal device with a specified size and a target terminal device, and the screen size of the target terminal device is significantly larger than that of the terminal device with the specified size. After the server determines the position of the backpack component element on the screen of the terminal device with the specified size, it can determine the corresponding position of the backpack component element on the screen of the target terminal device, and then intercept and identify the image to be recognized containing the backpack component element, so as to execute the test task.
[0097] It should be noted that it is also possible to directly perform a simulation operation on the target position. The purpose of intercepting an image area of a preset size and performing identification is to further improve the success rate of the simulation operation based on the target position and avoid operation failures that may be caused by minor errors. During this process, the size of the image area can be preset according to actual needs, or a suitable image area size can be selected and set based on the operation success rate, average time required for identification, and computing resources required for identification corresponding to each image area size. Of course, other methods can also be used to select the size of the image area, and this specification does not make specific restrictions.
[0098] During the recognition process, since the image size of the image to be recognized is usually set to be slightly larger than the target component element, there may be multiple elements in the image to be recognized. For this situation, this specification provides a matching method to ensure that the target component element can be accurately recognized from the image to be recognized. Among them, the server needs to pre-obtain the standard image corresponding to the target component element.
[0099] Specifically, after the server recognizes the image to be recognized, it determines at least one component element to be recognized included in the image to be recognized. Then, for each component element to be recognized, it matches the image corresponding to the component element to be recognized with the standard image corresponding to the target component element, determines the matching degree between the component element to be recognized and the target component element, and then recognizes the target component element based on the matching degree between each component element to be recognized and the target component element, and performs a simulated touch operation on the recognized target component element.
[0100] This specification provides a method for determining the matching degree between the component element to be recognized and the target component element: The server first extracts features from the standard image corresponding to the target component element to obtain each feature point corresponding to the standard image. And for each component element to be recognized, it extracts features from the image corresponding to the component element to be recognized to obtain each original feature point corresponding to the component element to be recognized, performs image transformation on the image corresponding to the component element to be recognized, and extracts features from the transformed image corresponding to the component element to be recognized to obtain each transformed feature point corresponding to the component element to be recognized.
[0101] Subsequently, the server can determine the feature points for matching from the original feature points corresponding to the component element to be recognized according to the matching degree between each original feature point corresponding to the component element to be recognized and each transformed feature point corresponding to the component element to be recognized. Furthermore, according to the matching degree between the feature points for matching corresponding to each component element to be recognized and each feature point corresponding to the standard image, the matching degree between each component element to be recognized and the target component element can be determined.
[0102] Among them, the reason for performing image transformation on the image corresponding to the component element to be recognized is that when the screen of the target terminal device displays the target component element, due to image display parameters such as brightness, contrast, or color saturation, the image of the target component element displayed on the screen of the target terminal device is often not exactly the same as the standard image. Therefore, in order to ensure the success rate of matching, the image corresponding to the component element to be recognized is subjected to image transformation, and then the transformed feature points are obtained by performing feature extraction on the transformed image. Furthermore, according to the matching degree between the transformed feature points and each original feature point, the feature points that are more likely to be stably displayed are determined for matching. Of course, other matching methods can also be used for matching, and this specification does not make specific limitations.
[0103] When the server recognizes the target component element in the interface of the target client displayed on the terminal screen of the target terminal device and performs a simulated operation on the target component element, it completes a test step. By continuously executing the test steps, the task can be executed to obtain the test result.
[0104] As can be seen from the above method, through the above test method, after the server determines the position of the target component element in the screen with the specified size as the reference position, it can determine the position of the target component element in the interface displayed when the target terminal device runs the target client according to the specified size, the screen size of the target terminal device, and the reference position as the target position. Furthermore, according to the target position, the test task is executed, which reduces the time and computing resources required to recognize the target component element and improves the test efficiency.
[0105] Figure 3 The following is a schematic structural diagram of a test device provided by an embodiment of this specification. The device includes:
[0106] Receiving module 301: used to receive test requests;
[0107] First determination module 302: used to determine, according to the test request, the position of the target component element in the target client in the interface when the interface of the target client is displayed through the terminal screen with the specified size as the reference position;
[0108] Operation module 303: It is used to run the target client on the target terminal device and determine the screen size of the target terminal device;
[0109] Second determination module 304: It is used to determine the position of the target component element in the interface displayed by the target terminal device running the target client according to the specified size, the screen size, and the reference position, as the target position;
[0110] Testing module 305: It is used to execute a test task according to the target position.
[0111] Optionally, the first determination module 302 is specifically used for,
[0112] Install the target client on the terminal device with the specified size, run the target client on the terminal device with the specified size and display the interface of the target client; intercept the image area corresponding to the target component element in the target client on the terminal screen of the terminal device with the specified size to obtain an initial image, where the initial image is an image with a preset size containing the target component element; recognize the initial image to obtain the position of the target component element in the target client in the initial image; determine the position of the target component element in the target client in the interface according to the position of the target component element in the target client in the initial image.
[0113] Optionally, the second determination module 304 is specifically used for,
[0114] Determine the screen area conversion relationship between the terminal screen with the specified size and the screen of the target terminal device according to the screen size and the specified size; convert the reference position according to the screen area conversion relationship to determine the position of the target component element in the interface displayed by the target terminal device running the target client.
[0115] Optionally, the second determination module 304 is specifically used for,
[0116] Determine the initial position corresponding to the target component element in the interface displayed by the target terminal device running the target client according to the specified size, the screen size, and the reference position; determine the layout layout method of the target terminal device according to the type of the target terminal device; adjust the initial position according to the layout layout method to obtain the position of the target component element in the interface displayed by the target terminal device running the target client.
[0117] Optionally, the testing module 305 is specifically used for,
[0118] Centering on the target position, when presenting the interface of the target client on the terminal screen of the target terminal device, intercept an image area of a preset size to obtain the image to be recognized corresponding to the target component element; recognize the image to be recognized, and perform a simulated touch operation on the recognized target component element; according to the interface presented by the target client after responding to the simulated touch operation, perform a test task.
[0119] Optionally, the test module 305 is specifically configured to,
[0120] Recognize the image to be recognized, and determine at least one component element to be recognized included in the image to be recognized; for each component element to be recognized, match the image corresponding to the component element to be recognized with the standard image corresponding to the target component element, and determine the matching degree between the component element to be recognized and the target component element; according to the matching degree between each component element to be recognized and the target component element, recognize the target component element, and perform a simulated touch operation on the target component element.
[0121] Optionally, the test module 305 is specifically configured to,
[0122] Extract features from the standard image corresponding to the target component element to obtain each feature point corresponding to the standard image. For each component element to be recognized, extract features from the image corresponding to the component element to be recognized to obtain each original feature point corresponding to the component element to be recognized, and perform image transformation on the image corresponding to the component element to be recognized, and extract features from the transformed image corresponding to the component element to be recognized to obtain each transformed feature point corresponding to the component element to be recognized; for each component element to be recognized, determine the feature points for matching from each original feature point corresponding to the component element to be recognized according to the matching degree between each original feature point corresponding to the component element to be recognized and each transformed feature point corresponding to the component element to be recognized; according to the matching degree between each feature point for matching corresponding to each component element to be recognized and each feature point corresponding to the standard image, determine the matching degree between each component element to be recognized and the target component element.
[0123] This specification also provides a computer-readable storage medium, where the storage medium stores a computer program, and when the computer program is executed by a processor, it can be used to execute the above Figure 1 Provided a test method.
[0124] Based on Figure 1 Shown a test method, the embodiments of this specification also provide Figure 4 Shown a schematic structural diagram of an electronic device. As Figure 4, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above Figure 1 described test method.
[0125] Of course, in addition to the software implementation, this specification does not exclude other implementation methods, such as logical devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logical unit, and can also be hardware or logical devices.
[0126] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many method flow improvements today can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement to a method flow cannot be implemented using a hardware entity module. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logical function is determined by the user programming the device. Designers can program themselves to "integrate" a digital system onto a single PLD, without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compilers used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a Hardware Description Language (HDL), and there is not just one type of HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones currently are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that by simply performing a little logical programming on the method flow using the above-mentioned several hardware description languages and programming it into the integrated circuit, it is easy to obtain the hardware circuit that implements the logical method flow.
[0127] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to make the controller implement the same function in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or the structures within the hardware component.
[0128] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0129] For the convenience of description, when describing the above devices, they are described separately as various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0130] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0131] This specification is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the specification. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to produce a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0132] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including instruction means for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are performed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0134] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0135] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.
[0136] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0137] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0138] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0139] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0140] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, reference can be made to the partial description of the method embodiment.
[0141] The above is only the embodiment of this specification and is not intended to limit this specification. For those skilled in the art, various modifications and changes can be made to this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims of this specification.
Claims
1. A testing method, characterized in that, Including: Receiving a test request; According to the test request, determining the position of a target component element in the target client in the interface when the interface of the target client is displayed on a terminal screen of a specified size as a reference position; The position in the interface is determined by the position of the target component element in the initial image and the position relationship between the interface displayed on the terminal screen and the initial image. The initial image is obtained by intercepting or dividing a corresponding image area of the target component element on the terminal screen of the terminal device with the specified size in advance; Running the target client on the target terminal device and determining the screen size of the target terminal device; According to the specified size, the screen size and the reference position, determining the position of the target component element in the interface displayed when the target client runs on the target terminal device as a target position; Performing a test task according to the target position; According to the specified size, the screen size and the reference position, determining the position of the target component element in the interface displayed when the target client runs on the target terminal device specifically includes: Determining a screen area conversion relationship between the terminal screen with the specified size and the screen of the target terminal device according to the screen size and the specified size; Converting the reference position according to the screen area conversion relationship to determine the position of the target component element in the interface displayed when the target client runs on the target terminal device; or According to the specified size, the screen size and the reference position, determining the initial position corresponding to the target component element in the interface displayed when the target client runs on the target terminal device; Determining the layout and typesetting method of the target terminal device according to the type of the target terminal device; Adjusting the initial position according to the layout and typesetting method to obtain the position of the target component element in the interface displayed when the target client runs on the target terminal device; Performing a test task according to the target position specifically includes: Taking a preset-sized image area centered on the target position when the interface of the target client is displayed on the terminal screen of the target terminal device to obtain a to-be-recognized image corresponding to the target component element; Recognizing the to-be-recognized image and performing a simulated touch operation on the recognized target component element; Performing a test task according to the interface displayed by the target client after responding to the simulated touch operation.
2. The method according to claim 1, wherein According to the test request, determining the position of the target component element in the target client in the interface when the interface of the target client is displayed on a terminal screen of a specified size specifically includes: Installing the target client on the terminal device with the specified size, running the target client on the terminal device with the specified size and displaying the interface of the target client; Intercepting the image area corresponding to the target component element in the target client on the terminal screen of the terminal device with the specified size to obtain the initial image, where the initial image is a preset-sized image containing the target component element. Identify the initial image to obtain the position of the target component element in the target client in the initial image; Determine the position of the target component element in the target client in the interface according to the position of the target component element in the target client in the initial image.
3. The method according to claim 1, wherein Identify the image to be identified and perform a simulated touch operation on the identified target component element, specifically including: Identify the image to be identified and determine at least one component element to be identified included in the image to be identified; For each component element to be identified, match the image corresponding to the component element to be identified with the standard image corresponding to the target component element to determine the matching degree between the component element to be identified and the target component element; Identify the target component element according to the matching degree between each component element to be identified and the target component element, and perform a simulated touch operation on the target component element.
4. The method according to claim 3, characterized in that, For each component element to be identified, match the image corresponding to the component element to be identified with the standard image corresponding to the target component element to determine the matching degree between the component element to be identified and the target component element, specifically including: Extract features from the standard image corresponding to the target component element to obtain each feature point corresponding to the standard image. For each component element to be identified, extract features from the image corresponding to the component element to be identified to obtain each original feature point corresponding to the component element to be identified, and perform image transformation on the image corresponding to the component element to be identified, and extract features from the transformed image corresponding to the component element to be identified to obtain each transformed feature point corresponding to the component element to be identified; For each component element to be identified, determine the feature points for matching from each original feature point corresponding to the component element to be identified according to the matching degree between each original feature point corresponding to the component element to be identified and each transformed feature point corresponding to the component element to be identified; Determine the matching degree between each component element to be identified and the target component element according to the matching degree between the feature points for matching corresponding to each component element to be identified and each feature point corresponding to the standard image.
5. A test device, characterized in that, Including: Receiving module: used to receive a test request; First determination module: used to determine, according to the test request, the position of the target component element in the target client in the interface when the interface of the target client is displayed on the terminal screen with a specified size as the reference position; The position in the interface is determined by the position of the target component element in the initial image and the position relationship between the interface displayed on the terminal screen and the initial image. The initial image is obtained by intercepting or dividing the image area corresponding to the target component element on the terminal screen of the terminal device with the specified size in advance; Running module: used to run the target client in the target terminal device and determine the screen size of the target terminal device; The second determination module: configured to determine the position of the target component element in the interface displayed by the target client running on the target terminal device as the target position according to the specified size, the screen size, and the reference position; The testing module: configured to execute a test task according to the target position; Specifically, the second determination module is configured to determine the screen area conversion relationship between the terminal screen of the specified size and the screen of the target terminal device according to the screen size and the specified size; convert the reference position according to the screen area conversion relationship to determine the position of the target component element in the interface displayed by the target client running on the target terminal device; or determine the initial position corresponding to the target component element in the interface displayed by the target client running on the target terminal device according to the specified size, the screen size, and the reference position; determine the layout and arrangement method of the target terminal device according to the type of the target terminal device; adjust the initial position according to the layout and arrangement method to obtain the position of the target component element in the interface displayed by the target client running on the target terminal device; Specifically, the testing module is configured to, with the target position as the center, intercept an image area of a preset size when the interface of the target client is displayed on the terminal screen of the target terminal device to obtain the image to be recognized corresponding to the target component element; recognize the image to be recognized, and perform a simulated touch operation on the recognized target component element; execute a test task according to the interface displayed by the target client after responding to the simulated touch operation.
6. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 4 above is implemented.
7. An electronic device, comprising a processor and a computer program stored on a memory and executable on the processor, characterized in that, When the processor executes the program, the method described in any one of claims 1 to 4 above is implemented.
Citation Information
Patent Citations
Test method and device
CN105512043A