Multi-tenant-oriented UI test method and device, computer equipment and medium

Through a multi-tenant UI testing method, the same test script is executed using the configuration dataset and encapsulated functional layer, which solves the problem of inefficient multi-tenant UI automation testing and realizes the reuse and adaptability of test scripts.

CN119883881APending Publication Date: 2025-04-25BEIJING BAIJU YIXING TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411755044.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In a multi-tenant travel service system, due to the data differences in the UI of each tenant's driver-side system, the traditional method needs to build UI test cases for each tenant, which is inefficient.

Method used

Provides a UI testing method for multi-tenants, which obtains configuration data sets of each tenant and accesses UI test cases based on these data sets. The test script and interface logic are encapsulated into different functional layers. Through the interface calls between layers, the same test script is executed to adapt to the UI of different tenants.

Benefits of technology

Improve the efficiency of multi-tenant UI automation testing, realize the reuse of test scripts and the adaptability of UI test cases. Even if new tenants or UI changes, there is no need to modify the test script, just update the interface logic or configuration data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883881A_ABST
    Figure CN119883881A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-tenant-oriented UI test method and device, computer equipment and a storage medium. The method comprises the steps of responding to a UI test request, wherein the UI test request comprises tenant attribute information of at least one to-be-tested tenant; respectively acquiring a configuration data set of each tenant according to the attribute information of each tenant, and respectively accessing the UI test case according to each configuration data set for testing; wherein the test script and the interface logic of the UI test case are respectively packaged as different functional layers; and executing the same test script based on different interface objects in the functional layers corresponding to different calling interface logics of the configuration data set of each tenant through an interface calling mode between layers. By adopting the method, the multi-tenant UI automatic testing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer software technology, and in particular to a multi-tenant oriented UI testing method, apparatus, computer equipment and storage medium. Background Art

[0002] With the development of computer software technology, travel service systems that can bring together multiple tenants have emerged. For example, they can be based on travel SaaS (Software-as-a-Service) platforms. In this type of travel service system, there are many tenants, and the data between tenants are isolated from each other. Each tenant can configure the data according to its own requirements, so there are slight differences in the data of each tenant's driver-side system.

[0003] In the traditional method, since there are data differences in the UI (User Interface) of the driver-side system of each tenant, it is necessary to build corresponding UI test cases for each tenant separately, which leads to low efficiency when performing UI automation testing for multiple tenants. Summary of the invention

[0004] Based on this, it is necessary to provide a multi-tenant UI testing method, device, computer equipment and storage medium that can improve the efficiency of multi-tenant client UI automation testing in response to the above technical problems.

[0005] In a first aspect, a multi-tenant UI testing method is provided, the method comprising:

[0006] In response to a UI test request, the UI test request includes tenant attribute information of at least one tenant to be tested;

[0007] According to the attribute information of each tenant, the configuration data set of each tenant is obtained respectively, and the UI test case is accessed respectively according to each configuration data set for testing; wherein the test script and interface logic of the UI test case are respectively encapsulated as different functional layers;

[0008] By calling interfaces between layers, the same test script is executed based on different interface objects in the functional layer corresponding to different calling interface logics of the configuration data sets of each tenant.

[0009] In some embodiments, during the execution of the test script, the method further includes:

[0010] Locate the target element in each tenant's UI according to the node information defined in the UI test case, and perform the current operation defined in the UI test case on the target element;

[0011] The corresponding execution waiting time is determined for the current operation according to the operation type of the current operation and the type of the target element, and in response to the execution waiting time expiring, the current operation is terminated and the execution of the next operation is started.

[0012] In some embodiments, before ending the current operation and entering the next operation, the method further includes:

[0013] After the current operation is completed, the execution result of the current operation is verified according to the interface return value and / or the prompt box keyword returned after the current operation. In response to the verification passing, the execution of the next operation is started.

[0014] In some embodiments, the method further comprises:

[0015] Monitor exceptions that occur during the execution of test scripts;

[0016] In response to detecting an exception, a preset exception waiting time is obtained, and after the exception waiting time has elapsed, the test script is re-executed.

[0017] In some embodiments, locating a target element in the UI of each tenant according to the node information defined in the UI test case includes:

[0018] Use the UI inspection tool to check whether the UI layouts of multiple tenants are the same;

[0019] In response to the fact that the UI layouts of multiple tenants are the same but the colors or grayscales are different, an image recognition function encapsulated based on an automated testing framework is enabled to perform image recognition on the UI of each tenant to obtain node information to locate the target element.

[0020] In some embodiments, the method further comprises:

[0021] After executing UI tests for each tenant, a test report is generated based on the execution results of UI tests for each tenant.

[0022] The test report is returned to each tenant's terminal.

[0023] In some embodiments, the method further comprises:

[0024] The tenant attribute information and the configuration data sets corresponding to each tenant are maintained based on the tenant dimension.

[0025] In a second aspect, a multi-tenant UI testing device is provided, the device comprising:

[0026] A request receiving module, used to respond to a UI test request, where the UI test request includes tenant attribute information of multiple tenants to be tested;

[0027] The use case access module is used to obtain the configuration data set of each tenant according to the attribute information of each tenant, and access the UI test case according to each configuration data set for testing; wherein the test script and interface logic of the UI test case are respectively encapsulated as different functional layers;

[0028] The use case execution module is used to execute the same test script based on different element objects in the functional layer corresponding to different calling interface logics of the configuration data sets of each tenant through interface calls between layers.

[0029] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the multi-tenant UI testing method of any one of the first aspects are implemented.

[0030] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the multi-tenant UI testing method of any one of the first aspects are implemented.

[0031] The above-mentioned multi-tenant UI testing method, device, computer equipment and storage medium encapsulate the test script and interface logic of the UI test case respectively, and execute the same test script based on the tenant's respective configuration data set according to the UI test request. During the execution process, the interface objects of different interface logic functional layers are called respectively to realize UI automated testing for different tenants. With this solution, even if a new tenant is added or the UI changes, it is only necessary to redefine or update the interface object at the functional layer of the interface logic, or modify the configuration data of the tenant's client, without modifying the test script, thereby improving the reuse rate of the test script, and then being able to improve the adaptability of UI test cases for multiple tenants, thereby improving the efficiency of multi-tenant UI automated testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is an application environment diagram of a multi-tenant UI testing method in one embodiment;

[0033] Figure 2 A flowchart of a multi-tenant UI testing method in one embodiment;

[0034] Figure 3 A schematic diagram of the implementation framework of multi-tenant UI testing methods in some application examples;

[0035] Figure 4 Schematic diagram of UI testing methods for multi-tenants in some application examples;

[0036] Figure 5is a structural block diagram of a multi-tenant UI testing device in one embodiment;

[0037] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0039] The multi-tenant UI testing method provided in this application can be applied to Figure 1 In the application environment shown, the tenant terminal 102 communicates with the test server 104 through the network.

[0040] The test server 104 responds to the UI test request initiated by the tenant terminal 102, where the UI test request includes tenant attribute information of at least one tenant to be tested, obtains the configuration data set of each tenant according to the attribute information of each tenant (the configuration data set of each tenant can be configured based on the respective tenant terminal 102), and accesses the UI test case for testing according to each configuration data set, wherein the test script and interface logic of the UI test case are respectively encapsulated as different functional layers, and the same test script is executed by calling interfaces between layers, based on different element objects in the functional layer corresponding to the different calls to the interface logic of the configuration data set of each tenant.

[0041] The tenant terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the test server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0042] In one embodiment, Figure 2 As shown in the figure, a multi-tenant UI testing method is provided. Figure 1 The following steps are used as an example to illustrate the test server in the example:

[0043] Step S202: responding to a UI test request, where the UI test request includes tenant attribute information of multiple tenants to be tested.

[0044] The tenant attribute information may include but is not limited to tenant name, tenant ID, tenant key and other information.

[0045] Specifically, tenants can configure UI data through their respective clients, or developers can configure corresponding UI data for each tenant according to their different needs, and associate the configuration data sets of the UI data configured for each tenant with the tenant attribute information of each tenant, and store them in the tenant configuration database for retrieval when needed.

[0046] Step S204, respectively obtaining configuration data sets of each tenant according to the attribute information of each tenant, and respectively accessing UI test cases for testing according to each configuration data set; wherein the test script and interface logic of the UI test case are respectively encapsulated as different functional layers.

[0047] Specifically, when one or some tenants initiate a UI test request through a tenant terminal, the server can obtain a configuration data set matching each tenant attribute information from the tenant configuration database according to the tenant attribute information carried in the UI test request that can characterize the attributes of each tenant. Then, the UI test cases can be accessed separately based on the configuration data set of each tenant.

[0048] Among them, the construction of the UI test case in the embodiment of the present application is based on the design concept of separating the test script and the interface logic. That is, according to the idea of ​​layered design, the interface control unit (corresponding to the interface logic) and the interface execution unit (corresponding to the execution script) can be extracted separately to form corresponding functional layers, and the layers are directly called through a common interface.

[0049] More specifically, the UI user interface can be encapsulated as a class (functional layer), in which interface objects are defined. Each interface object includes elements in the UI user interface (for example, buttons, input boxes, etc.) and the operation functions corresponding to the elements. For different tenants, the UI interface logic is different. It is only necessary to add or modify interface objects according to the personalized needs of the tenants without changing the test script, thereby realizing the reuse of the same test script.

[0050] Step S206 , by calling interfaces between layers, the same test script is executed based on different interface objects in the functional layer corresponding to different calling interface logics of the configuration data sets of each tenant.

[0051] In this step, since the interface control unit and the interface execution unit are extracted to form corresponding functional layers, the layers can be called through a common interface. Therefore, for different tenants, even if the UI designs are different, there is no need to reconstruct the code of the use case test script according to the UI design of each tenant. Instead, it is possible to be based on the functional layer framework of the same test script, and during the execution of the test script, according to each tenant's own customized configuration data set, call different interface objects in the functional layer of the interface logic through interface calls between layers, and perform different operations based on different interface objects, thereby realizing UI automation testing that adapts one UI test case to multiple tenants.

[0052] The above-mentioned UI testing method for multi-tenants encapsulates the test script and interface logic of the UI test case separately, and executes the same test script based on the tenant's respective configuration data sets according to the UI test request. During the execution process, the interface objects of different interface logic functional layers are called respectively to realize UI automated testing for different tenants. With this solution, even if new tenants are added or the UI changes, it is only necessary to redefine or update the interface objects in the interface logic functional layer, or modify the tenant's client configuration data, without modifying the test script, thereby improving the reuse rate of the test script, and then being able to improve the adaptability of UI test cases for multi-tenants, thereby improving the efficiency of multi-tenant UI automated testing.

[0053] In some embodiments, during the execution of the test script, the method also includes: locating the target element in the UI of each tenant according to the node information defined in the UI test case, and executing the current operation defined in the UI test case on the target element; determining the corresponding execution waiting time for the current operation according to the operation type of the current operation and the type of the target element, and in response to the execution waiting time having passed, ending the current operation and entering the execution of the next operation.

[0054] In this embodiment, a node search unit is provided to determine the target element in each tenant's UI according to the node information in the test script in the UI test case, call the interface object corresponding to the target element, and execute the current operation defined in the UI test case on the target element, that is, execute the operation function defined in the interface object. In addition, a conditional waiting unit may also be provided. Since the test script of the UI test case may generally contain multiple execution steps, some specific execution steps may need to wait for a certain time before they can be executed. Therefore, the conditional waiting unit may determine the corresponding execution waiting time for the current operation according to the operation type of the current operation and the type of the target element before executing the current operation, and set the corresponding execution waiting time in the test script, so as to ensure that the next operation is entered after the current operation is completed, thereby ensuring the normal execution of the case and improving stability.

[0055] Furthermore, in some embodiments, the configuration data set includes schema-based interface switching data. Before locating the target element in the UI of each tenant according to the node information defined in the UI test case, the method also includes: switching to the UI (user interface) to be tested of each tenant through the interface jump through the specified interface path according to the interface switching data of each tenant for testing. In this embodiment, by supporting the configuration of interface switching data on the app client, the interface can be flexibly switched according to the different needs of different tenants, thereby flexibly adapting to different interface testing needs, and therefore, the automation of UI testing can be improved.

[0056] In some embodiments, before ending the current operation and entering the next operation, the method may also include: after the current operation is completed, verifying the execution result of the current operation based on the interface return value and / or prompt box keywords returned after the current operation, and in response to the verification passing, entering the execution of the next operation.

[0057] In this embodiment, by setting a result assertion unit, after an operation is executed, it is possible to determine whether the current operation is executed successfully based on the interface return value and the prompt box keyword and other information, that is, to verify whether the execution result of the current operation meets expectations. When the verification is passed, the next operation is executed. This embodiment can perform verification in a timely manner during the execution of the use case, thereby improving the accuracy of each link of the use case execution.

[0058] In some embodiments, the method further includes: monitoring exceptions occurring during the execution of the test script; in response to monitoring the occurrence of an exception, obtaining a preset exception waiting time, and re-executing the test script after the exception waiting time has elapsed.

[0059] In this embodiment, during the execution of the test script, an exception capture unit can be set to capture the exceptions thrown during the execution process. If an exception occurs, it can wait for a certain period of time (i.e., the exception waiting time, which is configurable) before re-execution. Therefore, the number of test case execution failures due to network jitter and device abnormalities can be effectively reduced.

[0060] In some embodiments, the target element in the UI of each tenant is located according to the node information defined in the UI test case, including: detecting whether the UI layouts of multiple tenants are the same through a UI inspection tool; in response to the UI layouts of multiple tenants being the same but with different colors or grayscales, enabling an image recognition function encapsulated based on an automated testing framework, performing image recognition on the UI of each tenant to obtain node information to locate the target element.

[0061] In this embodiment, the image recognition function can be encapsulated into the test framework layer based on the UI automated test framework (e.g., Airtest) and combined with a high-level programming language (e.g., Python). Since the image recognition based on Airtest can support both color and grayscale image recognition methods, and in actual scenarios, since the UI layouts of multi-tenant clients are often similar or identical, but there are slight differences in color or grayscale, therefore, in the case where the layouts are the same or similar but the colors or grayscales are different, the image recognition function encapsulated based on the automated test framework can be enabled, which can be positioned more quickly and accurately. In other embodiments, it is also possible to use precise element ID positioning, which is not particularly limited here.

[0062] In some embodiments, the method further includes: after executing the UI test for each tenant respectively, generating a test report for the execution result of the UI test for each tenant; and returning the test report to the terminal of each tenant respectively.

[0063] In this embodiment, the management and execution control of test cases can also be performed by combining the Python test framework (Pytest framework), and the execution results can be collected, and the test report can be output through a test report tool, for example, Allure can be used, which is a lightweight, flexible and multi-language test report tool. By generating test reports separately and returning the corresponding tenant terminal requesting the test, the tenant terminal can obtain the test results in a timely manner.

[0064] In some embodiments, the method further includes: maintaining tenant attribute information and configuration data sets corresponding to each tenant in a tenant dimension.

[0065] In this embodiment, the tenant basic information maintenance capability can be provided to manage the basic information and configuration data sets required to execute the use case according to the tenant dimension, thereby achieving isolation between tenants.

[0066] Below, in combination with some application examples, the multi-tenant oriented UI testing method involved in the present application is further described in detail. Before performing the multi-tenant oriented UI testing method involved in the embodiment of the present application, the following steps may also be included:

[0067] 1. Determine the environment installation of the test end. Install pycharm tools, configure git environment, install adb, install python (airtest supports 2.7-3.9), install airtest and pocoui, install jdk, Allure, pytest and pytest-allure plug-ins, and install iOS-Tagent;

[0068] 2. Determine the environment preparation for the tenant's mobile terminal. If the system is Android, you need to install pocoservice.apk and grant permissions and turn on the developer mode; if the system is IOS, install and trust WDA;

[0069] 3. Determine the functions of the UI automation framework. Build a UI automation test framework that can support the separation of test scripts and interface logic, and can cope with multi-tenant, multi-application environments, and complex scenarios. The UI automation test platform must have at least the following functions:

[0070] 1) Separation of test scripts and interface logic:

[0071] According to the layered design concept, the interface control unit and the interface execution unit are extracted to form corresponding functional layers, and the layers are directly called through the general interface.

[0072] 2) Case (test case) failure retry capability:

[0073] The test script execution module captures exceptions thrown during the execution process through the exception capture unit. If an exception occurs, it will wait for a certain period of time (configurable) before re-execution, which can effectively reduce the number of case execution failures caused by network jitter and device abnormalities.

[0074] 3) Image recognition capability encapsulation and public method encapsulation

[0075] Using the basic capabilities provided by airtest and poco, we encapsulate functions such as one-key close and one-key return to provide the required image recognition capabilities for the application layer.

[0076] 4)Schema mode switching interface

[0077] By writing relevant methods in the app code, the interface switching method of interface jump can be achieved by specifying the interface path in the use case.

[0078] Below, you can refer to Figure 3 As shown, Figure 3 The following is a schematic diagram of the implementation framework of the UI testing method for multiple tenants in some application examples.

[0079] Test application layer: Use the pytest framework to manage and execute test cases. The execution results can generate test reports and output reports through allure.

[0080] Test framework layer: You can use Airtest combined with Python, a cross-platform UI automated test framework, Poco's automated test framework based on UI control search, etc. During the use case execution, optimized execution is performed through units such as node search, conditional waiting, and result assertion.

[0081] Node search unit: According to the node information defined in the use case, locate the target element to be operated through interface source code keyword search, image recognition, etc., and then execute the operation defined in the use case.

[0082] Conditional waiting unit: A use case generally contains multiple operation steps, and some specific steps may require a certain amount of time to complete. Therefore, the system can set the corresponding execution waiting time according to conditions such as operation type and element type to ensure the normal execution of the use case.

[0083] Result assertion unit: When a step is executed, it is necessary to determine whether the step is executed successfully. Only if it is successful, the subsequent operations will be continued. This unit can verify whether the step execution result meets expectations based on the interface return value and prompt box keywords.

[0084] UI positioning layer: used for control positioning. There are two ways to use it: one is accurate element ID positioning, and the other is positioning using image recognition capabilities. Airtest-based image recognition can identify both color images and grayscale images, which is very suitable for positioning in the case of multiple tenants with different colors but the same layout. This layer provides basic capabilities for functions involving interface element extraction in the framework layer, such as locating the position of elements through image recognition in "node search".

[0085] Device layer: The driver side can be distributed on mobile terminals of different systems such as Android and IOS.

[0086] Application layer: Provides tenant basic information maintenance capabilities, and manages basic information required to execute use cases by tenant dimension, such as tenant name, tenant ID, tenant key, etc. When a tenant requests UI regression testing through the tenant terminal app, you only need to select the tenant's configuration data set when executing the use case to execute the UI test case set. In this way, the same set of UI test case sets can be used to run tests on multiple driver terminals, without the need to prepare a set of UI test cases for each tenant's app. Reference Figure 4 As shown, Figure 4 A schematic diagram of a multi-tenant UI testing method in some application instances is shown.

[0087] According to the method of the embodiment of the present application, the tester can input accurate case steps to generate test cases that can be executed on multi-device and multi-tenant driver terminals. This solves the problem that a set of cases can only test one tenant, and enables a set of case scenarios to be applicable to mobile phones with different resolutions and driver terminals of different tenants. This greatly improves the efficiency of UI automated testing.

[0088] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0089] In one embodiment, Figure 5 As shown, a multi-tenant oriented UI testing device is provided, including: a request receiving module 510, a use case access module 520 and a use case execution module 530, wherein:

[0090] A request receiving module 510, configured to respond to a UI test request, wherein the UI test request includes tenant attribute information of multiple tenants to be tested;

[0091] The use case access module 520 is used to obtain the configuration data set of each tenant according to the attribute information of each tenant, and access the UI test case according to each configuration data set for testing; wherein the test script and interface logic of the UI test case are respectively encapsulated as different functional layers;

[0092] The use case execution module 530 is used to execute the same test script based on different element objects in the functional layer corresponding to different calling interface logics of the configuration data sets of each tenant through interface calls between layers.

[0093] In some embodiments, the use case execution module 530 locates the target element in the UI of each tenant according to the node information defined in the UI test case, and executes the current operation defined in the UI test case on the target element; determines the corresponding execution waiting time for the current operation according to the operation type of the current operation and the type of the target element, and in response to the execution waiting time having passed, ends the current operation and enters the execution of the next operation.

[0094] In some embodiments, after the current operation is completed, the use case execution module 530 verifies the execution result of the current operation according to the interface return value and / or prompt box keyword returned after the current operation, and enters the execution of the next operation in response to passing the verification.

[0095] In some embodiments, the use case execution module 530 monitors exceptions occurring during the execution of the test script; in response to monitoring the occurrence of an exception, a preset exception waiting time is obtained, and after the exception waiting time has elapsed, the test script is re-executed.

[0096] In some embodiments, the use case execution module 530 detects whether the UI layouts of multiple tenants are the same through a UI inspection tool; in response to the fact that the UI layouts of multiple tenants are the same but the colors or grayscales are different, an image recognition function encapsulated based on an automated testing framework is enabled to perform image recognition on the UI of each tenant to obtain node information to locate the target element.

[0097] In some embodiments, after executing the UI test for each tenant respectively, the use case execution module 530 generates a test report for the execution result of the UI test for each tenant; and returns the test report to the terminal of each tenant respectively.

[0098] In some embodiments, the use case access module 520 maintains tenant attribute information and configuration data sets corresponding to each tenant based on the tenant dimension.

[0099] For the specific limitations of the multi-tenant UI testing device, please refer to the limitations of the multi-tenant UI testing method above, which will not be repeated here. Each module in the above-mentioned multi-tenant UI testing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0100] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store configuration data of each tenant. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a UI testing method for multiple tenants is implemented.

[0101] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0102] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: responding to a UI test request, wherein the UI test request includes tenant attribute information of at least one tenant to be tested; obtaining a configuration data set of each tenant according to each tenant attribute information, and accessing UI test cases for testing according to each configuration data set; wherein the test script and the interface logic of the UI test case are respectively encapsulated as different functional layers; and executing the same test script by calling interfaces between layers, respectively based on different calling interface objects in the functional layers corresponding to the interface logic of the configuration data sets of each tenant.

[0103] In one embodiment, when the processor executes the computer program, the following steps are also implemented: locating the target element in the UI of each tenant according to the node information defined in the UI test case, and executing the current operation defined in the UI test case on the target element; determining the corresponding execution waiting time for the current operation according to the operation type of the current operation and the type of the target element, and in response to the execution waiting time having passed, terminating the current operation and entering the execution of the next operation.

[0104] In one embodiment, when the processor executes the computer program, the following steps are also implemented: after the current operation is completed, the execution result of the current operation is verified according to the interface return value and / or prompt box keyword returned after the current operation, and in response to the verification passing, the execution of the next operation is entered.

[0105] In one embodiment, when the processor executes the computer program, the following steps are also implemented: monitoring exceptions occurring during the execution of the test script; in response to monitoring the occurrence of an exception, obtaining a preset exception waiting time, and re-executing the test script after the exception waiting time has elapsed.

[0106] In one embodiment, when the processor executes the computer program, the following steps are also implemented: using a UI inspection tool to detect whether the UI layouts of multiple tenants are the same; in response to the UI layouts of multiple tenants being the same but with different colors or grayscales, enabling an image recognition function encapsulated based on an automated testing framework, performing image recognition on the UI of each tenant to obtain node information to locate the target element.

[0107] In one embodiment, when the processor executes the computer program, the following steps are also implemented: after executing the UI test for each tenant respectively, a test report is generated for the execution result of the UI test for each tenant; and the test report is returned to the terminal of each tenant respectively.

[0108] In one embodiment, when the processor executes the computer program, the following steps are further implemented: tenant attribute information and configuration data sets corresponding to each tenant are maintained in the tenant dimension.

[0109] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: responding to a UI test request, the UI test request including tenant attribute information of at least one tenant to be tested; obtaining a configuration data set for each tenant according to each tenant attribute information, and accessing UI test cases for testing according to each configuration data set; wherein the test script and the interface logic of the UI test case are respectively encapsulated as different functional layers; and executing the same test script by calling interfaces between layers, respectively based on different calling interface objects in the functional layers corresponding to the configuration data sets of each tenant.

[0110] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: locating the target element in the UI of each tenant according to the node information defined in the UI test case, and executing the current operation defined in the UI test case on the target element; determining the corresponding execution waiting time for the current operation according to the operation type of the current operation and the type of the target element, and in response to the execution waiting time having passed, terminating the current operation and entering the execution of the next operation.

[0111] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: after the current operation is completed, the execution result of the current operation is verified according to the interface return value and / or prompt box keyword returned after the current operation, and in response to the verification passing, the execution of the next operation is entered.

[0112] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: monitoring exceptions occurring during the execution of the test script; in response to monitoring the occurrence of an exception, obtaining a preset exception waiting time, and re-executing the test script after the exception waiting time has passed.

[0113] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: using a UI inspection tool to detect whether the UI layouts of multiple tenants are the same; in response to the UI layouts of multiple tenants being the same but with different colors or grayscales, enabling an image recognition function encapsulated based on an automated testing framework, performing image recognition on the UI of each tenant to obtain node information to locate the target element.

[0114] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: after executing the UI test for each tenant respectively, a test report is generated for the execution result of the UI test for each tenant; and the test report is returned to the terminal of each tenant respectively.

[0115] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: tenant attribute information and configuration data sets corresponding to each tenant are maintained in the tenant dimension.

[0116] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0117] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0118] In addition, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the characters in this article generally indicate that the associated objects before and after are in an "or" relationship.

[0119] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A multi-tenant UI testing method, the method comprising: Responding to a UI test request, the UI test request including tenant attribute information of at least one tenant to be tested; According to the attribute information of each tenant, the configuration data set of each tenant is obtained respectively, and according to each configuration data set, the UI test case is accessed respectively for testing; wherein the test script and the interface logic of the UI test case are respectively encapsulated as different functional layers; By calling interfaces between layers, different interface objects in the functional layer corresponding to the interface logic are called based on the differences in the configuration data sets of the tenants to execute the same test script.

2. The method according to claim 1, characterized in that During the execution of the test script, the method further includes: Locate the target element in the UI of each tenant according to the node information defined in the UI test case, and perform the current operation defined in the UI test case on the target element; A corresponding execution waiting time is determined for the current operation according to the operation type of the current operation and the type of the target element, and in response to the execution waiting time expiring, the current operation is terminated and execution of the next operation is started.

3. The method according to claim 2, characterized in that Before ending the current operation and entering the next operation, the method further includes: After the current operation is completed, the execution result of the current operation is verified according to the interface return value and / or prompt box keyword returned after the current operation, and in response to the verification passing, the execution of the next operation is entered.

4. The method according to claim 1, characterized in that: The method further comprises: Monitoring exceptions that occur during the execution of the test script; In response to detecting the occurrence of an exception, a preset exception waiting time is obtained, and after the exception waiting time has elapsed, the test script is re-executed.

5. The method according to claim 1, characterized in that The locating the target element in the UI of each tenant according to the node information defined in the UI test case includes: Using a UI inspection tool to check whether the UI layouts of the multiple tenants are the same; In response to the UI layouts of the plurality of tenants being the same but having different colors or grayscales, an image recognition function encapsulated based on an automated testing framework is enabled to perform image recognition on the UI of each tenant to obtain the node information to locate the target element.

6. The method according to claim 1, characterized in that The method further comprises: After the UI test is performed on each of the tenants respectively, a test report is generated based on the execution result of the UI test of each of the tenants; The test report is returned to each of the tenant's terminals.

7. The method according to claim 1, characterized in that The method further comprises: The tenant attribute information and the configuration data sets corresponding to each tenant are maintained based on the tenant dimension.

8. A multi-tenant UI testing device, characterized in that: The device comprises: A request receiving module, used to respond to a UI test request, wherein the UI test request includes tenant attribute information of multiple tenants to be tested; A use case access module, used to obtain the configuration data set of each tenant according to the attribute information of each tenant, and access the UI test case according to each configuration data set for testing; wherein the test script and interface logic of the UI test case are respectively encapsulated as different functional layers; The use case execution module is used to execute the same test script by calling different element objects in the functional layer corresponding to the interface logic based on the different configuration data sets of each tenant through interface calls between layers.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Method and system for differentiated configuration automatic testing of a multi-bank system

    CN122547700A