User interface testing method, terminal device, and computer program product
By performing text recognition and multi-dimensional testing on user interface images, the problem of relying on professional language teams in vehicle system user interface testing has been solved, achieving high-quality testing without labor costs.
Patent Information
- Application Number
- CN202411938973.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In existing technologies, the testing of in-vehicle system user interfaces is limited by the language ability of testers, requiring manual checks by a professional language team. This has a limited scope of application, low practicality, and high labor costs. Ordinary testers cannot effectively test less common languages, leading to a decline in test quality.
By acquiring user interface images, text recognition is performed to obtain data content and location. Multi-dimensional testing, including text dimension and translation dimension, is then conducted using text recognition and translation models to achieve accurate testing of user interface images.
It enables accurate testing of user interfaces across multiple dimensions without the need for a professional language team, improving testing quality, expanding applicability, and reducing labor costs.
Smart Images

Figure CN119862125B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of image processing, and particularly relates to a user interface testing method, a terminal device and a computer program product. BACKGROUND
[0002] With the continuous development of globalization of domestic automobiles, more and more automobiles are no longer limited to domestic sales, and are often sold to all over the world. Therefore, a vehicle-mounted system integrates multiple national languages to meet the needs of users in different regions. When testing the text of a user interface (UI) in the vehicle-mounted system, the UI interface text test is limited by the language ability of the tester.
[0003] At present, the correctness of the text of the UI interface language needs to be checked manually by a professional language team, the application range is small, the practicability is low, and the labor cost is high; ordinary testers cannot understand the text of small languages, which reduces the test quality. SUMMARY
[0004] The embodiments of the present application provide a user interface testing method, a terminal device and a computer program product to solve the problems that the existing technology needs to be checked manually by a professional language team, the application range is small, the practicability is low, and the labor cost is high; and ordinary testers cannot understand the text of small languages, which reduces the test quality.
[0005] In a first aspect, the embodiments of the present application provide a user interface testing method, comprising:
[0006] obtaining a user interface image of a vehicle-mounted system to be tested;
[0007] performing character recognition on the user interface image to obtain target data; the target data includes data content and data position; the data position indicates a position of the target data in the user interface image;
[0008] performing different dimension tests on the target data based on the data content and the data position to obtain test results of the user interface image in the different dimensions; the different dimensions include a character dimension and a translation dimension.
[0009] Optionally, the character recognition on the user interface image to obtain the target data comprises:
[0010] naming the user interface image based on a naming rule to obtain an image file containing an image name;
[0011] Input the image file into a character recognition model for recognition to obtain initial data; the initial data includes the image name, original content, data coordinates, and data confidence;
[0012] If the data confidence is greater than or equal to a set confidence, the initial data is processed based on a data processing rule to obtain the target data.
[0013] Optionally, the target data is tested in different dimensions based on the data content and the data position to obtain test results of the user interface image in the different dimensions, including:
[0014] For the character dimension, historical version information corresponding to the target data is obtained; the historical version information includes historical content and historical position of the target data;
[0015] The target data is tested based on the historical version information to obtain a test result of the user interface image in the character dimension;
[0016] For the translation dimension, the target data is input into a translation model for processing to obtain translation data corresponding to the target data;
[0017] Based on the data position, a target image containing the translation data and the data content is output, and the target image is determined as a test result of the user interface image in the translation dimension; the size of the target image is the same as that of the user interface image.
[0018] Optionally, the target data includes target version information; the target data is at least two, the character dimension includes a content dimension, the content dimension includes a content quantity dimension and an actual content dimension; and a test result of the user interface image in the content dimension is obtained according to the following manner:
[0019] A historical quantity of the target data under the historical version information is determined;
[0020] The historical quantity is compared with a quantity of the target data under the target version information to obtain a test result of the user interface image in the content quantity dimension;
[0021] Data content of all target data under the target version information is compared with data content of all target data under the historical version information to obtain a test result of the user interface image in the actual content dimension.
[0022] Optionally, the data position comprises a start point, an end point and a center point of the target data, the history position comprises a history start point, a history end point and a history center point of the target data, the character dimension comprises a position dimension, and the test result of the user interface image in the position dimension is obtained according to the following manner:
[0023] comparing the start point, the end point and the center point of the target data with the history start point, the history end point and the history center point respectively to obtain a first result of the user interface image in the position dimension;
[0024] comparing the font size of the data content with the font size of the history content to obtain a second result of the user interface image in the position dimension;
[0025] determining the test result of the user interface image in the position dimension based on the first result and the second result.
[0026] Optionally, the character dimension comprises a font dimension, and the test result of the user interface image in the font dimension is obtained according to the following manner:
[0027] performing cropping processing on the user interface image based on the data position to obtain a first image containing only the target data;
[0028] performing cropping processing on a history interface image corresponding to the history version information based on the history position to obtain a second image containing only the target data;
[0029] performing gray processing on the first image and the second image respectively to obtain a third image corresponding to the first image and a fourth image corresponding to the second image;
[0030] calculating a similarity between the third image and the fourth image to obtain a first structural similarity index;
[0031] determining the test result of the user interface image in the font dimension based on the first structural similarity index.
[0032] Optionally, the character dimension comprises a color dimension, and the test result of the user interface image in the color dimension is obtained according to the following manner:
[0033] performing cropping processing on the user interface image based on the data position to obtain a first image containing only the target data;
[0034] performing cropping processing on a history interface image corresponding to the history version information based on the history position to obtain a second image containing only the target data;
[0035] performing three-channel color separation processing on the first image and the second image respectively to obtain a first sub-image of the first image under different channel colors, and a second sub-image of the second image under the different channel colors;
[0036] For any one channel color, the similarity between the first sub-image and the second sub-image under the any one channel color is calculated to obtain a second structural similarity index;
[0037] Based on the second structural similarity index under the different channel colors, a test result of the user interface image in the color dimension is determined.
[0038] Optionally, after the test of the target data in different dimensions based on the data content and the data position is performed to obtain the test result of the user interface image in the different dimensions, the method further includes:
[0039] For any one dimension, if the test result of the any one dimension is different from the target data under the historical version information, the target data is marked based on the data position, and the user interface image after the marking is output.
[0040] In a second aspect, an embodiment of the present application provides a user interface testing device, including:
[0041] A first obtaining unit is configured to obtain a user interface image to be tested.
[0042] A first identifying unit is configured to perform text recognition on the user interface image to obtain target data, wherein the target data includes data content and data position, and the data position indicates a position of the target data in the user interface image.
[0043] A first testing unit is configured to perform a test of the target data in different dimensions based on the data content and the data position to obtain a test result of the user interface image in the different dimensions, wherein the different dimensions include a text dimension and a translation dimension.
[0044] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor performs the computer program to implement the user interface testing method in any one of the above first aspect.
[0045] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the user interface testing method in any one of the above first aspect.
[0046] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a terminal device, enables the terminal device to perform the user interface testing method in any one of the first aspect.
[0047] Compared with the prior art, the embodiment of the present application has the beneficial effects that:
[0048] The user interface testing method provided by the embodiment of the present application comprises the following steps: obtaining a user interface image to be tested; performing character recognition on the user interface image to obtain target data; the target data comprises data content and a data position; the data position refers to a position of the target data in the user interface image; performing testing on the target data in different dimensions based on the data content and the data position to obtain testing results of the user interface image in different dimensions; the different dimensions comprise a character dimension and a translation dimension. Compared with the prior art, the embodiment of the present application can realize accurate testing of a UI interface in the character dimension and the translation dimension and the like by using the target data comprising the data content and the data position obtained through character recognition, thereby improving the testing quality. Meanwhile, the embodiment of the present application solves the problem that a general tester without a small language function can test a small language UI page, does not need a professional language team to intervene, expands the application range, and increases the practicability. BRIEF DESCRIPTION OF DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0050] Figure 1 is an implementation flowchart of the user interface testing method provided by an embodiment of the present application;
[0051] Figure 2 is an implementation flowchart of the user interface testing method provided by another embodiment of the present application;
[0052] Figure 3 is a data structure diagram provided by an embodiment of the present application;
[0053] Figure 4 is a target data diagram provided by an embodiment of the present application;
[0054] Figure 5 is an implementation flowchart of the user interface testing method provided by another embodiment of the present application;
[0055] Figure 6is an implementation flowchart of a user interface testing method provided by another embodiment of the present application;
[0056] Figure 7 is an implementation flowchart of a user interface testing method provided by another embodiment of the present application;
[0057] Figure 8 is a schematic diagram of a target image provided by an embodiment of the present application;
[0058] Figure 9 is a structural schematic diagram of a user interface testing device provided by an embodiment of the present application;
[0059] Figure 10 is a structural schematic diagram of a terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0060] In the following description, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, persons skilled in the art will understand that the present application can be implemented in other embodiments without these specific details. In other instances, well-known systems, devices, circuits, and methods have not been described in detail so as not to unnecessarily obscure the description of the present application.
[0061] In actual applications, with the continuous development of globalization of domestic automobiles, more and more automobiles are no longer limited to domestic sales, and are often sold to all over the world. Therefore, the vehicle-mounted system integrates multiple national languages to meet the needs of users in different regions. When testing the text of the user interface (UI) in the vehicle-mounted system, the language ability of the tester is limited, which limits the UI interface text test.
[0062] At present, the correctness of the text of the existing UI interface language needs to be checked manually by a professional language team, which has a small applicable range, low practicability, and high labor cost. Ordinary testers cannot understand the text of the minority language, which reduces the test quality.
[0063] Therefore, the present application provides a user interface testing method, which does not need the intervention of a professional language team, and even ordinary testers without the function of a minority language can realize accurate testing of the content, font, position, color, translation, and other dimensions of the UI interface.
[0064] Please refer to Figure 1 , Figure 1 is an implementation flowchart of a user interface testing method provided by an embodiment of the present application. In the embodiment of the present application, the execution subject of the user interface testing method is a terminal device. The terminal device includes but is not limited to a notebook, a desktop computer, a computer, and the like.
[0065] As Figure 1 shown, the user interface test method provided by an embodiment of the present application can include S101-S103, which are described in detail as follows:
[0066] In S101, a user interface image to be tested is acquired.
[0067] In the embodiment of the present application, when a relevant person needs to test the UI interface of the car machine, the terminal device of the relevant person can establish a connection with the debugging tool (Android Debug Bridge, ADB) of the car machine and acquire the root permission of the car machine.
[0068] In actual application, ADB is a tool for debugging Android devices, which allows users to comprehensively operate and manage Android devices through a computer. ADB is a command line tool based on C / S architecture, through which the PC end can communicate with the Android device.
[0069] In the car machine industry, ADB tools are very common. Since modern car machines mostly use Android systems, ADB has become an important tool for debugging car machine applications or programs. Through ADB, developers can conveniently debug applications in the car machine, perform system upgrades, install software, and the like.
[0070] In the embodiment of the present application, after the terminal device acquires the root permission of the car machine, the terminal device can perform a screenshot operation on the UI interface of the car machine to obtain a UI interface screenshot of the car machine, i.e., a user interface image to be tested.
[0071] In S102, text recognition is performed on the user interface image to obtain target data; the target data includes data content and data position; the data position refers to a position of the target data in the user interface image.
[0072] In the embodiment of the present application, after the terminal device obtains the user interface image, the terminal device can input the user interface image into a text recognition model for recognition to obtain target data in the user interface image. The target data includes but is not limited to data content and data position. The data position refers to a position of the target data in the user interface image.
[0073] It should be noted that the target data specifically refers to data in the user interface image that needs to be tested.
[0074] In the embodiment of the present application, the target data can be one or multiple.
[0075] It should be noted that one target data can include a set of continuous characters, and the set of continuous characters can include at least one character.
[0076] Therefore, after the terminal device inputs the user interface image into the character recognition model for recognition to obtain all characters contained in the user interface image, the terminal device can traverse to detect the left-right spacing between each character, and determine at least two characters with a left-right spacing less than a set spacing as continuous characters. The set spacing can be determined according to actual needs, and is not limited herein.
[0077] Based on this, the terminal device can obtain multiple sets of continuous characters in the user interface image. Then, the terminal device can determine one set of continuous characters as one target data.
[0078] In actual application, the Optical Character Recognition (OCR) model is a technology capable of recognizing and extracting printed and handwritten texts from digital images and PDFs. This technology automatically extracts text information in digital images or PDF files by scanning them.
[0079] In an embodiment of the present application, in order to improve the accuracy of obtaining target data and improve the subsequent test accuracy, the terminal device can obtain the target data through steps S201-S203 as shown in the following table, and the details are as follows: Figure 2
[0080] In S201, the user interface image is named based on a naming rule to obtain an image file containing an image name.
[0081] In this embodiment, in order to facilitate subsequent searching and comparison of the UI interface under the corresponding historical version to improve the test accuracy, the terminal device can name the obtained user interface image based on a naming rule to obtain an image file containing an image name. The naming rule can be determined according to actual needs, and is not limited herein.
[0082] In some possible embodiments, the naming rule can include naming in the form of "project-version-module-page-time (screenshot time)", and connecting any two adjacent words with a separator "-".
[0083] For example, when a certain user interface image corresponds to a project Car01, a version x1x2x3x4xxx, a module loveCar, a page homePage, and a screenshot time 20240909102501, the image name can be Car01-x1x2x3x4xxx-loveCar-homePage-20240909102501.png.
[0084] In S202, the image file is input to a character recognition model for recognition to obtain initial data; the initial data includes the image name, original content, data coordinates, and data confidence.
[0085] In this embodiment, after obtaining the image file, the terminal device can input the image file to the character recognition model for recognition to obtain initial data, in order to obtain accurate target data. The initial data includes the image name, original content, data coordinates, and data confidence.
[0086] It should be noted that there are multiple initial data.
[0087] In this embodiment, in order to improve the test efficiency, the terminal device can compare the data confidence of the initial data with the set confidence to determine whether the initial data needs to be tested.
[0088] In an embodiment of the present application, when the terminal device detects that the data confidence of the initial data is less than the set confidence, it means that the initial data does not need to be tested, i.e., the initial data is invalid data. Therefore, the terminal device can eliminate the initial data and continue to detect the confidence of the next initial data.
[0089] In another embodiment of the present application, when the terminal device detects that the data confidence of the initial data is greater than or equal to the set confidence, it can execute step S203.
[0090] In S203, if the data confidence is greater than or equal to the set confidence, the initial data is processed based on a data processing rule to obtain the target data.
[0091] In this embodiment, when the terminal device detects that the data confidence of the initial data is greater than or equal to the set confidence, it means that the initial data needs to be tested, i.e., the initial data is valid data. Therefore, in order to improve the test efficiency and test accuracy, the terminal device can process the initial data based on a data processing rule to obtain target data. The data processing rule can be determined according to actual needs, which is not limited here.
[0092] In some possible embodiments, the data processing rule can include processing the initial data according to a data structure. The data structure is as shown in Figure 3 .
[0093] For example, refer to Figure 3 , Figure 3 is a data structure diagram provided by an embodiment of the present application. As shown in Figure 3As shown, the data structure includes: project, version, module, page, and text data. Among them, text includes: data content, data position, center point, confidence, and timestamp.
[0094] It should be noted that the above text specifically refers to the original text corresponding to the initial data, i.e., the original content, and position specifically includes the start and end points of the initial data, and confidence specifically refers to the data confidence of the initial data.
[0095] Based on this, the terminal device can process the initial data according to the data structure as shown in Figure 3 to obtain the target data.
[0096] Specifically, since the above data structure includes project, version, module, page, and timestamp, and in combination with S201, the image name in the initial data is named as "project-version-module-page-time (screenshot time)", the terminal device can determine the project, version, module, page, and timestamp according to the image name of the initial data.
[0097] For example, assuming that the image name is: Car01-x1x2x3x4xxx-loveCar-homePage-20240909102501.png, then the corresponding project is "Car01", the version is "x1x2x3x4xxx", the module is "loveCar", the page is "homePage", and the timestamp is "20240909102501".
[0098] At the same time, the terminal device can obtain the upper left corner coordinates and the lower right corner coordinates of the initial data in real time, and determine the upper left corner coordinates as the start point of the initial data and the lower right corner coordinates as the end point of the initial data, thereby obtaining the position. Then, the terminal device can perform mean calculation on the horizontal coordinates of the upper left corner coordinates and the horizontal coordinates of the lower right corner coordinates to obtain the horizontal coordinates of the center point, and perform mean calculation on the vertical coordinates of the upper left corner coordinates and the vertical coordinates of the lower right corner coordinates to obtain the vertical coordinates of the center point, thereby obtaining the ex_position.
[0099] For example, please refer to Figure 4 ,Figure 4 is a target data schematic diagram provided by an embodiment of the present application. As shown in Figure 4 , the target data includes two.
[0100] In some possible embodiments, the target data can further include an image name, data confidence, data center point, and a timestamp, etc.
[0101] In S103, the target data is tested in different dimensions based on the data content and the data position, to obtain test results of the user interface image in the different dimensions; the different dimensions include a text dimension and a translation dimension.
[0102] In an embodiment of the present application, after obtaining the target data, the terminal device can test the target data in different dimensions according to the data content and the data position in the target data, to obtain test results of the user interface image in different dimensions. The different dimensions include but are not limited to a text dimension and a translation dimension.
[0103] The text dimension includes but is not limited to a content dimension, a position dimension, a font dimension, and a color dimension, etc.
[0104] Specifically, the terminal device can input the target data containing the data content and the data position into a test model for processing, to obtain the test results of the user interface image in different dimensions.
[0105] The test model can be obtained by training a pre-constructed neural network model based on a preset sample set. Each sample data in the preset sample set includes sample information (the sample information contains sample data position and sample data content) and a sample test result (the sample test result includes test sub-results in different dimensions) corresponding to the sample information. When training the pre-constructed neural network model, the sample information in each sample data is taken as the input of the neural network model, and the sample test result corresponding to the sample information in each sample data is taken as the output of the neural network model. Through training, the neural network model can learn the corresponding relationship between all possible sample information and sample test results, and the trained neural network model is taken as the test model.
[0106] In some possible embodiments, in order to improve the test accuracy in different dimensions, the test model can include multiple test sub-models, such as a text test sub-model and a translation test sub-model.
[0107] In some possible embodiments, in order to improve the test accuracy in different dimensions, the test model can include multiple test sub-models, such as a text test sub-model and a translation test sub-model.
[0108] In the embodiment of the present application, the test result of the character dimension includes, but is not limited to, test pass and test fail.
[0109] It should be noted that when the test result is test fail, in order to facilitate relevant personnel to determine the area of test fail in the user interface image in a timely manner, the test result can further include difference content.
[0110] The test result of the translation dimension includes the translation content corresponding to the data content.
[0111] In an embodiment of the present application, the terminal device can obtain test results of different dimensions through steps S301-S304 as shown in the following table: Figure 5 The details are as follows:
[0112] In S301, for the character dimension, the historical version information corresponding to the target data is obtained; the historical version information includes historical content and historical position of the target data.
[0113] In S302, the target data is tested based on the historical version information, and the test result of the user interface image in the character dimension is obtained.
[0114] It should be noted that the target data can further include target version information.
[0115] In the embodiment, since the database corresponding to the terminal device stores a large amount of various data under historical versions, the terminal device can obtain the historical version information corresponding to the target data through the target version information in the target data. The historical version information includes historical content and historical position of the target data.
[0116] It should be noted that the historical version information specifically refers to the information contained in the last version before the version contained in the image name of the target data.
[0117] Then, the terminal device can compare the target data with the historical version information in the character dimension to detect the similarity between the target data and the historical version information, so as to obtain the test result of the user interface image in the character dimension.
[0118] In some possible embodiments, when the character dimension includes the content dimension, the position dimension, the translation dimension, the font dimension and the color dimension, the terminal device can further compare the target data with the historical version information one by one in the content dimension, the position dimension, the translation dimension, the font dimension and the color dimension, detect the similarity between the target data and the historical version information, and obtain the test result of the user interface image in the content dimension, the position dimension, the font dimension and the color dimension, respectively.
[0119] In an embodiment of the present application, when the target data comprises target version information, and the target data is at least two, the literal dimension comprises the content dimension, and the content dimension comprises the content quantity dimension and the actual content dimension, in order to improve the test accuracy and test quality in the content dimension, the terminal device can obtain the test result in the content dimension according to the following steps, which are described in detail as follows:
[0120] determining the historical quantity of the target data under the historical version information;
[0121] comparing the historical quantity with the quantity of the target data under the target version information to obtain the test result of the user interface image in the content quantity dimension;
[0122] comparing the data content of all target data under the target version information with the data content of all target data under the historical version information to obtain the test result of the user interface image in the actual content dimension.
[0123] In the embodiment, the terminal device can count the historical quantity of the target data under the historical version information and count the quantity of the target data under the target version information.
[0124] Then, the terminal device can compare the historical quantity with the quantity of the target data under the target version information to obtain the test result of the user interface image in the content quantity dimension. The test result in the content quantity dimension includes but is not limited to test pass and test fail.
[0125] It should be noted that the test pass is used to represent that the quantity of the target data in the user interface image is equal to the historical quantity of the target data under the historical version information, that is, the quantity of the target data in the user interface image has no change.
[0126] The test fail is used to represent that the quantity of the target data in the user interface image is not equal to the historical quantity of the target data under the historical version information, that is, the quantity of the target data in the user interface image has changed.
[0127] In some possible embodiments, when the terminal device determines that the test result of the user interface image in the content quantity dimension is test fail, the set library of python can be used to do the difference set to record the target data that does not exist and / or the redundant target data in the user interface image relative to the historical version information.
[0128] In this embodiment, the terminal device can integrate the data content of each target data under the target version information to obtain the overall data content under the target version information. Meanwhile, the terminal device can also integrate the data content of each target data under the historical version information to obtain the overall data content under the historical version information.
[0129] In some possible embodiments, the terminal device can splice the data content of each target data under the target version information to realize the integration of the data content of each target data under the target version information, so as to obtain the overall data content under the target version information.
[0130] For example, assuming that the data content of each target data under the target version information is X1, X2, X3, X4 and X5 respectively, the overall data content under the target version information can be [X1, X2, X3, X4, X5].
[0131] In some possible embodiments, the terminal device can splice the data content of each target data under the target version information to realize the integration of the data content of each target data under the target version information, so as to obtain the overall data content under the target version information.
[0132] For example, assuming that the data content of each target data under the historical version information is A1, A2, A3, A4 and A5 respectively, the overall data content under the historical version information can be [A1, A2, A3, A4, A5].
[0133] Then, the terminal device can compare the overall data content under the target version information with the overall data content under the historical version information to obtain the test result in the actual content dimension.
[0134] It should be noted that the test result in the actual content dimension is used to describe whether the data content contained in the overall data content under the target version information is the same as the data content contained in the overall data content under the historical version information.
[0135] In this embodiment, the test result in the actual content dimension includes but is not limited to test pass and test fail.
[0136] It should be noted that the test pass is used to represent that the overall data content under the target version information is the same as the overall data content under the historical version information, that is, the data content contained in the overall data content under the target version information corresponds to the data content contained in the overall data content under the historical version information.
[0137] In some possible embodiments, the terminal device can compare each data content contained in the overall data content under the target version information with each data content contained in the overall data content under the historical version information one by one, to detect whether there is a one-to-one correspondence between each data content contained in the overall data content under the target version information and each data content contained in the overall data content under the historical version information, i.e., whether each data content contained in the overall data content under the target version information is the same as each data content contained in the overall data content under the historical version information, so as to obtain the test result of the user interface image in the actual content dimension.
[0138] For example, assuming that the overall data content under the target version information is [X1, X2, X3, X4, X5], and the overall data content under the historical version information is also [X1, X2, X3, X4, X5], it is indicated that there is a one-to-one correspondence between each data content contained in the overall data content under the target version information and each data content contained in the overall data content under the historical version information, i.e., each data content contained in the overall data content under the target version information is the same as each data content contained in the overall data content under the historical version information, and therefore, the terminal device can determine that the test result of the user interface image in the actual content dimension is test passed.
[0139] It should be noted that the splicing order of the data contents of the various target data will not affect the test result obtained after comparing each data content contained in the overall data content under the target version information with each data content contained in the overall data content under the historical version information.
[0140] For example, assuming that the overall data content under the target version information is [X1, X2, X3, X4, X5], and the overall data content under the historical version information is [X1, X3, X2, X5, X4], since there is still a one-to-one correspondence between each data content contained in the overall data content under the target version information and each data content contained in the overall data content under the historical version information, i.e., each data content contained in the overall data content under the target version information is still the same as each data content contained in the overall data content under the historical version information, and therefore, the terminal device can still determine that the test result of the user interface image in the actual content dimension is test passed.
[0141] For example, assume that the overall data content under the target version information is [X1, X2, X3, X4, X5], and the overall data content under the historical version information is also [X1, X2, X3, X4, X6], which indicates that the respective data content included in the overall data content under the target version information does not correspond to the respective data content included in the overall data content under the historical version information, i.e., the respective data content included in the overall data content under the target version information is not completely the same as the respective data content included in the overall data content under the historical version information. Therefore, the terminal device can determine that the test result of the user interface image under the actual content dimension is test failure.
[0142] The respective data content included in the overall data content under the target version information corresponds to the respective data content included in the overall data content under the historical version information specifically refers to that the meaning actually expressed by the respective data content included in the overall data content under the target version information is the same as the meaning actually expressed by the respective data content included in the overall data content under the historical version information.
[0143] The test failure described above is used to represent that the overall data content under the target version information is different from the overall data content under the historical version information, i.e., the respective data content included in the overall data content under the target version information does not correspond to the respective data content included in the overall data content under the historical version information.
[0144] It should be noted that the above-mentioned non-correspondence can be that there is a certain data content in the overall data content under the target version information that is not included in the overall data content under the historical version information.
[0145] The above-mentioned non-correspondence can also be that there is a certain data content in the overall data content under the historical version information that is not included in the overall data content under the target version information.
[0146] In some possible embodiments, when the terminal device determines that the test result of the user interface image under the actual content dimension is test failure, the terminal device can record the part of the target data in which the content difference exists.
[0147] In another embodiment of the present application, when the data position of the target data includes the start point, the end point, and the center point of the target data, the historical position includes the historical start point, the historical end point, and the historical center point of the target data, and the text dimension includes the position dimension, in order to improve the test accuracy and test quality under the position dimension, the terminal device can specifically obtain the test result of the user interface image under the position dimension according to the following steps, which are described in detail as follows:
[0148] comparing the start point, the end point and the center point of the target data with the historical start point, the historical end point and the historical center point respectively to obtain a first result of the user interface image in the position dimension;
[0149] comparing the font size of the data content with the font size of the historical content to obtain a second result of the user interface image in the position dimension;
[0150] determining a test result of the user interface image in the position dimension based on the first result and the second result.
[0151] In the embodiment, when the target data includes multiple target data, the terminal device can compare the data content of each target data under the target version information with the data content of each target data under the historical version information one by one, so as to determine the data content of a certain target data under the historical version information which is the same as the data content of any one target data under the target version information, and match the target data under the target version information with the same data content with the target data under the historical version information.
[0152] Then, the terminal device can compare the target data under the target version information and the target data under the historical version information which are matched successfully in the position dimension.
[0153] It should be noted that the start point of the target data specifically refers to the top-left corner coordinate of the first order data in the target data, the end point of the target data specifically refers to the bottom-right corner coordinate of the last order data in the target data, and the center point of the target data is calculated from the start point and the end point of the target data.
[0154] In the embodiment, in order to accurately test the data position of the target data, the terminal device can compare the start point of the target data with the matched historical start point, compare the end point of the target data with the matched historical end point, and compare the center point of the target data with the matched historical end point, to obtain a first result of the user interface image in the position dimension. The first result includes but is not limited to test pass and test fail.
[0155] It should be noted that the test pass is used to represent that the start point, the end point and the center point of the target data have all passed the test, that is, the start point, the end point and the center point of the target data are exactly the same as the corresponding historical start point, historical end point and historical center point.
[0156] The test fail is used to represent that at least one of the start point, the end point and the center point of the target data has failed the test, that is, at least one of the start point, the end point and the center point of the target data is different from the corresponding historical position.
[0157] In actual application, since the font size also affects the data position of the target data, i.e., causes the data position to change, in this embodiment, in order to further improve the test accuracy of the position of the target data, the terminal device can compare the font size of the data content of the target data with the font size of the corresponding historical content to obtain a second result of the user interface image in the position dimension. The second result includes, but is not limited to, test pass and test fail.
[0158] It should be noted that the test pass is used to represent that the font size of the data content of the target data is completely the same as the font size of the corresponding historical content.
[0159] The test fail is used to represent that the font size of the data content of the target data is not completely the same as the font size of the corresponding historical content.
[0160] Based on this, the terminal device can determine the test result of the user interface image in the position dimension according to the first result and the second result.
[0161] Specifically, when the first result is test fail and / or the second result is test fail, the terminal device can determine that the test result of the user interface image in the position dimension is test fail; when the first result is test pass and the second result is test pass, the terminal device can determine that the test result of the user interface image in the position dimension is test pass.
[0162] In some possible embodiments, when the terminal device determines that the test result of the user interface image in the position dimension is test fail, the terminal device can record the part of the target data in which the position difference exists.
[0163] In another embodiment of the present application, when the character dimension includes the font dimension, in order to improve the test accuracy and test quality in the font dimension, the terminal device can specifically obtain the test result of the user interface image in the font dimension through steps S401-S405 as shown in the following table: Figure 6
[0164] In S401, the user interface image is cropped based on the data position to obtain a first image containing only the target data.
[0165] In S402, the historical interface image corresponding to the historical version information is cropped based on the historical position to obtain a second image containing only the target data.
[0166] In this embodiment, when the target data includes multiple target data, the terminal device can compare the data content of each target data under the target version information with the data content of each target data under the historical version information one by one, so as to determine the data content of a certain target data under the historical version information which is the same as the data content of any one target data under the target version information, and match the target data under the target version information with the same data content with the target data under the historical version information.
[0167] After that, the terminal device can compare the target data under the target version information and the target data under the historical version information which are matched successfully in the font dimension.
[0168] In this embodiment, in order to realize accurate testing of the user interface image in the font dimension and avoid the influence of the remaining data except the target data on the test, the terminal device can perform cropping processing on the user interface image based on the data position of the target data to obtain a first image containing only the target data. Meanwhile, the terminal device can perform cropping processing on the historical interface image corresponding to the historical version information based on the historical position matched with the target data to obtain a second image containing only the target data.
[0169] In S403, the first image and the second image are respectively subjected to gray scale processing to obtain a third image corresponding to the first image and a fourth image corresponding to the second image.
[0170] In this embodiment, in order to further improve the test quality in the font dimension, the terminal device can perform gray scale processing on the first image and the second image respectively to identify the text outline and details of the target data, so as to obtain a third image corresponding to the first image and a fourth image corresponding to the second image.
[0171] In some possible embodiments, the terminal device can use the PIL library of python to perform gray scale processing on the first image and the second image.
[0172] In S404, the similarity between the third image and the fourth image is calculated to obtain a first structural similarity index.
[0173] In this embodiment, after obtaining the third image and the fourth image, the terminal device can compare the third image with the fourth image to detect the similarity between the third image and the fourth image, so as to obtain a first structural similarity index.
[0174] In actual application, the structural similarity (SSIM) index is an index for measuring the similarity between two images.
[0175] In some possible embodiments, the terminal device can use the OpenCV library of python to compare the similarity between the third image and the fourth image to obtain the first structural similarity index.
[0176] In S405, based on the first structural similarity index, a test result of the user interface image in the font dimension is determined.
[0177] In this embodiment, after obtaining the first structural similarity index, the terminal device can compare the first structural similarity index with a set threshold. The set threshold can be determined according to actual needs, which is not limited here.
[0178] In one embodiment of the present application, when the terminal device detects that the first structural similarity index is greater than or equal to the set threshold, it can be determined that the similarity between the third image and the fourth image is extremely high, and therefore the terminal device can determine that the test result of the user interface image in the font dimension is test passed.
[0179] In another embodiment of the present application, when the terminal device detects that the first structural similarity index is less than the set threshold, it can be determined that the similarity between the third image and the fourth image is low, and therefore the terminal device can determine that the test result of the user interface image in the font dimension is test failed.
[0180] In some possible embodiments, when the terminal device determines that the test result of the user interface image in the font dimension is test failed, it can record the part of the target data where the font difference exists.
[0181] In yet another embodiment of the present application, when the character dimension includes the color dimension, in order to improve the test accuracy and test quality in the color dimension, the terminal device can specifically obtain the test result of the user interface image in the color dimension through steps S501-S505 as shown in the following table. Figure 7
[0182] In S501, the user interface image is cropped based on the data position to obtain a first image containing only the target data.
[0183] In S502, the historical interface image corresponding to the historical version information is cropped based on the historical position to obtain a second image containing only the target data.
[0184] When the target data includes multiple target data in this embodiment, the terminal device can compare the data content of each target data under the target version information with the data content of each target data under the historical version information one by one, to determine the data content of a certain target data under the historical version information that is the same as the data content of any one target data under the target version information, and match the target data under the target version information with the same data content with the target data under the historical version information.
[0185] After that, the terminal device can compare the target data under the target version information and the target data under the historical version information that are matched successfully in the color dimension.
[0186] In this embodiment, in order to realize accurate testing of the user interface image in the color dimension and avoid the influence of the remaining data except the target data on the testing, the terminal device can perform cropping processing on the user interface image based on the data position of the target data to obtain a first image containing only the target data. Meanwhile, the terminal device can perform cropping processing on the historical interface image corresponding to the historical version information based on the historical position matched with the target data to obtain a second image containing only the target data.
[0187] In S503, the first image and the second image are respectively subjected to three-channel color separation processing to obtain a first sub-image of the first image in different channel colors and a second sub-image of the second image in the different channel colors.
[0188] In this embodiment, in order to further improve the testing quality in the color dimension, the terminal device can perform three-channel color separation processing on the first image and the second image respectively to obtain a first sub-image of the first image in different channel colors and a second sub-image of the second image in different channel colors. The three-channel color specifically refers to three color channels of red (R), green (G) and blue (B).
[0189] In some possible embodiments, the terminal device can use the split function in OpenCV to separate the multi-channel array in the above first image and second image into three single-channel arrays, to obtain the first sub-image of the first image in different channel colors and the second sub-image of the second image in different channel colors.
[0190] In S504, for any one channel color, the similarity between the first sub-image and the second sub-image in the any one channel color is calculated to obtain a second structural similarity index.
[0191] In this embodiment, for any one channel color, the terminal device can compare the first sub-image and the second sub-image corresponding to the any one channel color to detect the similarity between the first sub-image and the second sub-image, thereby obtaining the second structural similarity index under the any one channel color.
[0192] In S505, based on the second structural similarity indexes under the different channel colors, a test result of the user interface image in the color dimension is determined.
[0193] In this embodiment, after obtaining the second structural similarity indexes under the different channel colors, the terminal device can compare each second structural similarity index with a set threshold.
[0194] In an embodiment of the present application, when the terminal device detects that each second structural similarity index is greater than or equal to the set threshold, it can be determined that the similarity between the first image and the second image is extremely high, and therefore the terminal device can determine that the test result of the user interface image in the color dimension is test passed.
[0195] In another embodiment of the present application, when the terminal device detects that at least one second structural similarity index is less than the set threshold, it can be determined that the similarity between the first image and the second image is relatively low, and therefore the terminal device can determine that the test result of the user interface image in the color dimension is test failed.
[0196] In some possible embodiments, when the terminal device determines that the test result of the user interface image in the color dimension is test failed, it can record the part of the target data where the color difference exists.
[0197] In S303, the target data is input into the translation model for processing to obtain translation data corresponding to the target data.
[0198] In this embodiment, the terminal device can input the target data into the translation model for processing to obtain translation data corresponding to the target data.
[0199] It should be noted that the above translation model can be an existing Multimodal Machine Translation (MMT), which will not be described here.
[0200] In practical applications, MMT is a machine translation method for processing multimodal data, which can accept different forms of input such as images and audio and generate corresponding translation texts, or accept text input and generate corresponding image or audio output.
[0201] In S304, a target image containing the translated data and the data content is output based on the data position, and the target image is determined as a test result of the user interface image in the translation dimension; the target image has the same size as the user interface image.
[0202] In this embodiment, after obtaining the translated data, the terminal device can draw a target image containing the translated data and the data content on a blank canvas based on the data position of the target data, and output the target image, for the convenience of subsequent semantic checking test of the classical Chinese by relevant personnel.
[0203] For example, refer to Figure 8 , Figure 8 FIG. 1 is a schematic diagram of a target image provided by an embodiment of the present application. As shown in Figure 8 , Figure 8 (a) in FIG. 1 is a user interface image, Figure 8 (b) in FIG. 1 is a target image containing translated data corresponding to (a).
[0204] Then, the terminal device can determine the target image as a test result of the user interface image in the translation dimension. The target image has the same size as the user interface image.
[0205] As can be seen above, the user interface test method provided by the embodiments of the present application includes the following steps: obtaining a user interface image to be tested; performing character recognition on the user interface image to obtain target data; the target data includes data content and a data position; the data position refers to a position of the target data in the user interface image; performing different dimension tests on the target data based on the data content and the data position to obtain test results of the user interface image in different dimensions; the different dimensions include a character dimension and a translation dimension. Compared with the prior art, the present application can achieve accurate testing of a UI interface in the character and translation dimensions by using the target data including the data content and the data position obtained through character recognition, thereby improving the test quality. Meanwhile, the present application solves the problem of testing a small language UI page by ordinary testers without small language function, without the intervention of a professional language team, thereby expanding the application range and increasing the practicability.
[0206] In an embodiment of the present application, after obtaining the test results of the user interface image in the different dimensions, the terminal device can specifically perform the following steps to facilitate relevant personnel to understand the areas with differences in the user interface image in a timely and clear manner, which are described as follows.
[0207] For any one dimension, if the test result of the any one dimension is different from the target data under the historical version information, the target data is marked based on the data position, and the user interface image after the marking is output.
[0208] In this embodiment, for any one dimension, when the terminal device detects that the test result of any one dimension is different from the target data under the historical version information, that is, the test result of the any one dimension is test failure, the terminal device can mark the target data based on the data position of the target data, and output the user interface image after the marking.
[0209] The marking manner includes but is not limited to highlighting the target data and marking the target data with a frame.
[0210] In some possible embodiments, in order to further clarify which dimension the test of the target data fails in, the terminal device can set a color corresponding to each dimension, and when it is detected that the test result of the target data in a certain dimension is test failure, the terminal device can mark the target data using the color corresponding to the dimension.
[0211] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0212] Corresponding to the user interface test method described in the above embodiments, Figure 9 A structural schematic diagram of a user interface test device provided by an embodiment of the present application is shown, and only parts related to the embodiments of the present application are shown for ease of description. Refer to Figure 9 The user interface test device 600 includes a first acquisition unit 61, a first identification unit 62, and a first test unit 63. Wherein:
[0213] The first acquisition unit 61 is configured to acquire a user interface image to be tested.
[0214] The first identification unit 62 is configured to perform text recognition on the user interface image to obtain target data; the target data includes data content and data position; the data position refers to the position of the target data in the user interface image.
[0215] The first test unit 63 is configured to test the target data in different dimensions based on the data content and the data position, and obtain test results of the user interface image in the different dimensions; the different dimensions include a text dimension and a translation dimension.
[0216] In an embodiment of the present application, the first identifying unit 62 specifically comprises a naming unit, a second identifying unit and a first processing unit. Wherein:
[0217] The naming unit is configured to name the user interface image based on a naming rule to obtain an image file containing an image name.
[0218] The second identifying unit is configured to input the image file into a character recognition model for recognition to obtain initial data; the initial data comprises the image name, original content, data coordinates and data confidence.
[0219] The first processing unit is configured to, if the data confidence is greater than or equal to a set confidence, process the initial data based on a data processing rule to obtain the target data.
[0220] In an embodiment of the present application, the first testing unit 63 specifically comprises a second obtaining unit, a second testing unit, a second processing unit and an output unit. Wherein:
[0221] The second obtaining unit is configured to obtain historical version information corresponding to the target data for the character dimension; the historical version information comprises historical content and historical position of the target data.
[0222] The second testing unit is configured to test the target data based on the historical version information to obtain a test result of the user interface image in the character dimension.
[0223] The second processing unit is configured to input the target data into a translation model for processing to obtain translation data corresponding to the target data for the translation dimension.
[0224] The output unit is configured to output a target image containing the translation data and the data content based on the data position, and determine the target image as a test result of the user interface image in the translation dimension; the size of the target image is the same as that of the user interface image.
[0225] In an embodiment of the present application, the target data comprises target version information; the target data is at least two, the character dimension comprises a content dimension, and the content dimension comprises a content quantity dimension and an actual content dimension; the second testing unit specifically comprises a first determining unit, a first comparing unit and a second comparing unit. Wherein:
[0226] The first determining unit is configured to determine a historical quantity of the target data under the historical version information.
[0227] The first comparison unit is configured to compare the history quantity with a quantity of target data under the target version information, to obtain a test result of the user interface image in the content quantity dimension.
[0228] The second comparison unit is configured to compare data content of all target data under the target version information with data content of all target data under the history version information, to obtain a test result of the user interface image in the actual content dimension.
[0229] In an embodiment of the present application, the data position includes a start point, an end point and a center point of the target data, the history position includes a history start point, a history end point and a history center point of the target data, the text dimension includes a position dimension, and the second test unit specifically includes a third comparison unit, a fourth comparison unit and a second determination unit. Wherein:
[0230] The third comparison unit is configured to compare the start point, the end point and the center point of the target data with the history start point, the history end point and the history center point respectively, to obtain a first result of the user interface image in the position dimension.
[0231] The fourth comparison unit is configured to compare a font size of the data content with a font size of the history content, to obtain a second result of the user interface image in the position dimension.
[0232] The second determination unit is configured to determine a test result of the user interface image in the position dimension based on the first result and the second result.
[0233] In an embodiment of the present application, the text dimension includes a font dimension, and the second test unit specifically includes a first clipping unit, a second clipping unit, a third processing unit, a first calculation unit and a third determination unit. Wherein:
[0234] The first clipping unit is configured to clip the user interface image based on the data position, to obtain a first image containing only the target data.
[0235] The second clipping unit is configured to clip a history interface image corresponding to the history version information based on the history position, to obtain a second image containing only the target data.
[0236] The third processing unit is configured to perform grayscale processing on the first image and the second image respectively, to obtain a third image corresponding to the first image and a fourth image corresponding to the second image.
[0237] The first calculation unit is configured to calculate a similarity between the third image and the fourth image, to obtain a first structural similarity index.
[0238] The third determining unit is configured to determine a test result of the user interface image in the font dimension based on the first structural similarity index.
[0239] In an embodiment of the present application, the character dimension comprises a color dimension, and the second test unit specifically comprises a third clipping unit, a fourth clipping unit, a fourth processing unit, a second calculating unit and a fourth determining unit. Wherein:
[0240] The third clipping unit is configured to clip the user interface image based on the data position to obtain a first image containing only the target data.
[0241] The fourth clipping unit is configured to clip a historical interface image corresponding to the historical version information based on the historical position to obtain a second image containing only the target data.
[0242] The fourth processing unit is configured to perform three-channel color separation processing on the first image and the second image respectively to obtain a first sub-image of the first image in different channel colors and a second sub-image of the second image in the different channel colors.
[0243] The second calculating unit is configured to calculate a similarity between the first sub-image and the second sub-image in any one channel color to obtain a second structural similarity index.
[0244] The fourth determining unit is configured to determine a test result of the user interface image in the color dimension based on the second structural similarity index in the different channel colors.
[0245] In an embodiment of the present application, the user interface test device 600 further comprises a marking unit.
[0246] The marking unit is configured to, for any one dimension, if the test result of the any one dimension is different from the target data in the historical version information, mark the target data based on the data position and output the user interface image after the marking processing.
[0247] It should be noted that the information interaction, execution process and the like between the above-mentioned devices / units, since based on the same concept as the method embodiments of the present application, the specific functions and the technical effects brought by them can be referred to the method embodiment part, and will not be repeated here.
[0248] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0249] Figure 10 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Figure 10 As shown, the terminal device 7 of this embodiment includes: at least one processor 70 ( Figure 10 (Only one is shown in the diagram), memory 71, and computer program 72 stored in said memory 71 and executable on said at least one processor 70, wherein said processor 70 executes said computer program 72 to implement the steps in any of the above-described user interface testing method embodiments.
[0250] The terminal device 7 may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will understand that... Figure 10 The example of terminal device 7 is merely an illustration and does not constitute a limitation on terminal device 7. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0251] The processor 70 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0252] The memory 71 can be an internal storage unit of the terminal device 7 in some embodiments, for example, a memory of the terminal device 7. The memory 71 can also be an external storage device of the terminal device 7 in other embodiments, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 7. Further, the memory 71 can include both the internal storage unit and the external storage device of the terminal device 7. The memory 71 is used to store an operating system, an application program, a boot loader, data, and other programs, etc., for example, program codes of the computer program, etc. The memory 71 can also be used to temporarily store data that has been output or will be output.
[0253] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps in the above-mentioned various method embodiments.
[0254] The embodiments of the present application provide a computer program product. When the computer program product is run on a terminal device, the terminal device is caused to implement the steps in the above-mentioned various method embodiments.
[0255] The integrated unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the embodiments of the present application can implement all or part of the processes in the above-mentioned method embodiments by a computer program to instruct related hardware to complete. The computer program can be stored in a computer readable storage medium. The computer program is executed by a processor to implement the steps in the above-mentioned various method embodiments. The computer program includes computer program codes. The computer program codes can be in the form of source codes, object codes, executable files or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program codes to the terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal and a software distribution medium. For example, a U disk, a mobile hard disk, a magnetic disk or an optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunications signal.
[0256] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in a certain embodiment can be referred to the relevant description of other embodiments.
[0257] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A user interface testing method characterized by, The method comprises: acquiring a user interface image to be tested; performing text recognition on the user interface image to obtain target data; the target data comprises data content and data position; the data position refers to the position of the target data in the user interface image; performing different-dimension testing on the target data based on the data content and the data position to obtain testing results of the user interface image in the different dimensions; the different dimensions comprise a text dimension and a translation dimension; the text dimension comprises a content dimension, a position dimension, a font dimension, and a color dimension; the different-dimension testing based on the data content and the data position to obtain the testing results of the user interface image in the different dimensions comprises: for the text dimension, acquiring historical version information corresponding to the target data; the historical version information comprises historical content and historical position of the target data; performing testing on the target data based on the historical version information to obtain the testing results of the user interface image in the text dimension; for the translation dimension, inputting the target data into a translation model for processing to obtain translation data corresponding to the target data; outputting a target image containing the translation data and the data content based on the data position, and determining the target image as the testing result of the user interface image in the translation dimension; the size of the target image is the same as that of the user interface image.
2. The user interface testing method of claim 1, wherein, the text recognition on the user interface image to obtain the target data comprises: naming the user interface image based on a naming rule to obtain an image file containing an image name; inputting the image file into a text recognition model for recognition to obtain initial data; the initial data comprises the image name, original content, data coordinates, and data confidence; if the data confidence is greater than or equal to a set confidence, processing the initial data based on a data processing rule to obtain the target data.
3. The user interface testing method of claim 1, wherein, the target data comprises target version information; the target data is at least two, the content dimension comprises a content quantity dimension and an actual content dimension; and the testing result of the user interface image in the content dimension is obtained in the following manner: determining the historical quantity of the target data under the historical version information; comparing the historical quantity with the quantity of the target data under the target version information to obtain the testing result of the user interface image in the content quantity dimension; comparing the data content of all target data under the target version information with the data content of all target data under the historical version information to obtain the testing result of the user interface image in the actual content dimension.
4. The user interface testing method of claim 1, wherein, the data position comprises a starting point, an ending point, and a center point of the target data, the historical position comprises a historical starting point, a historical ending point, and a historical center point of the target data, and the testing result of the user interface image in the position dimension is obtained in the following manner: comparing the start point, the end point and the center point of the target data with the historical start point, the historical end point and the historical center point respectively to obtain a first result of the user interface image in the position dimension; comparing the font size of the data content with the font size of the historical content to obtain a second result of the user interface image in the position dimension; determining a test result of the user interface image in the position dimension based on the first result and the second result.
5. The user interface testing method of claim 1, wherein, The test result of the user interface image in the font dimension is obtained in the following manner: performing cropping processing on the user interface image based on the data position to obtain a first image containing only the target data; performing cropping processing on the historical interface image corresponding to the historical version information based on the historical position to obtain a second image containing only the target data; performing grayscale processing on the first image and the second image respectively to obtain a third image corresponding to the first image and a fourth image corresponding to the second image; calculating the similarity between the third image and the fourth image to obtain a first structural similarity index; determining a test result of the user interface image in the font dimension based on the first structural similarity index.
6. The user interface testing method of claim 1, wherein, The test result of the user interface image in the color dimension is obtained in the following manner: performing cropping processing on the user interface image based on the data position to obtain a first image containing only the target data; performing cropping processing on the historical interface image corresponding to the historical version information based on the historical position to obtain a second image containing only the target data; performing three-channel color separation processing on the first image and the second image respectively to obtain a first sub-image of the first image in different channel colors and a second sub-image of the second image in the different channel colors; for any one channel color, calculating the similarity between the first sub-image and the second sub-image in the any one channel color to obtain a second structural similarity index; determining a test result of the user interface image in the color dimension based on the second structural similarity index in the different channel colors.
7. The user interface testing method of any one of claims 1-6, wherein, After the target data is tested in different dimensions based on the data content and the data position to obtain test results of the user interface image in the different dimensions, the method further includes: for any one dimension, if the test result of the any one dimension is different from the target data in the historical version information, performing marking processing on the target data based on the data position, and outputting the user interface image after the marking processing.
8. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the user interface test method of any one of claims 1-7.
9. A computer program product, characterised in that, The computer program is executed to implement the user interface test method of any one of claims 1-7.
Citation Information
Patent Citations
Interface testing method and device, equipment and storage medium
CN112882947A
Language test processing method and device and electronic equipment
CN113435217A