Multilingual interface consistency testing method, device, equipment and storage medium
Through automated testing methods, the problem of low efficiency of multilingual interface consistency testing is solved, efficient and accurate multilingual interface consistency testing is achieved, adapting to global needs and improving user experience.
Patent Information
- Application Number
- CN202510585953.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-05-08
AI Technical Summary
In the prior art, multilingual interface consistency testing is inefficient, and relying on manual operations leads to high costs and difficulty in ensuring consistency, especially in diversified operating systems and multilingual environments, it is difficult to meet global needs.
The automated testing method is adopted to achieve automated testing of multilingual interface consistency by obtaining test parameters, initializing the device interface, synchronizing the control operations, and using translation consistency thresholds and exception handling strategies.
It improves testing efficiency, reduces labor costs, ensures the accuracy and consistency of multilingual interfaces, improves user experience, and adapts to the software interface development needs of different locale environments.
Smart Images

Figure CN120123250B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for testing consistency of a multi-language interface. Background Art
[0002] With the deepening of globalization, the demand for multilingual communication and information access is growing, and the consistency of multilingual interfaces is becoming increasingly important. In the development of diverse software and applications, ensuring consistent information transmission between interfaces (user interfaces) in different languages has become particularly critical.
[0003] Currently, multilingual interface consistency testing is typically done manually, where different language versions of the interface are manually compared to ensure translation consistency and accuracy. However, this approach to multilingual interface consistency testing suffers from low testing efficiency. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, device, equipment and storage medium for testing the consistency of a multilingual interface to solve the problem of low testing efficiency in the current method of testing the consistency of a multilingual interface.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] A method for testing multilingual interface consistency comprises: obtaining test parameters in response to a test instruction for multilingual interface consistency, the test parameters including a test traversal strategy, a translation consistency threshold, and an exception handling strategy; initializing a reference device corresponding to a reference language and a plurality of comparison devices corresponding to a plurality of target languages to the same initial interface; based on the test traversal strategy, starting from the initial interface, for each of a plurality of control operations of the reference device, controlling each comparison device to synchronously execute the control operation; and after the reference device and the comparison device synchronously execute the control operation, obtaining a first data set and a first interface screenshot corresponding to a first interface displayed by the reference device, and obtaining a second data set and a second interface screenshot corresponding to a second interface displayed by the plurality of comparison devices; based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, comparing the first interface with each second interface for multilingual interface consistency to determine whether the second interface has an exception; and if an exception exists, performing exception handling on the second interface based on the exception handling strategy.
[0007] According to the above technical means, the reference device corresponding to the reference language and the multiple comparison devices corresponding to the multiple target languages are initialized to the same initial interface, which can ensure that all devices are in the same initial state before testing; based on the test traversal strategy, starting from the initial interface, for each control operation of the multiple control operations of the reference device, the reference device and each comparison device are controlled to synchronously execute the control operation, which can achieve synchronous traversal of the interface operations between multiple devices, ensuring the consistency of the operations of each device and the consistency of the device feedback during the test; based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, the first interface is compared with each second interface for multilingual interface consistency to determine whether the second interface has an anomaly; if there is an anomaly, the second interface is handled based on the anomaly handling strategy, thereby realizing automated testing of multilingual interface consistency. Compared with the current method of manually testing the consistency of multilingual interfaces, the present invention can greatly improve testing efficiency, reduce labor costs, and can accurately verify the text information of the interfaces of different language devices in parallel, improve test quality, thereby effectively improving the accuracy and consistency of the multilingual translation interface, and thus providing strong support for ensuring the user experience of the software interface in different language environments.
[0008] Furthermore, based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, the first interface is compared with each second interface for multilingual interface consistency to determine whether there is an abnormality in the second interface, including: based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, a page similarity comparison algorithm is used to determine whether the first interface and the second interface are in the same interface; if the first interface and the second interface are not in the same interface, it is determined that there is an abnormality in the second interface; if the first interface and the second interface are in the same interface, the first element containing text information in the first data set and the second element containing text information in the second data set are respectively obtained; the multilingual content consistency verification algorithm is used to compare the text content of the first element and the second element to determine whether there is an abnormality in the second element; if there is an abnormality in the second element, it is determined that there is an abnormality in the second interface.
[0009] Furthermore, the translation consistency threshold includes a text content similarity threshold and an image similarity threshold. Based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, a page similarity comparison algorithm is used to determine whether the first interface and the second interface are in the same interface, including: using an element comparison method to compare the first data set with each second data set respectively to obtain the text content similarity between the first data set and each second data set; using an image comparison method to compare the first interface screenshot with each second interface screenshot respectively to obtain the image similarity between the first interface screenshot and each second interface screenshot; if the text content similarity is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, it is determined that the first interface and the second interface are in the same interface; if the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, it is determined that the first interface and the second interface are not in the same interface.
[0010] Furthermore, the first interface and the second interface are not in the same interface, and the second interface is handled exceptionally based on the exception handling strategy, including: if the second interface does not contain an exception prompt and does not contain a pop-up window, then for the target comparison device corresponding to the target second interface that is not in the same interface as the first interface, the operation path playback method is used to make the target comparison device replay the operation path of the reference device; if the playback fails, it is determined whether the target comparison device has failed to replay for the first time, if not, the target comparison device is deleted from the current test task; if so, the target comparison device is initialized, and the operation path playback method is re-used to make the target comparison device replay the operation path of the reference device, if the playback fails, the target comparison device is deleted from the current test task; if the second interface contains an exception prompt or a pop-up window, a screenshot of the second interface containing the exception prompt or pop-up window is taken and compared with the preview Suppose that images in the image library are matched. If the target image is matched, the exception prompt or pop-up window is closed according to the target image, so that the second interface is in the same interface as the first interface; if the target image is not matched, or the exception prompt or pop-up window cannot be closed according to the target image, the element identifier of the second element corresponding to the exception prompt or pop-up window in the second data set is matched with the preset closing element identifier. If the match is successful, the exception prompt or pop-up window is closed according to the matched second element. If the match fails, or the exception prompt or pop-up window cannot be closed according to the matched second element, or the second interface is still not in the same interface as the first interface after closing the exception prompt or pop-up window, the comparison device corresponding to the second interface containing the exception prompt or pop-up window is initialized, and the operation path playback method is used to play back the operation path of the reference device, so that the second interface is in the same interface as the first interface.
[0011] Furthermore, a multilingual content consistency verification algorithm is used to compare the text contents of the first element and the second element to determine whether there is an abnormality in the second element, including: obtaining a second element with the same absolute path as the first element; for each group of first elements and second elements with the same absolute path, according to the first text content of the first element and the target language corresponding to the second element, obtaining target text content corresponding to the first text content and in the target language corresponding to the second element from a multilingual corpus; if the target text content is the same as the second text content of the second element, and the first coordinate area of the first element is the same as the second coordinate area of the second element, then determining that there is no abnormality in the second element; if the target text content is different from the second text content, or the first coordinate area is different from the second coordinate area, then determining that there is an abnormality in the second element.
[0012] Furthermore, if there is an abnormality in the second element, the second interface is handled abnormally based on the exception handling strategy, including: horizontally splicing the first interface screenshot and the second interface screenshot to obtain a spliced image; marking the abnormal second element in the spliced image to obtain a marked image; and writing the marked image into the test report in the form of test steps.
[0013] Furthermore, for each of the multiple control operations of the reference device, each comparison device is controlled to synchronously execute the control operation, including: for each of the multiple control operations of the reference device, if the control operation corresponds to a multi-level operation path, the reference device and the comparison device are controlled to synchronously perform a deep traversal of the multi-level operation path until all the control operations corresponding to the multi-level operation path are executed.
[0014] Furthermore, before responding to the test instruction for multi-language interface consistency, the multi-language interface consistency testing method also includes: in response to the configuration operation for the reference device and the reference language, obtaining and storing the reference device and the reference language; in response to the configuration operation for the comparison device and the target language corresponding to the comparison device, obtaining and storing the comparison device and the target language corresponding to the comparison device; in response to the configuration operation for the test parameters, obtaining and storing the test parameters.
[0015] Furthermore, the multi-language interface consistency testing method further includes: outputting a test report according to a preset time interval or operation path level cycle.
[0016] A device for testing multilingual interface consistency comprises: an acquisition module for acquiring test parameters in response to a test instruction for multilingual interface consistency, the test parameters including a test traversal strategy, a translation consistency threshold, and an exception handling strategy; an initialization module for initializing a reference device corresponding to a reference language and a plurality of comparison devices corresponding to a plurality of target languages to the same initial interface; a first processing module for controlling each comparison device to synchronously execute a control operation for each of a plurality of control operations on the reference device based on the test traversal strategy, starting from the initial interface, and after the reference device and the comparison device synchronously execute the control operation, acquiring a first data set and a first interface screenshot corresponding to a first interface displayed by the reference device, and acquiring a second data set and a second interface screenshot corresponding to a second interface displayed by the plurality of comparison devices; a determination module for comparing the first interface with each second interface for multilingual interface consistency based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, to determine whether any second interface has an anomaly; and a second processing module for performing exception handling on the second interface based on the anomaly handling strategy if any.
[0017] Furthermore, the determination module is specifically used to: based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, use a page similarity comparison algorithm to determine whether the first interface and the second interface are in the same interface; if the first interface and the second interface are not in the same interface, determine that there is an abnormality in the second interface; if the first interface and the second interface are in the same interface, respectively obtain the first element containing text information in the first data set and the second element containing text information in the second data set; use a multilingual content consistency verification algorithm to compare the text content of the first element and the second element to determine whether there is an abnormality in the second element; if there is an abnormality in the second element, determine that there is an abnormality in the second interface.
[0018] Furthermore, the translation consistency threshold includes a text content similarity threshold and an image similarity threshold. When the determination module is used to determine whether the first interface and the second interface are in the same interface based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, and using a page similarity comparison algorithm, it is specifically used to: use an element comparison method to compare the first data set with each second data set respectively to obtain the text content similarity between the first data set and each second data set; use an image comparison method to compare the first interface screenshot with each second interface screenshot respectively to obtain the image similarity between the first interface screenshot and each second interface screenshot; if the text content similarity is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, then it is determined that the first interface and the second interface are in the same interface; if the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, then it is determined that the first interface and the second interface are not in the same interface.
[0019] Furthermore, the first interface and the second interface are not in the same interface, and the second processing module is specifically used to: if the second interface does not contain an abnormal prompt and does not contain a pop-up window, then for the target comparison device corresponding to the target second interface that is not in the same interface as the first interface, use the operation path playback method to make the target comparison device replay the operation path of the reference device; if the playback fails, determine whether the target comparison device has failed to replay for the first time, if not, delete the target comparison device from the current test task; if so, initialize the target comparison device, and re-use the operation path playback method to make the target comparison device replay the operation path of the reference device, if the playback fails, delete the target comparison device from the current test task; if the second interface contains an abnormal prompt or a pop-up window, then compare the screenshot of the second interface containing the abnormal prompt or pop-up window with the preset image library The image is matched. If the target image is matched, the abnormal prompt or pop-up window is closed according to the target image, so that the second interface is in the same interface as the first interface; if the target image is not matched, or the abnormal prompt or pop-up window cannot be closed according to the target image, the element identifier of the second element corresponding to the abnormal prompt or pop-up window in the second data set is matched with the preset closing element identifier. If the match is successful, the abnormal prompt or pop-up window is closed according to the matched second element. If the match fails, or the abnormal prompt or pop-up window cannot be closed according to the matched second element, or the second interface is still not in the same interface as the first interface after closing the abnormal prompt or pop-up window, the comparison device corresponding to the second interface containing the abnormal prompt or pop-up window is initialized, and the operation path playback method is used to play back the operation path of the reference device, so that the second interface is in the same interface as the first interface.
[0020] Furthermore, when the determination module is used to compare the text content of the first element and the second element using a multilingual content consistency verification algorithm to determine whether there is an abnormality in the second element, it is specifically used to: obtain a second element with the same absolute path as the first element; for each group of first elements and second elements with the same absolute path, according to the first text content of the first element and the target language corresponding to the second element, obtain target text content corresponding to the first text content and in the target language corresponding to the second element from the multilingual corpus; if the target text content is the same as the second text content of the second element, and the first coordinate area of the first element is the same as the second coordinate area of the second element, then determine that there is no abnormality in the second element; if the target text content is different from the second text content, or the first coordinate area is different from the second coordinate area, then determine that there is an abnormality in the second element.
[0021] Furthermore, if there is an abnormality in the second element, the second processing module is specifically used to: perform horizontal splicing processing on the first interface screenshot and the second interface screenshot to obtain a spliced image; mark the abnormal second element in the spliced image to obtain a marked image; and write the marked image into the test report in the form of test steps.
[0022] Furthermore, when the first processing module is used to control each comparison device to synchronously execute the control operation for each control operation among multiple control operations of the reference device, it is specifically used to: for each control operation among multiple control operations of the reference device, if the control operation corresponds to a multi-level operation path, control the reference device and the comparison device to synchronously execute a deep traversal of the multi-level operation path until all control operations corresponding to the multi-level operation path are executed.
[0023] Furthermore, the acquisition module is also used to: before responding to a test instruction for multilingual interface consistency, in response to a configuration operation for a reference device and a reference language, acquire and store a reference device and a reference language; in response to a configuration operation for a comparison device and a target language corresponding to the comparison device, acquire and store a comparison device and a target language corresponding to the comparison device; in response to a configuration operation for test parameters, acquire and store test parameters.
[0024] Furthermore, the second processing module is further configured to output a test report according to a preset time interval or operation path level cycle.
[0025] An electronic device includes: a processor and a memory in communication with the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the multi-language interface consistency testing method as described above in the present invention.
[0026] A computer-readable storage medium stores computer program instructions. When the computer program instructions are executed, the multi-language interface consistency testing method of the present invention is implemented.
[0027] A computer program product includes a computer program. When the computer program is executed, the multi-language interface consistency testing method of the present invention is implemented.
[0028] Beneficial effects of the present invention: The multi-language interface consistency testing method, apparatus, device and storage medium provided by the present invention obtain test parameters by responding to test instructions for multi-language interface consistency, and the test parameters include a test traversal strategy, a translation consistency threshold and an exception handling strategy; the reference device corresponding to the reference language and the multiple comparison devices corresponding to the multiple target languages are initialized to the same initial interface, which can ensure that all devices are in the same initial state before testing; based on the test traversal strategy, starting from the initial interface, for each control operation in the multiple control operations of the reference device, each comparison device is controlled to synchronously execute the control operation, thereby realizing the synchronous traversal of the interface operations between multiple devices , ensure the consistency of the operation of each device and the consistency of the device feedback during the test, after the reference device and the comparison device synchronously execute the control operation, obtain the first data set and the first interface screenshot corresponding to the first interface displayed by the reference device, and obtain the second data set and the second interface screenshot corresponding to the second interface displayed by multiple comparison devices; based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, compare the first interface with each second interface for multi-language interface consistency to determine whether there is an abnormality in the second interface; if there is an abnormality, the second interface is handled based on the exception handling strategy to achieve automated testing of multi-language interface consistency. Compared with the current method of manually testing the consistency of multi-language interfaces, the present invention can greatly improve test efficiency, reduce labor costs, and can accurately verify the text information of the interfaces of devices in different languages in parallel, improve test quality, thereby effectively improving the accuracy and consistency of the multi-language translation interface, and thus providing strong support for ensuring the user experience of the software interface in different language environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0030] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present invention;
[0031] Figure 2 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 1 ;
[0032] Figure 3 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 2 ;
[0033] Figure 4 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 3 ;
[0034] Figure 5 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 4 ;
[0035] Figure 6 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 5 ;
[0036] Figure 7 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 6 ;
[0037] Figure 8 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 7 ;
[0038] Figure 9 A schematic diagram of the structure of a multi-language interface consistency testing device provided by an embodiment of the present invention;
[0039] Figure 10 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following describes the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art will readily appreciate the other advantages and benefits of the present invention from the disclosure herein. The present invention may also be implemented or applied through various other specific embodiments, and the various details in this specification may be modified or altered based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are intended only to illustrate the present invention and are not intended to limit the scope of protection of the present invention.
[0041] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.
[0042] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and corresponding operation entrances must be provided for users to choose to authorize or refuse.
[0043] With the deepening of globalization, the demand for multilingual communication and information access is growing, and the consistency of multilingual interfaces is becoming increasingly important. In the development of diverse software and applications, ensuring consistent information transmission across different language versions of interfaces (user interfaces) is crucial. However, traditional translation and proofreading processes are not only time-consuming and costly, requiring personnel proficient in each language, but also difficult to ensure translation consistency due to their reliance on manual labor.
[0044] At present, the consistency of multilingual interfaces is usually tested manually, that is, manually comparing interfaces of different language versions to ensure the consistency and accuracy of translation. However, the above method is inefficient and prone to errors when testing the consistency of multilingual interfaces. In addition, with the diversification of operating systems, it has become more difficult to maintain the consistency of interfaces on device operating systems. For example, the consistency test of multilingual interfaces for in-vehicle mobile systems has the following difficulties: (1) The importance of content accuracy: The language content of the user interface directly affects the user experience. Any translation error may be immediately recognized by the user, affecting user satisfaction and may mislead the operation, and the normal use of key functions may also be hindered. (2) Limitations of manual verification: Faced with the huge language content of in-vehicle mobile systems, manual verification is extremely inefficient. Currently, it mainly relies on data association and limited manual portability testing during the development process to ensure quality. However, the above method lacks systematicity and comprehensiveness and is prone to missing key issues. (3) Professional language requirements: When manually performing multilingual translation verification, testers who are proficient in other countries' languages are required. The large number of languages will lead to high labor costs. Introducing automated technology to compare character content can greatly reduce labor costs. (4) Complexity of translation correctness: Faced with the diversity of operating systems, cross-language interface consistency verification becomes complex, especially considering the unique exception prompts and pop-up mechanisms of different systems. This requires the development of more sophisticated verification methods to ensure that multilingual interfaces maintain consistency in display content. (5) The need for multilingual concurrent testing: The significant increase in the number of languages in the process of globalization has greatly increased the scale and complexity of system-level language consistency testing. There is an urgent need to improve the efficiency and coverage of testing. However, existing technologies have not yet provided a fully effective solution to meet this urgent need.
[0045] Based on the above problems, the present invention provides a testing method for multilingual interface consistency. By utilizing advanced algorithms and automation technologies, the method can effectively compare and verify interfaces on multiple devices corresponding to different languages in parallel, ensuring the consistency of functions and information transmission of interfaces in different language versions. This method can significantly improve the testing efficiency and accuracy of multilingual interface consistency, reduce labor costs, solve the problems of low efficiency of manual testing and the need for concurrent testing of multiple languages, and provide strong support for quickly identifying and resolving inconsistencies in multilingual translation, thereby better meeting the needs of multilingual interface development in the context of globalization.
[0046] In addition, at present, due to the large amount of translation verification content involved and the high cost, the testing of multilingual interface consistency has not yet formed a standardized process in the industry, and is usually only informally verified as part of functional testing. The proposal of this invention can not only fill this gap, but also provide strong support for ensuring the user experience of the software interface in different language environments.
[0047] Hereinafter, the application scenarios of the solution provided by the present invention are first described with examples.
[0048] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present invention. Figure 1 As shown, in this application scenario, the user (such as a tester) configures a reference device, a reference language corresponding to the reference device, and multiple comparison devices ( Figure 1 ), the target language corresponding to each comparison device, and the test parameters corresponding to the current test task, and trigger the test instructions for the consistency of the multi-language interface. Accordingly, the server 102 responds to the test instructions for the consistency of the multi-language interface, and according to the test method for the consistency of the multi-language interface provided by the embodiment of the present invention, synchronously and parallelly compares the consistency of the interface displayed by each comparison device with the interface displayed by the reference device, and implements the test of the consistency of the multi-language interface to ensure the consistency of the functions and information transmission of the interfaces of different language versions. It should be noted that Figure 1 This is only a schematic diagram of an application scenario provided by an embodiment of the present invention. Figure 1 The equipment included in the Figure 1 The positional relationship between the devices is limited.
[0049] The multi-language interface consistency testing method provided in the embodiment of the present invention can be applied to the multi-language interface consistency testing of a vehicle-mounted mobile system, or can be applied to the multi-language interface consistency testing of a mobile terminal (such as a mobile phone), and can also be applied to other devices that require multi-language interface consistency testing.
[0050] The technical solution of the present invention is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0051] Figure 2 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 1The multi-language interface consistency testing method can be executed by software and / or hardware devices. For example, the hardware device can be a multi-language interface consistency testing device, and the multi-language interface consistency testing device can be an electronic device or a processing chip in the electronic device. Figure 2 As shown, the method of the embodiment of the present invention includes:
[0052] S201 : In response to a test instruction for multi-language interface consistency, obtain test parameters, where the test parameters include a test traversal strategy, a translation consistency threshold, and an exception handling strategy.
[0053] For example, a test instruction for multilingual interface consistency may be input by a user (e.g., a tester) to an electronic device executing an embodiment of the present method, or may be sent by another device to the electronic device executing an embodiment of the present method. Accordingly, the electronic device executing an embodiment of the present method obtains test parameters in response to the test instruction for multilingual interface consistency.
[0054] Optionally, before responding to a test instruction for multi-language interface consistency, the multi-language interface consistency testing method provided by an embodiment of the present invention may further include: in response to a configuration operation for a reference device and a reference language, acquiring and storing the reference device and the reference language; in response to a configuration operation for a comparison device and a target language corresponding to the comparison device, acquiring and storing the comparison device and the target language corresponding to the comparison device; in response to a configuration operation for test parameters, acquiring and storing test parameters.
[0055] For example, this embodiment of the present invention pre-builds a user-friendly front-end interface to facilitate the configuration and management of multi-device simultaneous translation conformance testing. For example, this embodiment utilizes PYQt (a toolkit for the Python programming language) as a front-end technology, combined with socket communication and a MySQL database, to provide intuitive operation and efficient monitoring and management of the multi-device simultaneous translation conformance testing process. The system corresponding to the front-end interface automatically detects and lists all connected devices, including a reference device and multiple comparison devices. Users can select participating devices from the device list displayed on the front-end interface and configure the corresponding test parameters.
[0056] Specifically, the user can select a reference device and its corresponding reference language. The interface displayed on the reference device serves as a reference standard for comparison with the interface displayed on the comparison device to determine if there are any anomalies in the interface displayed on the comparison device. For example, the reference language is Chinese. The user can select multiple comparison devices and set or confirm the language version for each comparison device, so that each device displays a different language version to ensure that the test covers the required language range. For example, the user can select three comparison devices, each corresponding to the target languages of Russian, Arabic, and Thai. The user can configure the test parameters corresponding to the current test task through the front-end interface. These parameters include, but are not limited to, the test traversal strategy, the translation consistency threshold, and the exception handling strategy. The test traversal strategy specifies how the reference device and multiple comparison devices synchronously traverse and execute control operations, for example, from the parent page (parent interface) corresponding to the operation path to the lowest-level child page (child interface). The translation consistency threshold is used to determine the translation consistency. For details, please refer to the subsequent embodiments. The exception handling strategy is used to handle any anomalies in the interface displayed by the comparison device. After configuring the test parameters, the user can trigger a test command for the consistency of the multilingual interface.
[0057] S202: Initialize a reference device corresponding to the reference language and a plurality of comparison devices corresponding to the plurality of target languages to the same initial interface.
[0058] In this step, to ensure that all comparison devices operate and display on the same interface as the reference device, the reference device corresponding to the reference language and multiple comparison devices corresponding to the target languages can be initialized to the same initial interface. For example, the reference device and multiple comparison devices can be restored to their factory state and configured with the same hardware and software environment. This ensures that all devices are in the same initial state before testing, thus ensuring a standardized starting point for testing.
[0059] S203. Based on the test traversal strategy, starting from the initial interface, for each control operation among the multiple control operations of the reference device, control each comparison device to synchronously execute the control operation, and after the reference device and the comparison device synchronously execute the control operation, obtain a first data set and a first interface screenshot corresponding to the first interface displayed by the reference device, and obtain a second data set and a second interface screenshot corresponding to the second interfaces displayed by multiple comparison devices respectively.
[0060] It is understood that, based on the test traversal strategy, the reference device can be controlled to execute each control operation starting from the initial interface, traversing through each control operation to display the interface corresponding to each control operation. In this step, for example, based on the test traversal strategy, starting from the initial interface, each control operation among the reference device's multiple control operations can be controlled to be executed synchronously on each comparison device to ensure that all comparison devices operate and display on the same interface as the reference device. Accordingly, each time the reference device and the multiple comparison devices synchronously execute the same control operation, a first dataset and a screenshot of the first interface corresponding to the reference device's display can be obtained, and a second dataset and a screenshot of the second interface corresponding to the multiple comparison devices' display can be obtained for subsequent consistency analysis and comparison. Data such as log files can also be obtained. The first dataset can, for example, be composed of Extensible Markup Language (XML) data extracted from the first interface, and the second dataset can, for example, be composed of XML data extracted from the second interface. For example, the screenshots of the first and second interfaces can be captured using the adb tool (an Android command-line tool).
[0061] Optionally, for each control operation among the multiple control operations of the reference device, controlling each comparison device to synchronously execute the control operation may include: for each control operation among the multiple control operations of the reference device, if the control operation corresponds to a multi-level operation path, controlling the reference device and the comparison device to synchronously execute a deep traversal of the multi-level operation path until all control operations corresponding to the multi-level operation path are executed.
[0062] This embodiment can be understood as realizing the synchronous traversal of interface operations between all comparison devices and reference devices through a synchronous traversal operation algorithm, ensuring that all comparison devices and reference devices execute the same control operation at the same time, so as to ensure the consistency of the operation of each device and the consistency of the device feedback during the test. For example, the control operation on the reference device is accurately copied to all comparison devices to achieve synchronization of operations; after executing the control operation, the changes in the interface elements are monitored. If a new element is detected, the new interface is switched to, and the deep traversal is continued on the new interface until the operation path is explored, and then the traversal of other controls is continued back to the previous level. After each control operation is executed, the new interface displayed by the reference device and each comparison device can be automatically compared to ensure consistency between the interfaces.
[0063] S204: Based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, the first interface is compared with each second interface for multilingual interface consistency to determine whether there is an anomaly in the second interface.
[0064] Exemplarily, the translation consistency threshold includes, for example, a text content similarity threshold and an image similarity threshold. Based on the text content similarity threshold, the first data set and the second data set, it can be determined whether the text content of the first data set is similar to that of each second data set, and based on the image similarity threshold, the first interface screenshot and the second interface screenshot, it can be determined whether the first interface screenshot is similar to each second interface screenshot, thereby determining whether the first interface and the second interface are in the same interface. If the first interface and the second interface are in the same interface, the text content of the first element containing text information in the first data set and the second element containing text information in the second data set are continued to be compared to determine whether the second element has an anomaly, and then it can be determined whether the second interface has an anomaly. For specific information on how to determine whether the second interface has an anomaly, please refer to the subsequent embodiments, which will not be repeated here.
[0065] S205: If an exception exists, perform exception handling on the second interface based on the exception handling strategy.
[0066] In this step, after determining that there is an abnormality in the second interface, that is, after detecting that there is an inconsistency between the interface display or operation response of the comparison device and the reference device, the second interface can be promptly handled based on the exception handling strategy to ensure the continuity and accuracy of the test. Among them, the exception handling strategy, such as reloading the interface, or rolling back the operation, or marking the operation, can significantly improve the ability to handle abnormal situations during the test, and ensure that the test data can present error information in a clear and efficient manner, thereby providing strong support for quickly identifying and resolving inconsistencies in multilingual translation. It can be understood that if there is no abnormality in the second interface, it means that the second interface displayed by multiple comparison devices is correct. Optionally, the test report can be output according to a preset time interval or operation path level cycle, so that the user can make necessary adjustments based on the feedback in the test report to optimize the translation quality and test process.
[0067] A method for testing multilingual interface consistency provided by an embodiment of the present invention obtains test parameters in response to a test instruction for multilingual interface consistency, the test parameters including a test traversal strategy, a translation consistency threshold, and an exception handling strategy. A reference device corresponding to a reference language and multiple comparison devices corresponding to multiple target languages are initialized to the same initial interface, ensuring that all devices are in the same initial state before testing. Based on the test traversal strategy, starting from the initial interface, for each of multiple control operations on the reference device, each comparison device is controlled to synchronously execute the control operation, thereby achieving synchronous traversal of interface operations across multiple devices and ensuring consistency of device operations and device feedback during the test. After the reference device and the comparison device synchronously execute the control operation, a first data set and a first interface screenshot corresponding to a first interface displayed by the reference device are obtained, as well as second data sets and second interface screenshots corresponding to second interfaces displayed by the multiple comparison devices. Based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, the first interface is compared with each second interface for multilingual interface consistency to determine whether there is an anomaly in the second interface. If an anomaly is present, the second interface is handled based on the exception handling strategy, thereby achieving automated testing of multilingual interface consistency. Compared with the current method of manually testing the consistency of multilingual interfaces, the embodiments of the present invention can greatly improve testing efficiency, reduce labor costs, and can accurately verify the text information of the interfaces of devices in different languages in parallel, thereby improving test quality, thereby effectively improving the accuracy and consistency of multilingual translation interfaces, and providing strong support for ensuring the user experience of software interfaces in different language environments.
[0068] Based on the above embodiments, Figure 3 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 2 Based on the above embodiment, the present invention further describes the method for testing the consistency of a multi-language interface. Figure 3 As shown, the method of the embodiment of the present invention may include:
[0069] S301, in response to the test instruction for the consistency of the multi-language interface, obtain the test parameters, which include the test traversal strategy, translation consistency threshold and exception handling strategy. Figure 2 The relevant description of S201 in the illustrated embodiment will not be repeated here.
[0070] S302: Initialize the reference device corresponding to the reference language and the multiple comparison devices corresponding to the multiple target languages to the same initial interface. Figure 2 The relevant description of S202 in the illustrated embodiment will not be repeated here.
[0071] S303, based on the test traversal strategy, starting from the initial interface, for each control operation in the multiple control operations of the reference device, control each comparison device to synchronously execute the control operation, and after the reference device and the comparison device synchronously execute the control operation, obtain the first data set and the first interface screenshot corresponding to the first interface displayed by the reference device, and obtain the second data set and the second interface screenshot corresponding to the second interface displayed by the multiple comparison devices respectively. The detailed description of this step can be found in Figure 2 The relevant description of S203 in the illustrated embodiment will not be repeated here.
[0072] In the embodiment of the present invention, Figure 2 Step S204 may further include the following three steps S304 to S306:
[0073] S304: Based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, a page similarity comparison algorithm is used to determine whether the first interface and the second interface are in the same interface.
[0074] It can be understood that the page similarity comparison algorithm is used to obtain and compare the visual and textual similarities between different device interfaces to detect the consistency of translation and layout, ensure whether each device is in the same interface, and provide technical support for multi-device synchronous translation consistency testing. Exemplarily, the translation consistency threshold includes, for example, a text content similarity threshold and an image similarity threshold. Based on the text content similarity threshold, the image similarity threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, a page similarity comparison algorithm can be used to determine whether the first interface and the second interface are in the same interface. For specific information on how to use the page similarity comparison algorithm to determine whether the first interface and the second interface are in the same interface, please refer to the subsequent embodiments and will not be repeated here.
[0075] S305: If the first interface and the second interface are not in the same interface, it is determined that an abnormality exists in the second interface.
[0076] In this step, after using the page similarity comparison algorithm to determine that the first interface and the second interface are not in the same interface, for example, the first interface is a music interface and the second interface is a video interface, it can be determined that there is an abnormality in the second interface.
[0077] S306. If the first interface and the second interface are in the same interface, obtain a first element containing text information in the first data set and a second element containing text information in the second data set respectively; use a multilingual content consistency verification algorithm to compare the text content of the first element and the second element to determine whether there is an abnormality in the second element; if there is an abnormality in the second element, determine that there is an abnormality in the second interface.
[0078] It can be understood that when it is determined that the first interface and the second interface are in the same interface, the first element containing text information in the first data set and the second element containing text information in the second data set can be continued to be compared to determine whether there is an abnormality in the second element. The multilingual content consistency verification algorithm is used to ensure the content consistency of interfaces in different language versions. Exemplarily, a multilingual content consistency verification algorithm can be used to compare the text content of the first element and the second element to determine whether there is an abnormality in the second element. For specific information on how to determine whether the second element is abnormal, please refer to the subsequent embodiments, which will not be repeated here. In the case that there is an abnormality in the second element, it can be determined that there is an abnormality in the second interface. It should be noted that the embodiment of the present invention does not limit the order in which steps S305 and S306 are executed.
[0079] S307, if there is an exception, then the second interface is handled based on the exception handling strategy. The detailed description of this step can be found in Figure 2 The relevant description of S205 in the illustrated embodiment will not be repeated here.
[0080] S308: Output a test report according to a preset time interval or operation path level cycle.
[0081] For example, a preset time interval, such as one hour, and an operation path-level period, such as the completion of the current operation path test, can generate a test report based on the preset time interval or operation path-level period to facilitate tracking and review of the testing process. Optionally, after generating a detailed test report, the test results can be presented visually (such as charts or color coding). Users can export the test report and make necessary adjustments based on the feedback provided to optimize translation quality and the testing process. Optionally, logging and data management features can also be provided, allowing users to view historical test results, manage test data, and conduct in-depth analysis.
[0082] The method for testing the consistency of a multi-language interface provided by an embodiment of the present invention obtains test parameters in response to a test instruction for the consistency of a multi-language interface. The test parameters include a test traversal strategy, a translation consistency threshold, and an exception handling strategy. The reference device corresponding to the reference language and the multiple comparison devices corresponding to the multiple target languages are initialized to the same initial interface, which can ensure that all devices are in the same initial state before the test; based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, a page similarity comparison algorithm is used to determine whether the first interface and the second interface are in the same interface. If the first interface and the second interface are not in the same interface, it is determined that there is an abnormality in the second interface; if the first interface and the second interface are in the same interface, the first interface containing text information in the first data set is respectively obtained. an element and a second element containing text information in a second data set; a multilingual content consistency verification algorithm is used to compare the text content of the first element and the second element to determine whether there is an abnormality in the second element; if there is an abnormality in the second element, it is determined that there is an abnormality in the second interface, and it can accurately determine whether there is an abnormality in the second interface; if there is an abnormality in the second interface, the second interface is handled based on the exception handling strategy; according to the preset time interval or operation path level cycle, a test report is output to realize full-link automation from test operation to result output, which can greatly improve test efficiency and test quality, reduce labor costs, and provide users with an efficient, accurate and user-friendly multi-device synchronous translation consistency testing solution, which can provide strong support for ensuring the user experience of the software interface in different language environments.
[0083] Figure 4 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 3 Based on the above embodiment, the embodiment of the present invention further explains step S304 in the above embodiment, wherein the translation consistency threshold includes a text content similarity threshold and an image similarity threshold. Figure 4 As shown, the method of the embodiment of the present invention may include:
[0084] S401 : Using an element comparison method, the first data set is compared with each second data set to obtain text content similarity between the first data set and each second data set.
[0085] For example, the first data set is a data set consisting of XML data extracted from the first interface, and the second data set is a data set consisting of XML data extracted from the second interface. An element comparison method can be used to perform a detailed comparison of the element information in the first interface displayed by the reference device with the element information in the second interfaces displayed by multiple comparison devices to verify the consistency of the interfaces. Specifically, a detailed comparison of the interface elements can be performed by analyzing the element attributes of each element in the first data set and each second data set, so as to obtain the text content similarity between the first data set and each second data set, wherein the element attributes include, for example, the absolute path, index, text, element identifier, class and application to which the element belongs, etc.
[0086] S402: Using an image comparison method, the first interface screenshot is compared with each second interface screenshot to obtain image similarity between the first interface screenshot and each second interface screenshot.
[0087] For example, the first interface screenshot and the second interface screenshot can be captured through the adb tool, and image processing can be performed to remove the difference in the text area between the first interface screenshot and the second interface screenshot, so as to eliminate the influence of the display difference between different languages and better evaluate the consistency of the interface layout and image. Image processing technology is used, such as the matchTemplate method (a template matching method used to search and find the position of the template image in the image) in the OpenCV library (a computer vision and machine learning software library) to compare the similarity of the remaining image area in the first interface screenshot and each second interface screenshot, so as to obtain the image similarity between the first interface screenshot and each second interface screenshot. It should be noted that the embodiment of the present invention does not limit the order in which steps S401 and S402 are executed.
[0088] S403: If the text content similarity is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, determine that the first interface and the second interface are in the same interface.
[0089] For example, a text content similarity threshold of 90% is used as a criterion for determining whether the text content is highly consistent; an image similarity threshold of 95% is used as a criterion for determining whether the image content is highly consistent. Each text content similarity can be compared with the text content similarity threshold, and each image similarity can be compared with the image similarity threshold. If the text content similarity corresponding to the comparison device is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, then the consistency check has passed, and it is determined that the first interface and the second interface are the same interface.
[0090] S404: If the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, determine that the first interface and the second interface are not in the same interface.
[0091] Exemplarily, if the text content similarity corresponding to the comparison device is less than or equal to the text content similarity threshold, or the image similarity corresponding to the comparison device is less than or equal to the image similarity threshold, it can be determined that the first interface and the second interface are not in the same interface, thereby determining that there is an abnormality in the second interface, and then the second interface can be handled abnormally based on the exception handling strategy. For example, based on the exception handling strategy, you can try to restore the second interface of the abnormal comparison device to the normal display interface to improve the robustness of the overall test and enable the test to proceed smoothly. For how to handle the second interface based on the exception handling strategy when the first interface and the second interface are not in the same interface, please refer to the subsequent embodiments, which will not be repeated here. It should be noted that the embodiment of the present invention does not limit the order in which steps S403 and S404 are executed.
[0092] The multilingual interface consistency testing method provided by the embodiment of the present invention can accurately obtain text content similarity by using an element comparison method; can accurately obtain image similarity by using an image comparison method; if the text content similarity is greater than a text content similarity threshold, and the image similarity is greater than an image similarity threshold, it is determined that the first interface and the second interface are in the same interface; if the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, it is determined that the first interface and the second interface are not in the same interface, thereby accurately determining whether the first interface and the second interface are not in the same interface.
[0093] Figure 5 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 4 Based on the above embodiment, the embodiment of the present invention further explains step S205 in the above embodiment for the case where the first interface and the second interface are not in the same interface, and the second interface does not include an abnormal prompt and a pop-up window. Figure 5 As shown, the method of the embodiment of the present invention may include:
[0094] S501: For a target comparison device corresponding to a target second interface that is not in the same interface as the first interface, an operation path playback method is used to enable the target comparison device to playback the operation path of the reference device.
[0095] In this step, for example, the target device can replay the reference device's operation path by pressing the HOME key, launching an activity, or performing a specific operation (such as returning to the previous screen). This allows the target device to replay the reference device's operation path, thereby retracing the reference device's operation path. If the replay is successful, the current test task continues; if the replay fails, step S502 is executed.
[0096] S502: If the playback fails, determine whether the target comparison device has failed to play back the video for the first time.
[0097] In this step, it can be determined whether the target comparison device fails to replay for the first time. If the target comparison device does not fail to replay for the first time, step S503 is executed; if the target comparison device fails to replay for the first time, steps S504 and S505 are executed.
[0098] S503: If the target comparison device does not fail in the initial playback, the target comparison device is deleted from the current test task.
[0099] In this step, since the target comparison device did not fail the initial playback, that is, the abnormal interface of the target comparison device could not be processed based on the exception handling strategy, the target comparison device was identified as a problem device, and the target comparison device was deleted from the current test task. The problem can be recorded and feedback can be provided.
[0100] S504: If the target comparison device fails in the initial playback, the target comparison device is initialized, and the operation path playback method is re-adopted to enable the target comparison device to play back the operation path of the reference device.
[0101] For example, for a target comparison device that fails in initial playback, the target comparison device can be initialized (for example, a restart operation can be performed on the target comparison device), and the operation path playback method can be re-adopted to enable the target comparison device to play back the operation path of the reference device, that is, to try again to execute the operation path of the reference device.
[0102] S505: If the playback fails, the target comparison device is deleted from the current test task.
[0103] In this step, if the target comparison device replays the reference device's operation path using the same operation path playback method and playback still fails, the target comparison device is identified as a problematic device and removed from the current test task. The issue can be recorded and reported. It should be understood that even if some comparison devices encounter issues, the current test task will continue on the remaining comparison devices to ensure that the overall test progress is not affected.
[0104] The multi-language interface consistency testing method provided by the embodiment of the present invention adopts an operation path playback method to enable the target comparison device to play back the operation path of the reference device for the target comparison device corresponding to the target second interface that is not in the same interface as the first interface; if the playback fails, it is determined whether the target comparison device has failed to playback for the first time; if the target comparison device has not failed to playback for the first time, the target comparison device is deleted from the current test task; if the target comparison device has failed to playback for the first time, the target comparison device is initialized, and the operation path playback method is re-adopted to enable the target comparison device to play back the operation path of the reference device; if the playback still fails, the target comparison device is deleted from the current test task, so that the current test task will continue on other comparison devices, thereby improving the robustness of the overall test and ensuring that the overall test progress is not affected.
[0105] Figure 6 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 5 Based on the above embodiment, the embodiment of the present invention further explains step S205 in the above embodiment for the case where the first interface and the second interface are not in the same interface and the second interface includes an abnormal prompt or pop-up window. Figure 6 As shown, the method of the embodiment of the present invention may include:
[0106] S601: Match the second interface screenshot containing the abnormal prompt or pop-up window with images in a preset image library.
[0107] It can be understood that abnormal prompts or pop-ups are external factors and are factors unrelated to the display interface of the comparison device, such as abnormal prompts or pop-ups that the device is low on power. Changes in the display interface of the comparison device can be monitored in real time to identify and process abnormal prompts or pop-ups, and perform corresponding processing to ensure that the test can quickly recover from the abnormality, thereby ensuring that the test process is executed smoothly. Among them, it can be determined based on the page similarity comparison algorithm that the first interface and the second interface are not in the same interface, and the second interface contains an abnormal prompt or pop-up window. In this step, exemplarily, an image containing an abnormal prompt or pop-up window is pre-set in the preset image library, so the screenshot of the second interface containing the abnormal prompt or pop-up window can be matched with the image in the preset image library.
[0108] S602: If the target image is matched, close the abnormal prompt or pop-up window according to the target image, so that the second interface and the first interface are in the same interface.
[0109] For example, if a target image is matched, an exception prompt or pop-up window is identified within a specific area of the second interface screenshot based on the target image, and the exception prompt or pop-up window is closed by a click operation, so that the second interface and the first interface are in the same interface. After closing the exception prompt or pop-up window, if the second data set corresponding to the second interface screenshot is restored to a cached state, it is determined that the exception handling is successful.
[0110] S603: If the target image is not matched, or the abnormal prompt or pop-up window cannot be closed according to the target image, the element identifier of the second element corresponding to the abnormal prompt or pop-up window in the second data set is matched with a preset closing element identifier.
[0111] In this step, the preset closing element identifier is a preset closing element identifier, such as a preset closing element identifier such as back or close. For example, if the target image is not matched, or the abnormal prompt or pop-up window cannot be closed according to the target image, the matching can continue by element identifier (ID), that is, the element identifier of the second element corresponding to the abnormal prompt or pop-up window in the second data set is matched with the preset closing element identifier.
[0112] S604: If the match is successful, close the exception prompt or pop-up window according to the matched second element.
[0113] For example, if the match is successful, the exception prompt or pop-up window can be closed according to the matched second element. After closing the exception prompt or pop-up window, if the second data set corresponding to the second interface screenshot is restored to the cache state, it is determined that the exception handling is successful.
[0114] S605. If the matching fails, or the exception prompt or pop-up window cannot be closed according to the matched second element, or the second interface is still not in the same interface as the first interface after closing the exception prompt or pop-up window, then initialize the comparison device corresponding to the second interface containing the exception prompt or pop-up window, and use the operation path playback method to play back the operation path of the reference device so that the second interface is in the same interface as the first interface.
[0115] For example, if there is no result in the element ID match, or the exception prompt or pop-up window cannot be closed according to the matched second element, or after closing the exception prompt or pop-up window, the second data set corresponding to the second interface screenshot is not restored to the cached state, resulting in the second interface still not being in the same interface as the first interface, then the comparison device corresponding to the second interface containing the exception prompt or pop-up window is executed to return to the initial interface and replay the operation path of the reference device so that the second interface is in the same interface as the first interface.
[0116] The multi-language interface consistency testing method provided by the embodiment of the present invention designs a multi-level recovery strategy for abnormal situations, including image matching, element ID matching and replay of operation paths, to ensure that the test can quickly recover from the abnormality and ensure the continuity and integrity of the test.
[0117] Figure 7 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 6 Based on the above embodiment, the embodiment of the present invention further explains the multilingual content consistency verification algorithm in step S306 of the above embodiment. Figure 7 As shown, the method of the embodiment of the present invention may include:
[0118] S701: Acquire a second element having the same absolute path as the first element.
[0119] For example, a first element includes first text content, a first coordinate region, and a first absolute path, while a second element includes second text content, a second coordinate region, and a second absolute path. A dataset indexed by the element's absolute path (XPath) can be constructed. By traversing the text content in the dataset and utilizing the XPath information of a reference device, the text content and coordinate region with the same XPath across multiple comparison devices can be retrieved. Specifically, a second element with the same absolute path as the first element can be retrieved for comparison.
[0120] S702. For each group of first and second elements with the same absolute path, obtain, from a multilingual corpus, target text content corresponding to the first text content and in the target language corresponding to the second element, based on the first text content of the first element and the target language corresponding to the second element.
[0121] For example, a multilingual corpus (i.e., a multilingual corpus) is pre-built for systematic organization and storage. For details, see Table 1, which uses three multilingual records from a vehicle computer as an example. The Chinese entry (i.e., the first text content) and the target language corresponding to the second element (e.g., Russian) are used as primary keys. This primary key is used to quickly retrieve target text content from the multilingual corpus that corresponds to the first text content and is in the target language corresponding to the second element. The target text content is considered the correct text content.
[0122] Table 1
[0123]
[0124] S703: If the target text content is the same as the second text content of the second element, and the first coordinate region of the first element is the same as the second coordinate region of the second element, determine that there is no abnormality in the second element.
[0125] In this step, the target text content obtained by querying the multilingual corpus is compared with the second text content of the second element, and the first coordinate area of the first element is compared with the second coordinate area of the second element. If the target text content is the same as the second text content of the second element, and the first coordinate area of the first element is the same as the second coordinate area of the second element, it is determined that there is no abnormality in the second element.
[0126] S704: If the target text content is different from the second text content, or the first coordinate area is different from the second coordinate area, it is determined that an abnormality exists in the second element.
[0127] In this step, if the target text content is different from the second text content, or the first coordinate area is different from the second coordinate area, it is determined that the second element is abnormal, and further it can be determined that the second interface is abnormal. For how to handle the situation where the second element is abnormal based on the exception handling strategy, please refer to the subsequent embodiments, which will not be repeated here. It should be noted that the embodiment of the present invention does not limit the order in which steps S703 and S704 are executed.
[0128] The multilingual interface consistency testing method provided by an embodiment of the present invention obtains target text content in the target language corresponding to the first text content and the second element from a multilingual corpus; compares the target text content with the second text content of the second element, and compares the first coordinate area of the first element with the second coordinate area of the second element, thereby determining whether there is an anomaly in the second element. It can accurately determine whether there is an anomaly in the second element, and further helps to accurately determine whether there is an anomaly in the second interface, thereby ensuring the content consistency of interfaces in different language versions.
[0129] Figure 8 Schematic diagram of the multi-language interface consistency testing method provided by the embodiment of the present invention Figure 7 Based on the above embodiment, the embodiment of the present invention further explains step S205 in the above embodiment for the case where the second element is abnormal. Figure 8 As shown, the method of the embodiment of the present invention may include:
[0130] S801: horizontally stitch the first interface screenshot and the second interface screenshot to obtain a stitched image.
[0131] For example, the first interface screenshot of the reference device and the second interface screenshots corresponding to multiple comparison devices can be obtained and integrated, and the first interface screenshot and the second interface screenshot can be horizontally spliced to obtain a spliced image, providing an intuitive comparison basis for consistency verification.
[0132] S802: Mark the abnormal second element in the spliced image to obtain a marked image.
[0133] For example, any abnormal second elements found during the current test task are marked to facilitate subsequent review and correction. Specifically, for example, the part where the comparison was successful (i.e., the second element without abnormalities) is marked with a green frame, and the part where the comparison failed (i.e., the second element with abnormalities) is marked with a red frame.
[0134] S803: Write the annotated image into the test report in the form of test steps.
[0135] Each page (interface) is considered a step. If all language consistency content on the page is successfully matched, the corresponding test step is marked as passed. If any text content fails to match, the corresponding test step is marked as failed. Test reports can be generated based on preset time intervals or operation path-level cycles to facilitate tracking and review of the test process.
[0136] The multilingual interface consistency testing method provided by the embodiment of the present invention horizontally splices the first interface screenshot and the second interface screenshot to obtain a spliced image; annotates the abnormal second element in the spliced image to obtain a marked image; and writes the marked image into the test report in the form of test steps. Through visual means, the results of the multilingual content consistency check are intuitively and clearly displayed, facilitating the rapid identification and analysis of consistency issues in different language versions of the interface.
[0137] In summary, the present invention provides an innovative automated testing process, covering the entire cycle from test initialization, execution to result analysis and report generation, and realizing a full-link automation solution from test operation to result output. Among them, the present invention supports parallel testing of multi-language devices, provides an end-to-end verification process, has a sound exception handling mechanism, and realizes full-link automation and other features. From test initialization to execution, and then to result analysis and report generation, all are automated. Compared with traditional translation verification processes that often require a lot of manual operations, the present invention takes user-configured test parameters as the core, and performs test tasks through automated test scripts, which can effectively reduce costs related to human resources.
[0138] With the deepening of globalization, the consistency of multilingual interfaces is becoming more and more important for enterprises. The automated testing solution provided by the present invention can help enterprises quickly respond to the market demand for multilingual support while maintaining the quality and efficiency of translation, and has high practical value and market potential. The automated testing framework and scheme of the present invention and the construction of a multilingual corpus provide an innovative tool for testing to support the localization and internationalization of systems in the context of globalization. The present invention can not only reduce the dependence on language professionals, but also ensure the high efficiency and high accuracy of translation verification through automation, which is of great strategic significance to enterprises deploying global markets.
[0139] The following are embodiments of the apparatus of the present invention, which can be used to implement the method embodiments of the present invention. For details not disclosed in the apparatus embodiments of the present invention, please refer to the method embodiments of the present invention.
[0140] Figure 9 This is a schematic diagram of the structure of a multi-language interface consistency testing device provided by an embodiment of the present invention. Figure 9 As shown, a multilingual interface consistency testing apparatus 900 according to an embodiment of the present invention includes: an acquisition module 901 for acquiring test parameters in response to a test instruction for multilingual interface consistency, the test parameters including a test traversal strategy, a translation consistency threshold, and an exception handling strategy; an initialization module 902 for initializing a reference device corresponding to a reference language and a plurality of comparison devices corresponding to a plurality of target languages to the same initial interface; a first processing module 903 for controlling each comparison device to synchronously execute a control operation for each of a plurality of control operations on the reference device based on the test traversal strategy, starting from the initial interface, and after the reference device and the comparison device synchronously execute the control operation, acquiring a first data set and a first interface screenshot corresponding to a first interface displayed by the reference device, and acquiring a second data set and a second interface screenshot corresponding to a second interface displayed by the plurality of comparison devices; a determination module 904 for comparing the first interface with each second interface for multilingual interface consistency based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set, and the second interface screenshot, to determine whether there is an exception in the second interface; and a second processing module 905 for performing exception handling on the second interface based on the exception handling strategy if an exception is present.
[0141] Furthermore, the determination module 904 can be specifically used to: based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot, use a page similarity comparison algorithm to determine whether the first interface and the second interface are in the same interface; if the first interface and the second interface are not in the same interface, determine that there is an abnormality in the second interface; if the first interface and the second interface are in the same interface, respectively obtain the first element containing text information in the first data set and the second element containing text information in the second data set; use a multilingual content consistency verification algorithm to compare the text content of the first element and the second element to determine whether there is an abnormality in the second element; if there is an abnormality in the second element, determine that there is an abnormality in the second interface.
[0142] Furthermore, the translation consistency threshold includes a text content similarity threshold and an image similarity threshold. When the determination module 904 is used to determine whether the first interface and the second interface are in the same interface based on the translation consistency threshold, the first data set, the first interface screenshot, the second data set and the second interface screenshot using a page similarity comparison algorithm, it can be specifically used to: use an element comparison method to compare the first data set with each second data set respectively to obtain the text content similarity between the first data set and each second data set; use an image comparison method to compare the first interface screenshot with each second interface screenshot respectively to obtain the image similarity between the first interface screenshot and each second interface screenshot; if the text content similarity is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, then it is determined that the first interface and the second interface are in the same interface; if the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, then it is determined that the first interface and the second interface are not in the same interface.
[0143] Furthermore, the first interface and the second interface are not in the same interface, and the second processing module 905 can be specifically used for: if the second interface does not contain an abnormal prompt and does not contain a pop-up window, then for the target comparison device corresponding to the target second interface that is not in the same interface as the first interface, the operation path playback method is used to make the target comparison device replay the operation path of the reference device; if the playback fails, it is determined whether the target comparison device has failed to replay for the first time, if not, the target comparison device is deleted from the current test task; if so, the target comparison device is initialized, and the operation path playback method is re-adopted to make the target comparison device replay the operation path of the reference device, if the playback fails, the target comparison device is deleted from the current test task; if the second interface contains an abnormal prompt or a pop-up window, a screenshot of the second interface containing the abnormal prompt or pop-up window is compared with the preset image The images in the library are matched. If the target image is matched, the exception prompt or pop-up window is closed according to the target image, so that the second interface is in the same interface as the first interface; if the target image is not matched, or the exception prompt or pop-up window cannot be closed according to the target image, the element identifier of the second element corresponding to the exception prompt or pop-up window in the second data set is matched with the preset closing element identifier. If the match is successful, the exception prompt or pop-up window is closed according to the matched second element. If the match fails, or the exception prompt or pop-up window cannot be closed according to the matched second element, or the second interface is still not in the same interface as the first interface after closing the exception prompt or pop-up window, the comparison device corresponding to the second interface containing the exception prompt or pop-up window is initialized, and the operation path playback method is used to play back the operation path of the reference device, so that the second interface is in the same interface as the first interface.
[0144] Furthermore, when the determination module 904 is used to compare the text contents of the first element and the second element using a multilingual content consistency verification algorithm to determine whether there is an abnormality in the second element, it can be specifically used to: obtain a second element with the same absolute path as the first element; for each group of first elements and second elements with the same absolute path, according to the first text content of the first element and the target language corresponding to the second element, obtain the target text content corresponding to the first text content and in the target language corresponding to the second element from the multilingual corpus; if the target text content is the same as the second text content of the second element, and the first coordinate area of the first element is the same as the second coordinate area of the second element, then determine that there is no abnormality in the second element; if the target text content is different from the second text content, or the first coordinate area is different from the second coordinate area, then determine that there is an abnormality in the second element.
[0145] Furthermore, if there is an abnormality in the second element, the second processing module 905 can be specifically used to: perform horizontal splicing processing on the first interface screenshot and the second interface screenshot to obtain a spliced image; mark the abnormal second element in the spliced image to obtain a marked image; and write the marked image into the test report in the form of test steps.
[0146] Furthermore, when the first processing module 903 is used to control each comparison device to synchronously execute the control operation for each control operation among multiple control operations of the reference device, it can be specifically used to: for each control operation among multiple control operations of the reference device, if the control operation corresponds to a multi-level operation path, control the reference device and the comparison device to synchronously execute a deep traversal of the multi-level operation path until all control operations corresponding to the multi-level operation path are executed.
[0147] Furthermore, the acquisition module 901 can also be used to: before responding to a test instruction for multilingual interface consistency, in response to a configuration operation for a reference device and a reference language, acquire and store a reference device and a reference language; in response to a configuration operation for a comparison device and a target language corresponding to the comparison device, acquire and store a comparison device and a target language corresponding to the comparison device; in response to a configuration operation for test parameters, acquire and store test parameters.
[0148] Furthermore, the second processing module 905 may also be configured to output a test report according to a preset time interval or operation path level cycle.
[0149] The device of the embodiment of the present invention can be used to execute the technical solution of any of the above-mentioned method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0150] Figure 10 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 10 As shown, the electronic device 1000 may include: at least one processor 1001 and a memory 1002.
[0151] The memory 1002 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer-executable instructions.
[0152] The memory 1002 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.
[0153] Processor 1001 is configured to execute computer-executable instructions stored in memory 1002 to implement the multi-language interface consistency testing method described in the aforementioned method embodiment. Processor 1001 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. Specifically, when implementing the multi-language interface consistency testing method described in the aforementioned method embodiment, the electronic device may be, for example, a server.
[0154] Optionally, the electronic device 1000 may further include a communication interface 1003. In a specific implementation, if the communication interface 1003, memory 1002, and processor 1001 are implemented independently, the communication interface 1003, memory 1002, and processor 1001 may be interconnected via a bus and communicate with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, control buses, and so on, but this does not necessarily mean that there is only one bus or only one type of bus.
[0155] Optionally, in a specific implementation, if the communication interface 1003, the memory 1002 and the processor 1001 are integrated on a chip, the communication interface 1003, the memory 1002 and the processor 1001 can complete communication through an internal interface.
[0156] The present invention also provides a computer-readable storage medium having computer program instructions stored therein. When a processor executes the computer program instructions, the above-mentioned method for testing consistency of a multilingual interface is implemented.
[0157] The present invention also provides a computer program product, including a computer program, which implements the above-mentioned method for testing consistency of a multilingual interface when executed by a processor.
[0158] The computer-readable storage medium can be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The computer-readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0159] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Alternatively, the readable storage medium may be an integral part of the processor. The processor and the readable storage medium may be located in an application-specific integrated circuit. Alternatively, the processor and the readable storage medium may be discrete components within the multi-language interface consistency tester.
[0160] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0161] Finally, it should be noted that the above embodiments are only preferred embodiments for fully illustrating the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention.
Claims
1. A method for testing consistency of a multilingual interface, characterized in that: include: In response to a test instruction for multilingual interface consistency, obtaining user-configured test parameters, the test parameters including a test traversal strategy, a translation consistency threshold, and an exception handling strategy; The translation consistency threshold includes a text content similarity threshold and an image similarity threshold; Initializing a reference device corresponding to a reference language and a plurality of comparison devices corresponding to a plurality of target languages to the same initial interface; Based on the test traversal strategy, starting from the initial interface, for each control operation among the multiple control operations of the reference device, controlling each of the comparison devices to synchronously execute the control operation, and after the reference device and the comparison device synchronously execute the control operation, obtaining a first data set and a first interface screenshot corresponding to a first interface displayed by the reference device, and obtaining a second data set and a second interface screenshot corresponding to second interfaces respectively displayed by the multiple comparison devices; Comparing the first data set with each of the second data sets using an element comparison method to obtain text content similarity between the first data set and each of the second data sets; and using an image comparison method to compare the first interface screenshot with each of the second interface screenshots to obtain image similarity between the first interface screenshot and each of the second interface screenshots; If the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, it is determined that the first interface and the second interface are not in the same interface, that is, it is determined that an abnormality exists in the second interface; If the text content similarity is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, determining that the first interface and the second interface are the same interface, and obtaining a first element containing text information in the first data set and a second element containing text information in the second data set respectively; using a multilingual content consistency verification algorithm to compare the text content of the first element and the second element to determine whether the second element has any anomalies; If the second element is abnormal, determining that the second interface is abnormal; If an exception occurs, the second interface is subjected to exception handling based on the exception handling strategy.
2. The testing method according to claim 1, wherein: The first interface and the second interface are not in the same interface, and performing exception handling on the second interface based on the exception handling strategy includes: If the second interface does not include an abnormal prompt and does not include a pop-up window, then for the target comparison device corresponding to the target second interface that is not in the same interface as the first interface, an operation path playback method is used to enable the target comparison device to replay the operation path of the reference device; if the playback fails, it is determined whether the target comparison device has failed to replay for the first time. If not, the target comparison device is deleted from the current test task; if so, the target comparison device is initialized, and the operation path playback method is re-adopted to enable the target comparison device to replay the operation path of the reference device. If the playback fails, the target comparison device is deleted from the current test task; If the second interface includes the abnormal prompt or the pop-up window, the screenshot of the second interface including the abnormal prompt or the pop-up window is matched with an image in a preset image library. If the target image is matched, the abnormal prompt or the pop-up window is closed according to the target image, so that the second interface and the first interface are in the same interface. If the target image is not matched, or the abnormal prompt or the pop-up window cannot be closed according to the target image, the element identifier of the second element corresponding to the abnormal prompt or the pop-up window in the second data set is matched with a preset closing element identifier. If the match is successful, the abnormal prompt or the pop-up window is closed according to the matched second element. If the match fails, or the abnormal prompt or the pop-up window cannot be closed according to the matched second element, or the second interface is still not in the same interface as the first interface after closing the abnormal prompt or the pop-up window, the comparison device corresponding to the second interface including the abnormal prompt or the pop-up window is initialized, and the operation path of the reference device is replayed using the operation path playback method, so that the second interface and the first interface are in the same interface.
3. The testing method according to claim 1, wherein: The using a multilingual content consistency verification algorithm to compare the text content of the first element and the second element to determine whether the second element has an abnormality includes: Get a second element with the same absolute path as the first element; For each group of first and second elements with the same absolute path, obtaining, from a multilingual corpus, target text content corresponding to the first text content and in the target language corresponding to the second element, based on the first text content of the first element and the target language corresponding to the second element; If the target text content is the same as the second text content of the second element, and the first coordinate area of the first element is the same as the second coordinate area of the second element, then it is determined that there is no abnormality in the second element; If the target text content is different from the second text content, or the first coordinate area is different from the second coordinate area, it is determined that an abnormality exists in the second element.
4. The testing method according to claim 3, wherein: The second element has an exception, and performing exception handling on the second interface based on the exception handling strategy includes: horizontally stitching the first interface screenshot and the second interface screenshot to obtain a stitched image; marking the abnormal second element in the spliced image to obtain a marked image; The annotated image is written into a test report in the form of test steps.
5. The testing method according to claim 1, wherein: For each control operation among the multiple control operations of the reference device, controlling each of the comparison devices to synchronously execute the control operation includes: For each control operation among the multiple control operations of the reference device, if the control operation corresponds to a multi-level operation path, the reference device and the comparison device are controlled to synchronously perform a deep traversal of the multi-level operation path until all the control operations corresponding to the multi-level operation path are executed.
6. The testing method according to any one of claims 1 to 5, characterized in that: Before responding to the test instruction for the consistency of the multi-language interface, the method further includes: Retrieve and store the reference device and the reference language in response to a configuration operation for the reference device and the reference language; In response to a configuration operation for the comparison device and a target language corresponding to the comparison device, acquiring and storing the comparison device and the target language corresponding to the comparison device; In response to the configuration operation on the test parameters, the test parameters are acquired and stored.
7. The testing method according to any one of claims 1 to 5, characterized in that: Also includes: Output test reports based on preset time intervals or operation path level cycles.
8. A multi-language interface consistency testing device, characterized in that: include: An acquisition module, configured to acquire user-configured test parameters in response to a test instruction for multilingual interface consistency, the test parameters including a test traversal strategy, a translation consistency threshold, and an exception handling strategy; The translation consistency threshold includes a text content similarity threshold and an image similarity threshold; An initialization module, configured to initialize a reference device corresponding to a reference language and a plurality of comparison devices corresponding to a plurality of target languages to the same initial interface; a first processing module, configured to, based on the test traversal strategy, start from the initial interface and, for each control operation among multiple control operations of the reference device, control each of the comparison devices to synchronously execute the control operation; and after the reference device and the comparison device synchronously execute the control operation, obtain a first data set and a first interface screenshot corresponding to a first interface displayed by the reference device, and obtain a second data set and a second interface screenshot corresponding to second interfaces respectively displayed by the multiple comparison devices; a determination module, configured to compare the first data set with each of the second data sets respectively using an element comparison method to obtain text content similarity between the first data set and each of the second data sets; and using an image comparison method to compare the first interface screenshot with each of the second interface screenshots to obtain image similarity between the first interface screenshot and each of the second interface screenshots; if the text content similarity is less than or equal to the text content similarity threshold, or the image similarity is less than or equal to the image similarity threshold, determining that the first interface and the second interface are not in the same interface, that is, determining that an abnormality exists in the second interface; If the text content similarity is greater than the text content similarity threshold, and the image similarity is greater than the image similarity threshold, determining that the first interface and the second interface are the same interface, and obtaining a first element containing text information in the first data set and a second element containing text information in the second data set respectively; using a multilingual content consistency verification algorithm to compare the text content of the first element and the second element to determine whether the second element has any anomalies; If the second element is abnormal, determining that the second interface is abnormal; The second processing module is configured to perform exception processing on the second interface based on the exception processing strategy if an exception occurs.
9. An electronic device, characterized in that: include: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the multi-language interface consistency testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed, the method for testing the consistency of a multi-language interface according to any one of claims 1 to 7 is implemented.
11. A computer program product comprising a computer program, characterized in that When the computer program is executed, the multi-language interface consistency testing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Parallel following test equipment of mobile terminal, cloud true mobile terminal and parallel following test method of mobile terminal
CN108307021A