Automated testing method, device, electronic device and storage medium
Through the automated testing method, the reference resource information is obtained using page identifiers and resource matching is performed in the target page area, which solves the problems of low efficiency and inaccurate results in the existing technology, and achieves fast and accurate resource positioning and test results.
Patent Information
- Application Number
- CN202210451869.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-04-26
AI Technical Summary
The testing efficiency of display resources in the prior art is low and the test results are inaccurate, mainly due to the problem of whether the reliance on manual matching of preset resources is consistent with the actual display resources.
Through the automated testing method, the resource information of the reference resource is obtained based on the page identification of the page to be tested, including reference location information, resource search is performed in the target page area, and resource matching between the target resource and the reference resource, and resource testing results are determined.
It realizes automated testing of resources displayed on the page, improves the efficiency and accuracy of resource testing, and can quickly and accurately locate target resources to ensure the accuracy of test results.
Smart Images

Figure CN114996122B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of automated testing technology, and in particular to an automated testing method, device, electronic device, and storage medium. Background Art
[0002] There are various display resources in application software, but there is a lack of testing solutions for display resources. In the related art, the method of manually matching the preset display resources with the actual display resources in the application software is generally used to test the display resources in the application software. The testing of display resources by manual matching makes the testing efficiency of display resources low and the test results of display resources inaccurate. Summary of the invention
[0003] The present disclosure provides an automated testing method, device, electronic device and storage medium to at least solve the problem of low efficiency and inaccurate test results for display resources in the related art. The technical solution of the present disclosure is as follows:
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an automated testing method, characterized in that it includes:
[0005] Based on the page identifier of the page to be tested, resource information of the reference resource corresponding to the page to be tested is acquired; the resource information includes reference location information of the reference resource, and the page to be tested includes the resource to be tested;
[0006] Perform resource search in the target page area of the page to be tested to obtain a resource search result; the target page area is a page area in the page to be tested corresponding to the reference position information;
[0007] When the resource search result indicates that the target resource is found in the target page area, resource matching is performed on the target resource and the reference resource to obtain a resource matching result; the target resource is at least one resource among the resources to be tested;
[0008] Based on the resource matching result, a resource testing result for the resource to be tested is determined.
[0009] In an exemplary embodiment, the reference position information is page coordinate information;
[0010] The performing resource search in the target page area of the page to be tested to obtain a resource search result includes:
[0011] Determining the target page area corresponding to the page coordinate information in the page to be tested;
[0012] A resource search is performed in the target page area to obtain the resource search result.
[0013] In an exemplary embodiment, the reference position information is an area unit identifier, and the page to be tested includes at least one area unit;
[0014] The performing resource search in the target page area of the page to be tested to obtain a resource search result includes:
[0015] Determine a target area unit corresponding to the area unit identifier in the page to be tested, and determine the target area unit as the target page area;
[0016] A resource search is performed in the target page area to obtain the resource search result.
[0017] In an exemplary embodiment, the resource information further includes resource identification information of the reference resource and resource version information of the reference resource;
[0018] The performing resource matching on the target resource and the reference resource to obtain a resource matching result includes:
[0019] Obtain resource identification information of the target resource and resource version information of the target resource;
[0020] Matching the resource identification information of the target resource with the resource identification information of the reference resource to obtain a first matching result;
[0021] Matching the resource version information of the target resource with the resource version information of the reference resource to obtain a second matching result;
[0022] The resource matching result is obtained based on the first matching result and the second matching result.
[0023] In an exemplary embodiment, the resource information further includes resource display information of the reference resource;
[0024] The performing resource matching on the target resource and the reference resource to obtain a resource matching result includes:
[0025] Obtain resource display information of the target resource;
[0026] Based on the resource display information of the target resource, information matching is performed with the resource display information of the reference resource to obtain a third matching result;
[0027] Based on the third matching result, the resource matching result is obtained.
[0028] In an exemplary embodiment, the resource display information of the reference resource includes a reference resource image and a reference resource image size;
[0029] The resource display information based on the target resource is matched with the resource display information of the reference resource to obtain a third matching result, including:
[0030] Acquire a target resource image corresponding to the target resource from the target page area; the image size of the target resource image is the reference resource image size;
[0031] Performing image matching on the target resource image and the reference resource image to obtain an image matching result;
[0032] The third matching result is determined based on the image matching result.
[0033] In an exemplary embodiment, the reference resource image size includes a display length and a display height of the reference resource;
[0034] The step of acquiring a target resource image corresponding to a target resource from the target page area includes:
[0035] Determine a target display area in the target page area; the length of the target display area is the display length, and the height of the target display area is the display height;
[0036] The image in the target display area is captured to obtain the target resource image.
[0037] In an exemplary embodiment, before acquiring resource information of a reference resource corresponding to the page to be tested based on the page identifier of the page to be tested, the method further includes:
[0038] Determine a plurality of pages to be tested included in the object to be tested, and reference resource acquisition information corresponding to each of the plurality of pages to be tested; the reference resource acquisition information is used to acquire resource information of reference resources corresponding to the pages to be tested.
[0039] According to a second aspect of an embodiment of the present disclosure, there is provided an automated testing device, comprising:
[0040] A resource information acquisition unit is configured to perform page identification based on the page to be tested, and acquire resource information of a reference resource corresponding to the page to be tested; the resource information includes reference position information of the reference resource, and the page to be tested includes the resource to be tested;
[0041] A resource search unit is configured to perform resource search in a target page area of the page to be tested to obtain a resource search result; the target page area is a page area in the page to be tested corresponding to the reference position information;
[0042] A resource matching unit is configured to perform resource matching on the target resource and the reference resource to obtain a resource matching result when the resource search result indicates that the target resource is found in the target page area; the target resource is at least one resource among the resources to be tested;
[0043] The test result determination unit is configured to determine a resource test result for the resource to be tested based on the resource matching result.
[0044] In an exemplary embodiment, the reference position information is page coordinate information;
[0045] The resource searching unit comprises:
[0046] A first determining unit is configured to determine the target page area corresponding to the page coordinate information in the page to be tested;
[0047] The first search unit is configured to perform resource search in the target page area to obtain the resource search result.
[0048] In an exemplary embodiment, the reference position information is an area unit identifier, and the page to be tested includes at least one area unit;
[0049] The resource searching unit comprises:
[0050] A second determining unit is configured to determine a target area unit corresponding to the area unit identifier in the page to be tested, and determine the target area unit as the target page area;
[0051] The second search unit is configured to perform resource search in the target page area to obtain the resource search result.
[0052] In an exemplary embodiment, the resource information further includes resource identification information of the reference resource and resource version information of the reference resource;
[0053] The resource matching unit comprises:
[0054] A first acquisition unit is configured to acquire resource identification information of the target resource and resource version information of the target resource;
[0055] A first matching unit is configured to perform information matching between the resource identification information of the target resource and the resource identification information of the reference resource to obtain a first matching result;
[0056] A second matching unit is configured to perform information matching on the resource version information of the target resource and the resource version information of the reference resource to obtain a second matching result;
[0057] A third determining unit is configured to obtain the resource matching result based on the first matching result and the second matching result.
[0058] In an exemplary embodiment, the resource information further includes resource display information of the reference resource;
[0059] The resource matching unit comprises:
[0060] A second acquisition unit is configured to execute acquisition of resource display information of the target resource;
[0061] A third matching unit is configured to perform information matching based on the resource display information of the target resource and the resource display information of the reference resource to obtain a third matching result;
[0062] The fourth determining unit is configured to obtain the resource matching result based on the third matching result.
[0063] In an exemplary embodiment, the resource display information of the reference resource includes a reference resource image and a reference resource image size;
[0064] The third matching unit comprises:
[0065] A target resource image determining unit is configured to obtain a target resource image corresponding to a target resource from the target page area; the image size of the target resource image is the reference resource image size;
[0066] An image matching unit, configured to perform image matching on the target resource image and the reference resource image to obtain an image matching result;
[0067] The fifth determining unit is configured to determine the third matching result based on the image matching result.
[0068] In an exemplary embodiment, the reference resource image size includes a display length and a display height of the reference resource;
[0069] The target resource image determination unit comprises:
[0070] A target display area determination unit is configured to determine a target display area in the target page area; the length of the target display area is the display length, and the height of the target display area is the display height;
[0071] The image capture unit is configured to capture the image in the target display area to obtain the target resource image.
[0072] In an exemplary embodiment, the apparatus further comprises:
[0073] The sixth determining unit is configured to determine multiple pages to be tested included in the object to be tested, and obtain reference resource information corresponding to each of the multiple pages to be tested; the reference resource acquisition information is used to obtain resource information of reference resources corresponding to the pages to be tested.
[0074] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the automated testing method as described above.
[0075] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute the automated testing method as described above.
[0076] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes a computer program stored in a readable storage medium, and at least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the device performs the above-mentioned automated testing method.
[0077] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0078] When testing the resources to be tested included in the page to be tested, the present disclosure obtains the resource information of the reference resource corresponding to the page to be tested based on the page identifier of the page to be tested, and the resource information of the reference resource includes the reference location information; then, a resource search is performed in the target page area corresponding to the reference location information in the page to be tested, and when the target resource is found, the target resource and the reference resource are matched to obtain a resource matching result; the target resource may be at least one resource in the resources to be tested; based on the resource matching result, a resource test result of the resource to be tested is determined. The present disclosure can realize the automated testing of the resources displayed in the page, and can determine the corresponding target resource through the reference location information of the reference resource, so as to realize the accurate and rapid positioning of the resource to be tested, thereby improving the efficiency of resource testing and the accuracy of resource testing results.
[0079] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0081] Figure 1 It is a schematic diagram of an implementation environment according to an exemplary embodiment.
[0082] Figure 2 The present invention is a flow chart of an automated testing method according to an exemplary embodiment.
[0083] Figure 3 The figure is a flow chart of a resource search method according to an exemplary embodiment.
[0084] Figure 4 The figure is a flow chart of another resource search method according to an exemplary embodiment.
[0085] Figure 5 The present invention is a flow chart of a resource matching method according to an exemplary embodiment.
[0086] Figure 6 The figure is a flow chart of another resource matching method according to an exemplary embodiment.
[0087] Figure 7 The figure is a flow chart of a resource image matching method according to an exemplary embodiment.
[0088] Figure 8 The figure is a flow chart of an image matching method according to an exemplary embodiment.
[0089] Fig. 9 The figure is a flow chart of a method for acquiring a target resource image according to an exemplary embodiment.
[0090] Fig.10 The diagram is a schematic diagram of resource testing according to an exemplary embodiment.
[0091] Fig.11 The figure is a block diagram of an automated testing device according to an exemplary embodiment.
[0092] Fig.12 The invention is a block diagram of an electronic device used in an automated testing method according to an exemplary embodiment. DETAILED DESCRIPTION
[0093] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0094] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0095] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0096] See also Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present disclosure, the implementation environment may include: a user terminal 110, a test terminal 120, and a resource server 130; wherein the user terminal 110 and the test terminal 120, and the test terminal 120 and the resource server 130 can communicate data through a network.
[0097] Specifically, the user terminal 110 may be installed with the application software to be tested, and the actual display resources in each page to be tested of the application software to be tested may be the resources to be tested; the test terminal 120 may execute the automated test script, obtain the reference resources corresponding to each page to be tested from the resource server 130, and then perform resource matching between the resources to be tested and the reference resources to obtain the resource test results of the resources to be tested. Among them, the resource server 130 may store various reference resources corresponding to the application software to be tested.
[0098] Furthermore, in order to avoid network resource consumption caused by network communication between the user terminal 110 and the test terminal 120 during the resource testing process, the application software to be tested can be directly installed in the test terminal 120, so that the corresponding implementation environment can include the test terminal 120 and the resource server 130.
[0099] Specifically, the user terminal 110 and the test terminal 120 may include physical devices such as smart phones, tablet computers, laptop computers, digital assistants, smart wearable devices, and vehicle-mounted terminals. The operating systems running on the user terminal 110 and the test terminal 120 in the embodiments of the present disclosure may include but are not limited to Android, IOS, Linux, Windows, etc.
[0100] The resource server 130 and the test end 120 may establish a communication connection via wired or wireless communication. The resource server 130 may include an independently operated server, or a distributed server, or a server cluster consisting of multiple servers, wherein the server may be a cloud server.
[0101] In order to solve the problem of low efficiency and inaccurate test results of display resource testing in related technologies, the present disclosure provides an automated testing method, which can be performed by the above-mentioned test end; please refer to Figure 2 , the method may include:
[0102] S210. Based on the page identifier of the page to be tested, obtain resource information of the reference resource corresponding to the page to be tested; the resource information includes reference position information of the reference resource, and the page to be tested includes the resource to be tested.
[0103] For application software, in order to realize corresponding functions or facilitate interaction with users, it may generally include multiple application pages, and each application page may include one or more display resources; thus, in the automated testing scenario, for the application software to be tested that needs to perform resource testing, the multiple application pages it includes can be regarded as pages to be tested, and each page to be tested has a corresponding page identifier; the resources actually displayed in each page to be tested can be the resources to be tested.
[0104] The resource server may store reference resources corresponding to the application software to be tested; the reference resources may be preset resources designed when developing the application software, that is, these preset resources need to be added to the application software so that the preset resources can be displayed in the application software; but due to relevant interference factors in the development process, the resources actually displayed in the application software may be different from the preset resources, so it is necessary to test the resources in order to promptly discover the inconsistency between the reference resources and the actually displayed resources, so as to repair the resources that have not passed the test as soon as possible.
[0105] The reference location information of the reference resource may be preset location information of the reference resource in the reference page when developing application software. The reference location information of the reference resource can be used to quickly and accurately locate the resource corresponding to the reference resource in the page to be tested.
[0106] S220. Perform resource search in the target page area of the page to be tested to obtain a resource search result; the target page area is the page area in the page to be tested corresponding to the reference position information.
[0107] After obtaining the reference location information of the reference resource, the target page area corresponding to the reference location information can be determined; generally, the location information of the reference resource in the reference page is consistent with the location information of the resource to be tested in the page to be tested. Therefore, in order to facilitate finding the resource to be displayed corresponding to the reference resource, the target page area to be searched can be determined based on the premise that the location information is consistent; then, a resource search is performed in the target page area to obtain a resource search result.
[0108] Since the position information deviation between the reference resource and the resource to be tested can be controlled within a preset range, the page area within the preset range associated with the reference position information can be determined as the target page area, thereby avoiding missing resources in search.
[0109] S230. When the resource search result indicates that the target resource is found in the target page area, perform resource matching on the target resource and the reference resource to obtain a resource matching result; the target resource is at least one resource among the resources to be tested.
[0110] The target page area may contain resources, and accordingly it can be determined that the found resources are the target resources; the target page area may not contain resources, and accordingly it can be determined that the resource to be tested corresponding to the reference resource has failed the test.
[0111] If the reference resource is one resource, but multiple target resources are found in the target page area, the target resource corresponding to the reference resource can be determined based on the distance information between the multiple target resources and the reference location information; specifically, the target resource closest to the reference location information can be determined as the target resource corresponding to the reference resource.
[0112] When the target resource is found, resource matching is performed on the target resource and the reference resource; the resource matching may specifically be to match the target resource and the reference resource in multiple resource feature items, and then obtain the corresponding resource matching result based on the matching result of each resource feature item.
[0113] S240. Determine a resource test result for the resource to be tested based on the resource matching result.
[0114] The resource matching results may include consistent resource matching and inconsistent resource matching; if the resource matching is consistent, it is determined that the target resource corresponding to the reference resource has passed the resource test; if the resource matching is inconsistent, it is determined that the target resource corresponding to the reference resource has not passed the resource test, and thus the target resource of the application software needs to be adjusted to make it consistent with the reference resource.
[0115] When testing the resources to be tested included in the page to be tested, the present disclosure obtains the resource information of the reference resource corresponding to the page to be tested based on the page identifier of the page to be tested, and the resource information of the reference resource includes the reference location information; then, a resource search is performed in the target page area corresponding to the reference location information in the page to be tested, and when the target resource is found, the target resource and the reference resource are matched to obtain a resource matching result; the target resource may be at least one resource in the resources to be tested; based on the resource matching result, a resource test result of the resource to be tested is determined. The present disclosure can realize the automated testing of the resources displayed in the page, and can determine the corresponding target resource through the reference location information of the reference resource, so as to realize the accurate and rapid positioning of the resource to be tested, thereby improving the efficiency of resource testing and the accuracy of resource testing results.
[0116] In a specific embodiment, the reference location information of the reference resource can be page coordinate information. For example, the upper left corner of the reference page can be used as the origin, the horizontal rightward direction is the x-axis, and the vertical downward direction is the y-axis to create a corresponding coordinate system, so as to determine the page coordinate information of the reference resource in the reference page; or the lower left corner of the reference page can be used as the origin, the horizontal rightward direction is the x-axis, and the vertical upward direction is the y-axis to create a corresponding coordinate system, etc. There are other ways to create a coordinate system, which will not be described here. Accordingly, the coordinate system creation method of the page to be tested is the same as the coordinate system creation method of the reference page, so please refer to Figure 3 , which shows a resource search method, which may include:
[0117] S310. Determine the target page area corresponding to the page coordinate information in the page to be tested.
[0118] S320. Perform resource search in the target page area to obtain the resource search result.
[0119] The target page area corresponding to the page coordinate information may be a page area with the page coordinate information as the center point and a preset range from the page coordinate information, or may be a preset page area to which the page coordinate information belongs, etc. This embodiment does not make any specific limitation.
[0120] After the target page area is determined based on the page coordinate information, a resource search can be performed in the target page area to obtain a resource search result. By referring to the page coordinate information of the resource, a resource search is performed in the target page area corresponding to the page coordinate information of the page to be tested, so that the resource to be tested in the page to be tested can be located quickly and accurately, and the efficiency of resource search can be improved; further, the efficiency of resource testing can be improved.
[0121] In another optional embodiment, the page to be tested may include at least one area unit, and the division of the area unit in the page to be tested is consistent with the division of the area unit in the reference page, and each area unit may include one or more resources to be predicted; the corresponding reference position information may be an area unit identifier, that is, the reference resource belongs to the area unit corresponding to the area unit identifier; please refer to Figure 4 , which shows another resource search method, which may include:
[0122] S410. Determine a target area unit corresponding to the area unit identifier in the page to be tested, and determine the target area unit as the target page area.
[0123] S420. Perform resource search in the target page area to obtain the resource search result.
[0124] The area units divided in the page to be tested are consistent with the area units divided in the reference page. Since the number of area units in the page to be tested is limited, determining the target area unit based on the area unit identifier can improve the efficiency of determining the target area unit. Further, performing resource search based on the determined target page area can narrow the search range of the target area unit, thereby improving the efficiency of resource search.
[0125] Furthermore, when the target resource is found in the target page area, resource matching can be performed on the reference resource and the target resource; the resource information also includes resource identification information of the reference resource and resource version information of the reference resource; please refer to Figure 5 , which shows a resource matching method, which may include:
[0126] S510. Obtain resource identification information of the target resource and resource version information of the target resource.
[0127] S520. Match the resource identification information of the target resource with the resource identification information of the reference resource to obtain a first matching result.
[0128] S530. Match the resource version information of the target resource with the resource version information of the reference resource to obtain a second matching result.
[0129] S540. Obtain the resource matching result based on the first matching result and the second matching result.
[0130] The resource identification information of the target resource and the resource version information of the target resource may be stored in the terminal memory where the application software to be tested is installed, and may be obtained from the terminal memory through the automated testing script during the automated testing process.
[0131] The resource identification information of the target resource is matched with the resource identification information of the reference resource to determine whether the target resource and the reference resource are consistent in resource identification, such as whether they have the same resource name or the same resource number, etc. The first matching result may include that the resource identification information of the target resource matches the resource identification information of the reference resource, or that the resource identification information of the target resource does not match the resource identification information of the reference resource.
[0132] Since the resource may be in a continuous updating process, the resource version information of the target resource and the resource version information of the reference resource may also be compared to determine whether the resource version information of the target resource and the reference resource are consistent; for example, the resource version information may be version identification information, or version update timestamp information, etc. The second matching result may include that the resource version information of the target resource matches the resource version information of the reference resource, or that the resource version information of the target resource does not match the resource version information of the reference resource.
[0133] Both resource identification information and resource version information can be used as resource implicit attribute information, so that the corresponding resource implicit attribute information matching result can be determined by matching the resource implicit attribute information of the target resource and the reference resource, and the corresponding resource matching result can be determined based on the implicit matching result, thereby improving the accuracy of resource matching.
[0134] In an optional embodiment, when the resource identification information and resource version information of the target resource and the reference resource are consistent, the display information of the target resource and the reference resource can also be matched. The resource information can also include the resource display information of the reference resource, and the resource display information can include resource display information and resource implicit display information; the resource display information can be image information when displaying the resource, display format information, etc.; the resource implicit display information can be configuration information when displaying the resource, such as display time, display frequency, etc. Figure 6 , which shows another resource matching method, which may include:
[0135] S610. Obtain resource display information of the target resource.
[0136] S620. Based on the resource display information of the target resource, information matching is performed with the resource display information of the reference resource to obtain a third matching result.
[0137] S630. Based on the third matching result, obtain the resource matching result.
[0138] The resource display information of the target resource may be stored in the terminal memory where the application software to be tested is installed, and may be obtained from the terminal memory through an automated testing script during the automated testing process.
[0139] The resource display information of the target resource is matched with the resource display information of the reference resource to determine whether the resource display information of the target resource is consistent with that of the reference resource, and visual presentation information can be generated when displaying the resource based on the resource display information, and the visual presentation information can be generated based on the resource display information and the resource implicit presentation information. The third resource matching result may include that the matching result of the resource display information of the target resource is consistent with that of the reference resource, and that the matching result of the resource display information of the target resource is inconsistent with that of the reference resource.
[0140] Therefore, by matching the resource display information of the target resource with the resource display information of the reference resource, a corresponding resource matching result is obtained, which can improve the accuracy of resource matching.
[0141] In a specific embodiment, the resource display information of the reference resource may include a reference resource image and a reference resource image size; Figure 7 , which shows a resource image matching method, which may include:
[0142] S710. Acquire a target resource image corresponding to a target resource from the target page area; the image size of the target resource image is the reference resource image size.
[0143] S720. Perform image matching on the target resource image and the reference resource image to obtain an image matching result.
[0144] S730. Determine the third matching result based on the image matching result.
[0145] When the target resource is found in the target page area, the target resource image corresponding to the target resource can be obtained from the target page area, and the image size of the obtained target resource is consistent with the reference resource image size. After the target resource image is obtained, the target resource image and the reference resource image can be image matched.
[0146] In one example, the reference resource image is the original image corresponding to the reference resource, and the size of the reference resource image is the size of the original image; the image matching method may be to match each pixel point contained in the target resource image with the pixel point at the corresponding position of the reference resource image to obtain an image matching result. When the similarity of the pixel points after matching is greater than or equal to the first preset similarity, the image matching result is determined to be consistent; otherwise, when the similarity of the pixel points after matching is less than the first preset similarity, the image matching result is determined to be inconsistent.
[0147] The target resource image size is consistent with the reference resource image size. Image matching based on the same image size can improve the rationality of image matching. On the other hand, obtaining images of the same size for matching can avoid the resource consumption caused by large-scale image matching and improve image matching efficiency.
[0148] In another example, the reference resource image may be a template image corresponding to the original image of the reference resource, that is, the template image is a part of the original image of the reference resource, that is, the size of the template image is smaller than the size of the original image, and the size of the reference resource image is the size of the original image; see Figure 8 , which shows an image matching method, comprising:
[0149] S810. Divide the target resource image into image regions based on the size of the template image to obtain multiple image regions; the size of each image region is consistent with the size of the template image.
[0150] S820. Perform image matching on the template image and multiple image regions, and determine a target image region based on the image matching result; the similarity between the image of the target image region and the matching image is greater than or equal to a second preset similarity.
[0151] S830. When the target image area is matched, determine that the image matching result is consistent with the image matching.
[0152] S840. When the target image area is not matched, determine that the image matching result is inconsistent with the image matching.
[0153] By performing image matching using a template image whose size is smaller than the target resource image, it is possible to achieve region matching of the image. Since the size of the template image is smaller than the original image of the reference resource, the network resource consumption for obtaining the template image is less than the network resource consumption for obtaining the original image, thereby saving network resources.
[0154] Further, the reference resource image size includes the display length and display height of the reference resource; thus, please refer to Fig. 9 , which shows a method for acquiring a target resource image, which may include:
[0155] S910. Determine a target display area in the target page area; the length of the target display area is the display length, and the height of the target display area is the display height.
[0156] S920: Capture the image in the target display area to obtain the target resource image.
[0157] Based on the display length and display height of the reference resource, the display length and display height of the target resource can be determined, and then the target display area can be determined from the target page area; the range of the target display area is compatible with the display length and display height.
[0158] In an example, the target display area may be a rectangular area, wherein the length of the rectangular area is the display length, and the height of the rectangular area is the display height; when the display length and the display height are consistent, the rectangular area may specifically be a square area.
[0159] In another example, the target display area may be an irregular graphic area, wherein the range of the irregular graphic area is contained in the range of a rectangular area, wherein the length of the rectangular area is the display length, and the height of the rectangular area is the display height.
[0160] Determining the target resource image of the corresponding size based on the display length and display height of the photo resource can improve the accuracy of determining the target resource image, thereby improving the accuracy of the image matching result.
[0161] In an optional embodiment, the reference information of the reference resource corresponding to the page to be tested can be obtained through an automated test script, the reference information of the reference resource can be stored in a resource server, the corresponding reference resource acquisition information can be set in advance for each page to be tested, and the reference resource acquisition information can be stored in the terminal memory installed with the application software to be tested, so that the automated test script can obtain the resource information of the corresponding reference resource according to the reference resource acquisition information. Specifically, multiple pages to be tested included in the object to be tested and the reference resource acquisition information corresponding to each of the multiple pages to be tested can be determined in advance; the reference resource acquisition information is used to obtain the resource information of the reference resource corresponding to the page to be tested. The reference resource acquisition information can be acquisition link information or acquisition path information, and each reference resource acquisition information can be used to jump to the corresponding resource acquisition page, so that the automated test script can obtain the corresponding amount of resource information based on the resource acquisition page; thereby achieving efficiency and accuracy in resource information acquisition.
[0162] The resource testing method of the disclosed embodiment can be based on pages, that is, resources in a page or a page in the application software to be tested can be tested. The page identifier of the corresponding page to be tested can be pre-set in the automated test script, and then the automated test script can execute related test operations.
[0163] In the disclosed embodiment, a correspondence between the global resource library and the reference resources of the reference page can also be established to facilitate the unified maintenance of resource information; that is, when it is necessary to obtain resource information of the reference resource, the relevant resource information can be obtained from the global resource library.
[0164] The following is a specific example to illustrate the implementation process of the present disclosure. Fig.10 (a), the page to be tested may include resources A, B and C, and the reference resources corresponding to the page to be tested may include resources A', B' and C', wherein resource A' may be a reference resource of resource A, resource B' may be a reference resource of resource B, and resource C' may be a reference resource of resource C; based on the reference position information of resource A', a corresponding target page area S1 is determined in the page to be tested, and similarly based on the reference position information of resources B' and C', corresponding target page areas S2 and S3 may be determined in the page to be tested, such as Fig.10 (b) shows that the area selected by the dotted box is the target page area. A resource search is performed in the target page area. For example, when resource A is found in the target page area S1, the found resource A is matched with resource A'. When the matching results are consistent, it is determined that resource A in the page to be tested has passed the test; the same test method as resource A can also be used for resource B and resource C, so that the test results of resource B and resource C can be obtained.
[0165] Fig.11 is a block diagram of an automated testing device according to an exemplary embodiment. Fig.10 , the device comprises:
[0166] The resource information acquisition unit 1110 is configured to execute page identification based on the page to be tested, and acquire resource information of the reference resource corresponding to the page to be tested; the resource information includes reference location information of the reference resource, and the page to be tested includes the resource to be tested;
[0167] The resource search unit 1120 is configured to perform resource search in a target page area of the page to be tested to obtain a resource search result; the target page area is a page area in the page to be tested corresponding to the reference position information;
[0168] The resource matching unit 1130 is configured to perform resource matching on the target resource and the reference resource to obtain a resource matching result when the resource search result indicates that the target resource is found in the target page area; the target resource is at least one resource in the resources to be tested;
[0169] The test result determination unit 1140 is configured to determine a resource test result for the resource to be tested based on the resource matching result.
[0170] In an exemplary embodiment, the reference position information is page coordinate information;
[0171] The resource searching unit comprises:
[0172] A first determining unit is configured to determine the target page area corresponding to the page coordinate information in the page to be tested;
[0173] The first search unit is configured to perform resource search in the target page area to obtain the resource search result.
[0174] In an exemplary embodiment, the reference position information is an area unit identifier, and the page to be tested includes at least one area unit;
[0175] The resource searching unit comprises:
[0176] A second determining unit is configured to determine a target area unit corresponding to the area unit identifier in the page to be tested, and determine the target area unit as the target page area;
[0177] The second search unit is configured to perform resource search in the target page area to obtain the resource search result.
[0178] In an exemplary embodiment, the resource information further includes resource identification information of the reference resource and resource version information of the reference resource;
[0179] The resource matching unit 1130 includes:
[0180] A first acquisition unit is configured to acquire resource identification information of the target resource and resource version information of the target resource;
[0181] A first matching unit is configured to perform information matching between the resource identification information of the target resource and the resource identification information of the reference resource to obtain a first matching result;
[0182] A second matching unit is configured to perform information matching on the resource version information of the target resource and the resource version information of the reference resource to obtain a second matching result;
[0183] A third determining unit is configured to obtain the resource matching result based on the first matching result and the second matching result.
[0184] In an exemplary embodiment, the resource information further includes resource display information of the reference resource;
[0185] The resource matching unit 1130 includes:
[0186] A second acquisition unit is configured to execute acquisition of resource display information of the target resource;
[0187] A third matching unit is configured to perform information matching based on the resource display information of the target resource and the resource display information of the reference resource to obtain a third matching result;
[0188] The fourth determining unit is configured to obtain the resource matching result based on the third matching result.
[0189] In an exemplary embodiment, the resource display information of the reference resource includes a reference resource image and a reference resource image size;
[0190] The third matching unit comprises:
[0191] A target resource image determining unit is configured to obtain a target resource image corresponding to a target resource from the target page area; the image size of the target resource image is the reference resource image size;
[0192] An image matching unit is configured to perform image matching on the target resource image and the reference resource image to obtain an image matching result;
[0193] The fifth determining unit is configured to determine the third matching result based on the image matching result.
[0194] In an exemplary embodiment, the reference resource image size includes a display length and a display height of the reference resource;
[0195] The target resource image determination unit comprises:
[0196] A target display area determination unit is configured to determine a target display area in the target page area; the length of the target display area is the display length, and the height of the target display area is the display height;
[0197] The image capture unit is configured to capture the image in the target display area to obtain the target resource image.
[0198] In an exemplary embodiment, the apparatus further comprises:
[0199] The sixth determining unit is configured to determine multiple pages to be tested included in the object to be tested, and obtain reference resource information corresponding to each of the multiple pages to be tested; the reference resource acquisition information is used to obtain resource information of reference resources corresponding to the pages to be tested.
[0200] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0201] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided. Optionally, the computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a tape, a floppy disk, an optical data storage device, etc.; when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the methods described above.
[0202] In an exemplary embodiment, a computer program product is also provided, which includes a computer program stored in a readable storage medium, and at least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the device performs any of the above methods.
[0203] Fig.12is a block diagram of an electronic device for an automated testing method according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.12 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an automated testing method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0204] Those skilled in the art will understand that Fig.12 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0205] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0206] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An automated testing method, characterized in that: include: Based on the page identifier of the page to be tested, obtaining resource information of the reference resource corresponding to the page to be tested; The resource information includes reference position information of the reference resource, the page to be tested includes the resource to be tested; the reference position information is an area unit identifier, the page to be tested includes at least one area unit; the area units divided in the page to be tested are consistent with the area units divided in the reference page; Perform resource search in the target page area of the page to be tested to obtain a resource search result; the target page area is a page area in the page to be tested corresponding to the reference position information; The performing resource search in the target page area of the page to be tested to obtain the resource search result includes: determining a target area unit corresponding to the area unit identifier in the page to be tested, and determining the target area unit as the target page area; performing resource search in the target page area to obtain the resource search result; When the resource search result indicates that the target resource is found in the target page area, resource matching is performed on the target resource and the reference resource to obtain a resource matching result; the target resource is at least one resource among the resources to be tested; Based on the resource matching result, a resource testing result for the resource to be tested is determined.
2. The method according to claim 1, characterized in that: The reference position information is page coordinate information; The performing resource search in the target page area of the page to be tested to obtain a resource search result includes: Determining the target page area corresponding to the page coordinate information in the page to be tested; A resource search is performed in the target page area to obtain the resource search result.
3. The method according to claim 1, characterized in that The resource information also includes resource identification information of the reference resource and resource version information of the reference resource; The performing resource matching on the target resource and the reference resource to obtain a resource matching result includes: Obtain resource identification information of the target resource and resource version information of the target resource; Matching the resource identification information of the target resource with the resource identification information of the reference resource to obtain a first matching result; Matching the resource version information of the target resource with the resource version information of the reference resource to obtain a second matching result; The resource matching result is obtained based on the first matching result and the second matching result.
4. The method according to claim 1 or 3, characterized in that: The resource information also includes resource display information of the reference resource; The performing resource matching on the target resource and the reference resource to obtain a resource matching result includes: Obtain resource display information of the target resource; Based on the resource display information of the target resource, information matching is performed with the resource display information of the reference resource to obtain a third matching result; Based on the third matching result, the resource matching result is obtained.
5. The method according to claim 4, characterized in that The resource display information of the reference resource includes a reference resource image and a reference resource image size; The resource display information based on the target resource is matched with the resource display information of the reference resource to obtain a third matching result, including: Acquire a target resource image corresponding to the target resource from the target page area; the image size of the target resource image is the reference resource image size; Performing image matching on the target resource image and the reference resource image to obtain an image matching result; The third matching result is determined based on the image matching result.
6. The method according to claim 5, characterized in that The reference resource image size includes the display length and display height of the reference resource; The step of acquiring a target resource image corresponding to a target resource from the target page area includes: Determine a target display area in the target page area; the length of the target display area is the display length, and the height of the target display area is the display height; The image in the target display area is captured to obtain the target resource image.
7. The method according to claim 1, characterized in that Before acquiring resource information of a reference resource corresponding to the page to be tested based on the page identifier of the page to be tested, the method further includes: Determine a plurality of pages to be tested included in the object to be tested, and reference resource acquisition information corresponding to each of the plurality of pages to be tested; the reference resource acquisition information is used to acquire resource information of reference resources corresponding to the pages to be tested.
8. An automated testing device, characterized in that: include: A resource information acquisition unit is configured to execute page identification based on the page to be tested, and acquire resource information of a reference resource corresponding to the page to be tested; the resource information includes reference position information of the reference resource, and the page to be tested includes the resource to be tested; the reference position information is an area unit identification, and the page to be tested includes at least one area unit; the area units divided in the page to be tested are consistent with the area units divided in the reference page; A resource search unit is configured to perform resource search in a target page area of the page to be tested to obtain a resource search result; The target page area is a page area in the page to be tested corresponding to the reference position information; The resource search unit includes: a second determination unit configured to determine a target area unit corresponding to the area unit identifier in the page to be tested, and determine the target area unit as the target page area; a second search unit configured to perform resource search in the target page area to obtain the resource search result; A resource matching unit is configured to perform resource matching on the target resource and the reference resource to obtain a resource matching result when the resource search result indicates that the target resource is found in the target page area; the target resource is at least one resource among the resources to be tested; The test result determination unit is configured to determine a resource test result for the resource to be tested based on the resource matching result.
9. The device according to claim 8, characterized in that The reference position information is page coordinate information; The resource searching unit comprises: A first determining unit is configured to determine the target page area corresponding to the page coordinate information in the page to be tested; The first search unit is configured to perform resource search in the target page area to obtain the resource search result.
10. The device according to claim 8, characterized in that The resource information also includes resource identification information of the reference resource and resource version information of the reference resource; The resource matching unit comprises: A first acquisition unit is configured to acquire resource identification information of the target resource and resource version information of the target resource; A first matching unit is configured to perform information matching between the resource identification information of the target resource and the resource identification information of the reference resource to obtain a first matching result; A second matching unit is configured to perform information matching on the resource version information of the target resource and the resource version information of the reference resource to obtain a second matching result; A third determining unit is configured to obtain the resource matching result based on the first matching result and the second matching result.
11. The device according to claim 8 or 10, characterized in that The resource information also includes resource display information of the reference resource; The resource matching unit comprises: A second acquisition unit is configured to execute acquisition of resource display information of the target resource; A third matching unit is configured to perform information matching based on the resource display information of the target resource and the resource display information of the reference resource to obtain a third matching result; The fourth determining unit is configured to obtain the resource matching result based on the third matching result.
12. The device according to claim 11, characterized in that The resource display information of the reference resource includes a reference resource image and a reference resource image size; The third matching unit comprises: A target resource image determining unit is configured to obtain a target resource image corresponding to a target resource from the target page area; the image size of the target resource image is the reference resource image size; An image matching unit, configured to perform image matching on the target resource image and the reference resource image to obtain an image matching result; The fifth determining unit is configured to determine the third matching result based on the image matching result.
13. The device according to claim 12, characterized in that The reference resource image size includes the display length and display height of the reference resource; The target resource image determination unit comprises: A target display area determination unit is configured to determine a target display area in the target page area; the length of the target display area is the display length, and the height of the target display area is the display height; The image capture unit is configured to capture the image in the target display area to obtain the target resource image.
14. The device according to claim 8, characterized in that The device also includes: The sixth determining unit is configured to determine multiple pages to be tested included in the object to be tested, and obtain reference resource information corresponding to each of the multiple pages to be tested; the reference resource acquisition information is used to obtain resource information of reference resources corresponding to the pages to be tested.
15. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the automated testing method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the automated testing method as claimed in any one of claims 1 to 7.
17. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the automated testing method according to any one of claims 1 to 7 is implemented.
