A test result verification method, device and equipment

CN123011739APending Publication Date: 2026-10-30BEIJING SHANGYIN MICRO CORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611496446.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-23
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

仅根据执行测试操作前后用户界面的变化情况对测试结果进行验证,容易产生误判,降低了测试结果验证的准确性

Benefits of technology

本申请实施例提供一种测试结果的验证方法,通过获取在第一界面执行第一操作前采集的第一图像,以及在所述第一界面执行所述第一操作后采集的第二图像;将所述第一图像中的像素点与所述第二图像中对应的像素点进行比对,获得所述第一图像与所述第二图像之间的第一相似度;当所述第一相似度小于或等于第一阈值时,对所述第一图像和所述第二图像进行语义比对,获得用于表征执行所述第一操作前后的界面变化情况的第一信息。在此基础上,可以根据第一验证规则对所述第一信息进行验证,获得所述第一操作对应的测试结果的验证结果。本申请实施例通过语义比对获得执行第一操作前后的界面变化所表达的语义内容,并根据基于预期测试结果确定的第一验证规则对所述语义内容进行验证,从而能够确定界面变化是否符合预期测试结果,降低因非预期界面变化造成的误判,提高了测试结果验证的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011739A_ABST
    Figure CN123011739A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a test result verification method, device and equipment, the first image and the second image collected before and after the first operation is executed on the first interface are acquired; the pixel points in the first image and the corresponding pixel points in the second image are compared, and the first similarity between the first image and the second image is obtained; when the first similarity is less than or equal to the first threshold, the first image and the second image are subjected to semantic comparison, and the first information is obtained. According to the first verification rule, the first information is verified, and the verification result of the test result corresponding to the first operation is obtained. The embodiment of the application obtains the semantic content expressed by the interface change before and after the first operation is executed through semantic comparison, and verifies the semantic content according to the first verification rule determined based on the expected test result, so that whether the interface change conforms to the expected test result can be determined, the misjudgment caused by the unexpected interface change is reduced, and the accuracy of the test result verification is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automated testing technology, and in particular to a method, apparatus and equipment for verifying test results. Background Technology

[0002] Automated testing of user interfaces refers to a testing method that uses automated testing programs to simulate user operations on the user interface and check the user interface response or business execution results.

[0003] Currently, when verifying the results of automated user interface tests, the execution result of the test operation can be determined based on the changes in the user interface before and after the test operation. For example, if the user interface changes before and after the test operation, the test operation is considered successful; if the user interface remains unchanged, the test operation is considered to have failed.

[0004] However, changes in the user interface before and after performing a test do not necessarily indicate that the test has achieved the expected results. Verifying test results solely based on these changes can easily lead to misjudgments and reduce the accuracy of the verification.

[0005] Therefore, there is an urgent need for a solution to address the aforementioned technical problems. Summary of the Invention

[0006] In view of the above problems, this application provides a method, apparatus and equipment for verifying test results, with the aim of improving the accuracy of test result verification.

[0007] The embodiments of this application disclose the following technical solutions: Firstly, embodiments of this application provide a method for verifying test results, including: Acquire a first image before performing the first operation on the first interface, and a second image after performing the first operation on the first interface; The pixels in the first image are compared with the corresponding pixels in the second image to obtain the first similarity between the first image and the second image; When the first similarity is less than or equal to the first threshold, semantic comparison is performed on the first image and the second image to obtain first information, which is used to characterize the interface changes before and after the first operation is performed. The first information is verified according to the first verification rule to obtain the verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

[0008] In one possible implementation, comparing the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image includes: For each of the multiple first pixels participating in the comparison in the first image, determine the second pixel in the second image that corresponds to the position of the first pixel. The absolute value of the difference between the channel values ​​of the first pixel and the second pixel in each of the multiple color channels is determined as the channel difference value of the corresponding color channel. When the channel difference corresponding to each color channel is less than or equal to the second threshold corresponding to each color channel, the pixel group composed of the first pixel and the second pixel is determined as the matching pixel group. The first similarity is determined based on the ratio between the number of matching pixel groups and the total number of pixel groups participating in the comparison.

[0009] In one possible implementation, comparing the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image includes: A first region in the first image and a second region in the second image are determined. The first region and the second region are the regions where the interfering elements are located, and the positions of the first region and the second region correspond. The pixels outside the first region in the first image are compared with the pixels outside the second region in the second image to obtain a first similarity.

[0010] In one possible implementation, the semantic comparison of the first image and the second image to obtain the first information includes: Verification prompt information is generated based on the verification prompt template. The verification prompt information includes analysis requirements for at least one of the following: interface change type, target interface type, interface change description, interface defect information, and test results. Based on the verification prompt information, a semantic comparison is performed on the first image and the second image to obtain first information; the first information is represented in the form of structured data.

[0011] In one possible implementation, the verification result of verifying the first information according to the first verification rule to obtain the test result corresponding to the first operation includes: Determine the result type corresponding to the expected test result; The first verification rule corresponding to the result type is determined from the preset set of verification rules; Extract the target information corresponding to the first verification rule from the first information; The target information is matched with the target conditions corresponding to the first verification rule to obtain the verification result.

[0012] In one possible implementation, when the result type is a login result type, the target information includes the target interface type, and the target condition includes the target interface type being a homepage type or a main interface type. When the result type is a payment result type, the target information includes the interface change description, and the target condition includes the interface change description having preset payment success semantic information; When the result type is a search result type, the target information includes the target interface type, and the target condition includes the target interface type being a search result interface type.

[0013] In one possible implementation, the method further includes: Retrieve historical verification records; The historical verification accuracy rate is determined based on the historical verification records. The first threshold is adjusted based on the historical verification accuracy.

[0014] In one possible implementation, the first information includes at least one of the following: interface change type, target interface type, semantic similarity, interface change description, interface defect information, and verification confidence.

[0015] Second aspect: Embodiments of this application provide a device for verifying test results, comprising: The system comprises an acquisition unit, a first comparison unit, a second comparison unit, and a verification unit. The acquisition unit is used to acquire a first image before the first operation is performed on the first interface, and a second image after the first operation is performed on the first interface. The first comparison unit is used to compare the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image; The second comparison unit is used to perform semantic comparison between the first image and the second image when the first similarity is less than or equal to the first threshold, and obtain first information. The first information is used to characterize the interface changes before and after performing the first operation. The verification unit is used to verify the first information according to the first verification rule to obtain the verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

[0016] Third aspect: This application provides a computer device, which includes a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the steps of the method described above according to the instructions in the program code.

[0017] Fourth aspect: Embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method described above.

[0018] Fifth aspect: This application provides a computer program product, which, when run on a computer, enables the computer to perform the steps of the method described above.

[0019] Sixth aspect: This application provides a chip including a processor coupled to a memory for executing a computer program or instructions stored in the memory, such that the chip implements the steps of the method described above.

[0020] Compared with the prior art, this application has the following advantages: This application provides a method for verifying test results. It involves acquiring a first image before performing a first operation on a first interface, and a second image after performing the first operation on the first interface. Pixels in the first image are compared with corresponding pixels in the second image to obtain a first similarity between the two images. When the first similarity is less than or equal to a first threshold, a semantic comparison is performed on the first and second images to obtain first information characterizing the interface changes before and after performing the first operation. Based on this, the first information can be verified according to a first verification rule to obtain a verification result for the test result corresponding to the first operation. This application obtains the semantic content expressed by the interface changes before and after performing the first operation through semantic comparison, and verifies the semantic content according to a first verification rule determined based on the expected test result. This allows for determining whether the interface changes conform to the expected test result, reducing misjudgments caused by unexpected interface changes, and improving the accuracy of test result verification. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A schematic diagram illustrating an application scenario of a test result verification method provided in this application embodiment; Figure 2 A flowchart illustrating a method for verifying test results provided in an embodiment of this application; Figure 3 A flowchart of another method for verifying test results provided in an embodiment of this application; Figure 4 A schematic diagram of the structure of a test result verification device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. The terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be a limitation of this application. As used in the specification and appended claims of this application, the singular expressions "a," "an," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the embodiments of this application, "one or more" refers to one, two, or more; "and / or" describes the relationship between related objects, indicating that three relationships may exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0024] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0025] The "multiple" mentioned in the embodiments of this application refers to two or more. It should be noted that in the description of the embodiments of this application, terms such as "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance, nor should they be construed as indicating or implying order.

[0026] Currently, when verifying the results of automated user interface tests, the execution result of the test operation can be determined based on the changes in the user interface before and after the test operation. For example, if the user interface changes before and after the test operation, the test operation is considered successful; if the user interface remains unchanged, the test operation is considered to have failed.

[0027] However, changes in the user interface before and after performing a test operation do not necessarily indicate that the test operation achieved the expected results. For example, clicking the login button may redirect the page, but this does not guarantee that the page is correct; similarly, clicking the payment button and seeing a new page does not necessarily mean that the payment was successful.

[0028] Therefore, the current method of verifying test results solely based on changes in the user interface before and after the test operation is prone to misjudgment and reduces the accuracy of test result verification.

[0029] Based on this, embodiments of this application provide a method for verifying test results. This involves acquiring a first image before performing a first operation on a first interface, and a second image after performing the first operation on the first interface. Pixels in the first image are compared with corresponding pixels in the second image to obtain a first similarity between the first and second images. When the first similarity is less than or equal to a first threshold, a semantic comparison is performed on the first and second images to obtain first information characterizing the interface changes before and after performing the first operation. Based on this, the first information can be verified according to a first verification rule to obtain a verification result for the test result corresponding to the first operation.

[0030] This application embodiment obtains the semantic content expressed by the interface changes before and after the execution of the first operation through semantic comparison, and verifies the semantic content according to the first verification rule determined based on the expected test results, thereby determining whether the interface changes meet the expected test results, reducing misjudgments caused by unexpected interface changes, and improving the accuracy of test result verification.

[0031] like Figure 1 As shown in the figure, this figure is a schematic diagram of an application scenario for a test result verification method provided in an embodiment of this application. The method can be implemented by a terminal device 110 and a server 120.

[0032] The automated test program performs a first operation on the first interface of the terminal device 110, and the terminal device 110 displays the user interface after the operation in response to the first operation.

[0033] Server 120 obtains from terminal device 110 a first image captured before the first operation is performed on the first interface, and a second image captured after the first operation is performed on the first interface; compares the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image; when the first similarity is less than or equal to a first threshold, performs a semantic comparison between the first image and the second image to obtain first information, which is used to characterize the interface changes before and after the first operation; verifies the first information according to a first verification rule to obtain a verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

[0034] The following describes a method for verifying test results provided by an embodiment of this application, with reference to the accompanying drawings.

[0035] like Figure 2 As shown in the figure, this figure is a flowchart of a test result verification method provided in an embodiment of this application, including S201-S205.

[0036] S201, Obtain the first image and the second image.

[0037] In this embodiment of the application, before performing the first operation on the first interface, an image of the first interface can be captured to obtain a first image; after performing the first operation on the first interface, an image of the user interface after performing the first operation can be captured to obtain a second image.

[0038] The first image represents the interface state before the first operation is performed, and the second image represents the interface state after the first operation is performed.

[0039] The first operation can be an operation performed during user interface automation testing. For example, the first operation can include at least one of the following: a click operation, an input operation, a selection operation, a swipe operation, a submit operation, a confirm operation, and a return operation.

[0040] For example, when the first screen is a login screen, the first action can be clicking the login button; when the first screen is a payment screen, the first action can be clicking the payment button; when the first screen is a search screen, the first action can be submitting the search results.

[0041] In one possible implementation, an automated testing program can acquire a first image before performing the first operation, wait for a preset time after performing the first operation, and acquire a second image after the preset time has elapsed.

[0042] It is understood that the preset duration can be set based on actual needs, and this embodiment does not impose specific limitations on it. For example, the preset duration can be preset according to the operation type of the first operation, the response speed of the application, or the network status.

[0043] S202. Compare the pixels in the first image with the corresponding pixels in the second image to obtain the first similarity between the first image and the second image.

[0044] In this embodiment, the first similarity is used to characterize the degree of similarity between the first image and the second image at the pixel level. The larger the first similarity, the smaller the pixel difference between the first image and the second image; the smaller the first similarity, the larger the pixel difference between the first image and the second image.

[0045] A pixel in the first image and its corresponding pixel in the second image can be pixels that are at the same position in both images. For example, a pixel with coordinates (x, y) in the first image corresponds to a pixel with coordinates (x, y) in the second image.

[0046] In one possible implementation, for each of the multiple first pixels in the first image that are compared, a second pixel in the second image corresponding to the position of the first pixel can be determined, and the first pixel and the second pixel can be combined into a pixel group.

[0047] For each group of pixels, the channel values ​​of the first and second pixels in multiple color channels can be obtained separately. These multiple color channels can include red, green, and blue channels.

[0048] Furthermore, the absolute value of the difference between the channel values ​​of the first pixel and the second pixel in each color channel can be determined as the channel difference value of the corresponding color channel.

[0049] When the channel difference corresponding to each color channel is less than or equal to the second threshold corresponding to each color channel, the pixel group consisting of the first pixel and the second pixel can be determined as the matching pixel group.

[0050] The second threshold for different color channels can be the same or different. The second threshold can be preset according to the image acquisition conditions, image compression degree, interface display parameters, or test accuracy requirements to tolerate slight color fluctuations that occur during image acquisition or display.

[0051] For example, the first pixel and the second pixel include red channel values, green channel values, and blue channel values, respectively. When the difference between the red channel value, the difference between the green channel value, and the difference between the blue channel value are all less than or equal to the corresponding second threshold, the first pixel and the second pixel can be determined as a set of matching pixels.

[0052] After comparing multiple pixel groups, the number of matching pixel groups and the total number of pixel groups participating in the comparison can be counted. The first similarity is determined based on the ratio between the number of matching pixel groups and the total number of pixel groups participating in the comparison.

[0053] The first similarity can be represented as: First similarity = number of matching pixel groups / total number of pixel groups involved in the comparison.

[0054] For example, if the total number of pixel groups participating in the comparison is 10,000 and the number of matching pixel groups is 9,200, then the first similarity can be 0.92.

[0055] It should be noted that the multiple first pixels participating in the comparison may include all pixels in the first image, or may include some pixels selected from the first image according to a preset sampling rule. This application embodiment does not limit this.

[0056] When the first similarity is less than or equal to the first threshold, it indicates that there is a pixel difference between the first image and the second image that meets the preset degree, and S203 can continue to be executed; when the first similarity is greater than the first threshold, it can be determined that the interface before and after the first operation has not changed to meet the preset degree, the verification failure result is obtained, and the current verification process ends.

[0057] It is understood that the first threshold can be preset based on the type of user interface, the number of interface elements, the image acquisition quality, or historical test results. In this embodiment, the value of the first threshold is not specifically limited. For example, when the first similarity is represented by a value between 0 and 1, the first threshold can be set to 0.90.

[0058] S203. Perform semantic comparison on the first image and the second image to obtain the first information.

[0059] When the first similarity is less than or equal to the first threshold, a semantic comparison can be performed on the first image and the second image from the perspective of interface content and interface function meaning to obtain first information. The first information is used to characterize the interface changes before and after performing the first operation.

[0060] In one possible implementation, verification prompts can be generated based on a verification prompt template. The verification prompt template is used to define the analysis object, analysis dimensions, output fields, and output format for semantic comparison. The verification prompts may include analysis requirements for at least one of the following: interface change type, target interface type, interface change description, interface defect information, and test results.

[0061] For example, the first image can be labeled as the interface image before performing the first operation, and the second image can be labeled as the interface image after performing the first operation. The first image, the second image, and the verification prompt information can be used together as input for a semantic comparison process. The semantic comparison can be performed by a semantic analysis model or semantic analysis module with image understanding capabilities.

[0062] For example, the semantic analysis model can be a large language model with image understanding capabilities, a visual language model, or other models capable of joint semantic analysis of multiple images. This application does not specifically limit this.

[0063] The verification prompt may require the semantic analysis model to perform at least one of the following analyses: identify the type of interface change between the first image and the second image; identify the target interface type corresponding to the second image; generate a description of the interface change; identify interface defects present in the second image; and generate preliminary semantic layer test results based on the interface change.

[0064] The interface change type is used to characterize the way the interface changes before and after performing the first operation, and may include at least one of the following: page jump type, pop-up type, dialog box type, page refresh type, and no change type. The target interface type is used to characterize the interface type presented by the second image, and may include at least one of the following: homepage type, main interface type, login interface type, payment interface type, payment result interface type, and search result interface type.

[0065] The interface change description describes the changes in interface content or state before and after the execution of the first operation. For example, the interface change description could be that the interface jumps from the login interface to the homepage, or that the interface displays payment failure information after a payment operation is performed. The interface defect information characterizes the interface display anomalies present in the second image, and may include at least one of interface element position offset information and interface content occlusion information.

[0066] The first piece of information can be represented in structured data form for reading and processing according to preset fields. The first piece of information may include at least one of the following: preliminary semantic layer test results, interface change type, target interface type, interface change identifier, semantic similarity, interface change description, interface defect information, and verification confidence level.

[0067] Among them, the preliminary test results of the semantic layer are used to characterize the preliminary judgment obtained based on the interface semantics, which is different from the final verification result obtained in S204; the interface change identifier is used to characterize whether the interface identified by the semantic layer has undergone effective changes; the semantic similarity is used to characterize the degree of similarity between the first image and the second image in terms of interface content or functional meaning; and the verification confidence is used to characterize the credibility of the semantic comparison results.

[0068] In this embodiment, preset fields can be parsed from the structured results returned by the semantic analysis model. When the returned results lack preset fields, the field types do not meet the requirements, or are not represented according to the preset structure, the semantic comparison can be re-executed, or the current semantic comparison can be marked as abnormal and the corresponding abnormal information can be output.

[0069] S204. Verify the first information according to the first verification rule to obtain the verification result of the test result corresponding to the first operation.

[0070] The first verification rule is determined based on the expected test results corresponding to the first operation.

[0071] The expected test result is used to characterize the interface state or business outcome expected after performing the first operation. For example, the expected test result for a login operation could be entering the homepage, the expected test result for a payment operation could be successful payment, and the expected test result for a search operation could be entering the search results interface.

[0072] In one possible implementation, the result type corresponding to the expected test result can be determined first, and then the first verification rule corresponding to that result type can be determined from the preset set of verification rules.

[0073] The set of validation rules can include validation rules corresponding to different result types. Each validation rule can include the target information that needs to be extracted from the first information, and the target conditions that the target information needs to satisfy.

[0074] After determining the first verification rule, the target information corresponding to the first verification rule can be extracted from the first information, and the target information can be matched with the target conditions corresponding to the first verification rule.

[0075] When the target information meets the target conditions, a successful verification result can be obtained; when the target information does not meet the target conditions, a failed verification result can be obtained.

[0076] For example, when the result type is login result, the target interface type can be extracted from the first information, and the target interface type can be set as either homepage type or main interface type as the target condition. When the extracted target interface type is homepage type or main interface type, the successful verification result corresponding to the login operation can be obtained.

[0077] When the result type is payment result, the interface change description can be extracted from the first information, and the interface change description with preset payment success semantic information can be used as the target condition. The payment success semantic information can be used to represent business meanings such as payment success, transaction completion, or order payment.

[0078] When the result type is a search result type, the target interface type can be extracted from the first information, and the target interface type being the search result interface type can be used as the target condition.

[0079] Therefore, even if there are obvious pixel differences between the first and second images, the change in the interface will not be directly determined as the success of the first operation. Instead, the interface change will be further verified based on the semantic content expressed by the interface change and the expected test results.

[0080] In one possible implementation, when the expected test result corresponding to the first operation is not obtained, business verification based on the first verification rule can be skipped, and the first information obtained from semantic comparison or the preliminary test result of the semantic layer can be output directly.

[0081] S205. Output the verification results.

[0082] After obtaining the verification result of the test result corresponding to the first operation, the verification result can be output. The verification result can include a successful verification result or a failed verification result.

[0083] In one possible implementation, some or all of the information in the first information can be associated with the verification result for output. The associated output information may include at least one of the following: interface change type, target interface type, semantic similarity, interface change description, interface defect information, and verification confidence level.

[0084] When the target information does not meet the target conditions, business verification failure information can be generated based on the difference between the target information and the target conditions. This business verification failure information can be added to the interface defect information, or the business verification failure information can be associated with the verification failure result for output, so that testers can determine the cause of the failure.

[0085] In summary, the embodiments of this application determine the first similarity between the first image and the second image by pixel comparison, and further perform semantic comparison when the first similarity meets the conditions, and verify according to the first verification rule corresponding to the expected test result, thereby determining whether the interface change after performing the first operation meets the expected test result.

[0086] This application also provides another method for verifying test results. In this application embodiment, before determining the first similarity, a first region in the first image and a second region in the second image can be determined, and pixels in the first and second regions can be excluded.

[0087] like Figure 3 As shown, this figure is a flowchart of another test result verification method provided in the embodiment of this application, including S301 to S305.

[0088] S301, Obtain the first image and the second image.

[0089] In this embodiment of the application, a first image can be acquired before the first operation is performed on the first interface, and a second image can be acquired after the first operation is performed on the first interface.

[0090] It is understandable that the specific implementation of S301 can refer to the aforementioned S201, and will not be repeated here.

[0091] S302. Determine the first region and the second region, and obtain the first similarity based on the pixels outside the first region and the second region.

[0092] The user interface may contain interfering elements whose displayed content is prone to dynamic change, and whose changes are unrelated to the expected test result corresponding to the first operation. For example, interfering elements may include, but are not limited to, at least one of watermarks, advertising information, time information, weather information, or other dynamically displayed elements. Changes in these interfering elements may cause differences in some pixels in the first and second images, thereby affecting the first similarity score.

[0093] Based on this, in the embodiments of this application, a first region in the first image and a second region in the second image can be determined. The first region and the second region are the regions where the interfering elements are located, and the positions of the first region and the second region correspond. The correspondence between the first region and the second region can be that they have the same or corresponding region coordinates in the first image and the second image.

[0094] In one possible implementation, the first region and the second region can be determined based on pre-configured region location information. For example, at least one of the upper left corner, upper right corner, lower left corner, and lower right corner of the first image can be determined as the first region, and the corner region corresponding to the position in the second image can be determined as the second region, so as to ignore watermarks or dynamic information that may be located at the corners of the interface.

[0095] In another possible implementation, the first and second regions can be determined based on the display position of the interfering elements. For example, watermarks, advertising information, time information, or weather information in the first and second images can be identified, and the regions where the identified interfering elements are located can be determined as the first and second regions, respectively. The first and second regions can each include one area or multiple areas.

[0096] After determining the first region and the second region, pixels outside the first region in the first image can be identified as the first pixels to be compared, and pixels outside the second region in the second image can be identified as the second pixels to be compared.

[0097] For each of the multiple first pixels outside the first region in the first image, a second pixel outside the second region in the second image that corresponds to the position of the first pixel can be determined. Then, according to the color channel comparison method described in step S202 of Embodiment 1, matching pixel groups can be determined, and a first similarity is determined based on the ratio between the number of matching pixel groups and the total number of pixel groups participating in the comparison.

[0098] In this embodiment, the total number of pixel groups participating in the comparison does not include pixel groups located in the first region and the second region, and the number of matched pixel groups does not include pixel groups located in the first region and the second region.

[0099] When the first similarity is less than or equal to the first threshold, step S303 can be continued; when the first similarity is greater than the first threshold, a verification failure result can be obtained, and the current verification process ends.

[0100] S303. Perform semantic comparison on the first image and the second image to obtain the first information.

[0101] It is understandable that the specific implementation of S303 can refer to the aforementioned S203.

[0102] When the first similarity is less than or equal to the first threshold, verification prompt information can be generated according to the verification prompt template, and semantic comparison can be performed on the first image and the second image based on the verification prompt information to obtain the first information represented in the form of structured data.

[0103] It should be noted that the first region and the second region are used to define the range of pixels participating in pixel comparison in S302.

[0104] In one possible implementation, when performing semantic comparison, the complete first image and the complete second image can still be used as input for semantic comparison, so that the semantic comparison can obtain the complete interface content.

[0105] In another possible implementation, the verification prompt message may instruct the semantic comparison process to weaken or ignore interfering elements in the first and second regions. This application does not limit this approach.

[0106] The first piece of information may include at least one of the following: interface change type, target interface type, interface change identifier, semantic similarity, interface change description, interface defect information, preliminary semantic layer test results, and verification confidence level.

[0107] S304. Verify the first information according to the first verification rule to obtain the verification result of the test result corresponding to the first operation.

[0108] The specific implementation of S304 can be referred to the aforementioned S204.

[0109] In this embodiment of the application, the result type can be determined according to the expected test result corresponding to the first operation, the first verification rule corresponding to the result type can be determined from the preset verification rule set, and the target information corresponding to the first verification rule can be extracted from the first information.

[0110] In one possible implementation, the target information can be matched with the target conditions corresponding to the first verification rule to obtain the verification result of the test result corresponding to the first operation.

[0111] For example, when the first operation is a login operation, the verification result can be determined based on whether the target interface type in the first information is a homepage type or a main interface type; when the first operation is a payment operation, the verification result can be determined based on whether the interface change description in the first information has payment success semantic information; when the first operation is a search operation, the verification result can be determined based on whether the target interface type in the first information is a search result interface type.

[0112] S305. Output the verification results.

[0113] The specific implementation of S305 can be referred to the aforementioned S205.

[0114] It can output a successful verification result or a failed verification result. It can also associate at least one of the following with the verification result: interface change type, target interface type, semantic similarity, interface change description, interface defect information, and verification confidence.

[0115] This application embodiment, by excluding the first and second regions where interfering elements are located during the pixel comparison process, can reduce the impact of dynamic changes such as watermarks, advertising information, time information, or weather information on the first similarity, making the first similarity more accurately reflect the changes in the main content of the interface before and after the execution of the first operation; and when the first similarity meets the conditions, it continues to determine whether the interface changes meet the expected test results through semantic comparison and the first verification rule, ensuring the accuracy of the test result verification.

[0116] For ease of understanding, the following describes the embodiments of this application using the test result verification process corresponding to login, payment, and search operations as examples.

[0117] In the first example, the first operation is a login operation, and the expected test result for the first operation is successful login. The automated testing program can input the username and password on the login interface, capture a first image before clicking the login button, wait for the interface response after clicking the login button, and capture a second image. By comparing corresponding pixels in the first and second images, it is determined that the first similarity between the first and second images is less than or equal to a first threshold, and then a semantic comparison is performed on the first and second images. Through semantic comparison, it can be determined that the interface change type is a page jump type, the target interface type is a homepage type, and a description of the interface change representing the interface jump from the login interface to the homepage is obtained. Based on the expected test result of successful login, the corresponding first verification rule can be determined, where the target information corresponding to the first verification rule includes the target interface type, and the target condition includes the target interface type being either the homepage type or the main interface type. Since the target interface type in the first information is the homepage type, the target condition corresponding to the first verification rule is satisfied, thus obtaining a successful verification result.

[0118] In the second example, the first operation is a payment operation, and the expected test result for the first operation is payment success. The automated testing program can execute the payment operation on the payment interface and collect a first image before the payment operation and a second image after the payment operation. Pixel comparison determines that the first similarity between the first and second images is less than or equal to a first threshold, indicating that the interface has changed at the pixel level before and after the payment operation. Further semantic comparison of the first and second images identifies a payment failure message displayed in the second image and obtains an interface change description that does not contain payment success semantic information. Based on the expected test result of payment success, a corresponding first verification rule can be determined. The target information corresponding to the first verification rule includes the interface change description, and the target condition includes that the interface change description has preset payment success semantic information. Since the interface change description in the first information does not meet the above target condition, a verification failure result is obtained. Therefore, even if the interface changes before and after the payment operation, the interface change will not be directly determined as payment success, thereby reducing misjudgments caused by unexpected interface changes.

[0119] In the third example, the first operation is a search operation, and the expected test result corresponding to the first operation is entering the search results interface. The automated testing program can input search terms into the search interface and execute the search operation, collecting a first image before the search operation and a second image after the search operation. After determining that the first similarity between the first image and the second image is less than or equal to a first threshold, a semantic comparison is performed on the first and second images. Through semantic comparison, the target interface type can be determined as the search results interface type, and a description of the interface changes representing the entry into the search results interface can be obtained. Based on the expected test result of entering the search results interface, a corresponding first verification rule can be determined. The target information corresponding to the first verification rule includes the target interface type, and the target condition includes the target interface type being the search results interface type. Since the target interface type in the first information satisfies the above target condition, a successful verification result is obtained.

[0120] In one possible implementation, to adapt the pixel comparison process to different applications and varying degrees of interface changes, a historical verification record can be maintained. This historical verification record may include at least one of the following: the first similarity score corresponding to each verification, the semantic comparison result, the verification confidence score, the final verification result, and an accuracy identifier used to characterize whether the final verification result is correct.

[0121] The number of correctly verified records can be determined based on the accuracy indicator, and the ratio between the number of correctly verified records and the total number of historically verified records can be determined as the historical verification accuracy rate.

[0122] When the number of historical verification records reaches a preset number, the first threshold can be adjusted based on the historical verification accuracy and a preset threshold adjustment strategy. The threshold adjustment strategy can determine the direction and magnitude of the first threshold adjustment based on the types of false positives, false negatives, application categories, or interface changes in the historical records.

[0123] For example, a threshold adjustment can be performed when 10 historical verification records are reached, and a first accuracy threshold and a second accuracy threshold can be set. Different adjustment ranges can be used when the historical verification accuracy falls within different accuracy ranges; a preset upper and lower limit can also be set for the first threshold to prevent it from exceeding a reasonable range. The quantity, accuracy threshold, adjustment range, and upper and lower limits mentioned above can all be set according to actual needs.

[0124] In one possible implementation, a verification confidence threshold can be set. When the verification confidence level is lower than the threshold, the semantic comparison can be re-executed, a low confidence warning can be output, or the manual review process can be initiated.

[0125] In summary, this embodiment of the application, by determining a first region in a first image and a second region in a second image, and excluding pixels in both regions when calculating the first similarity, can reduce the impact of dynamic changes in interfering elements such as watermarks, advertising information, time information, and weather information on pixel comparison results. This allows the first similarity to more accurately reflect the changes in the main content of the interface before and after performing the first operation. Furthermore, when the first similarity meets preset conditions, semantic comparison is used to obtain the interface changes, and verification is performed according to the first verification rule determined based on the expected test results. This reduces misjudgments caused by changes in interfering elements or unexpected interface changes, thereby improving the accuracy of test result verification.

[0126] This application also provides a device for verifying test results, see [link to relevant documentation]. Figure 4 The figure is a schematic diagram of the structure of a test result verification device provided in an embodiment of this application. Its specific implementation method is consistent with the implementation method and the technical effect achieved in the above-described method embodiment, and some contents will not be repeated.

[0127] This application provides a test result verification device 4100, comprising: The system includes an acquisition unit 4101, a first comparison unit 4102, a second comparison unit 4103, and a verification unit 4104. The acquisition unit 4101 is used to acquire a first image before the first operation is performed on the first interface, and a second image after the first operation is performed on the first interface. The first comparison unit 4102 is used to compare the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image; The second comparison unit 4103 is used to perform semantic comparison between the first image and the second image when the first similarity is less than or equal to the first threshold, and obtain first information. The first information is used to characterize the interface changes before and after performing the first operation. The verification unit 4104 is used to verify the first information according to the first verification rule to obtain the verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

[0128] In one possible implementation, the first comparison unit is specifically used for: For each of the multiple first pixels participating in the comparison in the first image, determine the second pixel in the second image that corresponds to the position of the first pixel. The absolute value of the difference between the channel values ​​of the first pixel and the second pixel in each of the multiple color channels is determined as the channel difference value of the corresponding color channel. When the channel difference corresponding to each color channel is less than or equal to the second threshold corresponding to each color channel, the pixel group composed of the first pixel and the second pixel is determined as the matching pixel group. The first similarity is determined based on the ratio between the number of matching pixel groups and the total number of pixel groups participating in the comparison.

[0129] In one possible implementation, the first comparison unit is specifically used for: A first region in the first image and a second region in the second image are determined. The first region and the second region are the regions where the interfering elements are located, and the positions of the first region and the second region correspond. The pixels outside the first region in the first image are compared with the pixels outside the second region in the second image to obtain a first similarity.

[0130] In one possible implementation, the second comparison unit is specifically used for: Verification prompt information is generated based on the verification prompt template. The verification prompt information includes analysis requirements for at least one of the following: interface change type, target interface type, interface change description, interface defect information, and test results. Based on the verification prompt information, a semantic comparison is performed on the first image and the second image to obtain first information; the first information is represented in the form of structured data.

[0131] In one possible implementation, the verification unit is specifically used for: Determine the result type corresponding to the expected test result; The first verification rule corresponding to the result type is determined from the preset set of verification rules; Extract the target information corresponding to the first verification rule from the first information; The target information is matched with the target conditions corresponding to the first verification rule to obtain the verification result.

[0132] In one possible implementation, when the result type is a login result type, the target information includes the target interface type, and the target condition includes the target interface type being a homepage type or a main interface type. When the result type is a payment result type, the target information includes the interface change description, and the target condition includes the interface change description having preset payment success semantic information; When the result type is a search result type, the target information includes the target interface type, and the target condition includes the target interface type being a search result interface type.

[0133] In one possible implementation, the device further includes: an adjustment unit; The adjustment unit is specifically used to acquire historical verification records; determine historical verification accuracy based on the historical verification records; and adjust the first threshold based on the historical verification accuracy.

[0134] In one possible implementation, the first information includes at least one of the following: interface change type, target interface type, semantic similarity, interface change description, interface defect information, and verification confidence.

[0135] In one possible implementation, the verification device for the test results may further include a control unit. The control unit is used to control the first comparison unit, the second comparison unit, and the verification unit to perform corresponding processes in a preset order, and to determine whether to proceed to the next processing stage based on the first similarity or the processing results of each processing stage.

[0136] In summary, the embodiments of this application obtain the semantic content expressed by the interface changes before and after the execution of the first operation through semantic comparison, and verify the semantic content according to the first verification rule determined based on the expected test results. This enables the determination of whether the interface changes conform to the expected test results, reduces misjudgments caused by unexpected interface changes, and improves the accuracy of test result verification.

[0137] This application provides a computer device, such as... Figure 5 As shown in the figure, this figure is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 500 includes: a processor 510 and a memory 520; The memory 520 is used to store program code and transmit the program code to the processor 510; The processor 510 is configured to execute the steps of the method described above according to the instructions in the program code. For example, the processor 510 may acquire a first image captured before the first operation is performed on the first interface, and a second image captured after the first operation is performed on the first interface; compare the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image; when the first similarity is less than or equal to a first threshold, perform a semantic comparison between the first image and the second image to obtain first information, which characterizes the interface changes before and after the first operation; verify the first information according to a first verification rule to obtain a verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

[0138] This application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method described above.

[0139] This application provides a computer program product that, when run on a computer, executes the steps of the method described above.

[0140] This application provides a chip including a processor coupled to a memory for executing computer programs or instructions stored in the memory, such that the chip implements the steps of the method described above.

[0141] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and equipment embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0142] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for verifying test results, characterized in that, include: Acquire a first image before performing the first operation on the first interface, and a second image after performing the first operation on the first interface; The pixels in the first image are compared with the corresponding pixels in the second image to obtain the first similarity between the first image and the second image; When the first similarity is less than or equal to the first threshold, semantic comparison is performed on the first image and the second image to obtain first information, which is used to characterize the interface changes before and after the first operation is performed. The first information is verified according to the first verification rule to obtain the verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

2. The method according to claim 1, characterized in that, The step of comparing the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image includes: For each of the multiple first pixels participating in the comparison in the first image, determine the second pixel in the second image that corresponds to the position of the first pixel. The absolute value of the difference between the channel values ​​of the first pixel and the second pixel in each of the multiple color channels is determined as the channel difference value of the corresponding color channel. When the channel difference corresponding to each color channel is less than or equal to the second threshold corresponding to each color channel, the pixel group composed of the first pixel and the second pixel is determined as the matching pixel group. The first similarity is determined based on the ratio between the number of matching pixel groups and the total number of pixel groups participating in the comparison.

3. The method according to claim 1, characterized in that, The step of comparing the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image includes: A first region in the first image and a second region in the second image are determined. The first region and the second region are the regions where the interfering elements are located, and the positions of the first region and the second region correspond. The pixels outside the first region in the first image are compared with the pixels outside the second region in the second image to obtain a first similarity.

4. The method according to claim 1, characterized in that, The step of performing semantic comparison between the first image and the second image to obtain first information includes: Verification prompt information is generated based on the verification prompt template. The verification prompt information includes analysis requirements for at least one of the following: interface change type, target interface type, interface change description, interface defect information, and test results. Based on the verification prompt information, a semantic comparison is performed on the first image and the second image to obtain first information; the first information is represented in the form of structured data.

5. The method according to claim 1, characterized in that, The verification result of verifying the first information according to the first verification rule to obtain the test result corresponding to the first operation includes: Determine the result type corresponding to the expected test result; The first verification rule corresponding to the result type is determined from the preset set of verification rules; Extract the target information corresponding to the first verification rule from the first information; The target information is matched with the target conditions corresponding to the first verification rule to obtain the verification result.

6. The method according to claim 5, characterized in that, When the result type is a login result type, the target information includes the target interface type, and the target condition includes whether the target interface type is a homepage type or a main interface type; When the result type is a payment result type, the target information includes the interface change description, and the target condition includes the interface change description having preset payment success semantic information; When the result type is a search result type, the target information includes the target interface type, and the target condition includes the target interface type being a search result interface type.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Retrieve historical verification records; The historical verification accuracy rate is determined based on the historical verification records. The first threshold is adjusted based on the historical verification accuracy.

8. The method according to any one of claims 1 to 6, characterized in that, The first information includes at least one of the following: interface change type, target interface type, semantic similarity, interface change description, interface defect information, and verification confidence level.

9. A device for verifying test results, characterized in that, include: The system comprises an acquisition unit, a first comparison unit, a second comparison unit, and a verification unit. The acquisition unit is used to acquire a first image before the first operation is performed on the first interface, and a second image after the first operation is performed on the first interface. The first comparison unit is used to compare the pixels in the first image with the corresponding pixels in the second image to obtain a first similarity between the first image and the second image; The second comparison unit is used to perform semantic comparison between the first image and the second image when the first similarity is less than or equal to the first threshold, and obtain first information. The first information is used to characterize the interface changes before and after performing the first operation. The verification unit is used to verify the first information according to the first verification rule to obtain the verification result of the test result corresponding to the first operation; the first verification rule is determined based on the expected test result corresponding to the first operation.

10. A computer device, characterized in that, The computer device includes: a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the steps of the method as described in any one of claims 1 to 8 according to instructions in the program code.