Travel saas platform-oriented multi-tenant data permission test method and device
By forming a data pool according to the tenant dimension in the travel SaaS platform, collecting interface information and performing tests in batches, the data security problem of multi-tenant data isolation regression test is solved, efficient data isolation verification and leakage prevention are achieved, and testing efficiency is improved.
Patent Information
- Application Number
- CN202510463725.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-08-15
AI Technical Summary
In multi-tenant SaaS platform, data isolation regression testing is difficult to ensure data security and privacy, especially in travel SaaS platform, data permission control of user information is easily affected by code updates and there is a risk of data leakage.
By collecting data according to the tenant dimension, forming a data pool, collecting interface information related to data isolation, creating a data isolation test set, and batch executing interface calls through multi-threading methods, applying verification rules to verify the test results, and judging the execution results of tenant data isolation.
It realizes the efficiency of multi-tenant data isolation regression testing, can identify and prevent data leakage, ensure user data security, improve the efficiency of data isolation regression testing, and supports the horizontal scaling of data isolation verification.
Smart Images

Figure CN120493255A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data isolation technology, and more specifically, to a method and device for multi-tenant data permission testing on a travel SaaS platform. Background Art
[0002] In a multi-tenant SaaS platform, all tenants share the same set of applications and infrastructure. This sharing model presents many challenges, especially in mobility SaaS platforms, where user personal information, travel history, payment information, and other sensitive data are crucial. Therefore, ensuring data security and privacy is crucial. Strict data permission management must be implemented to ensure that each tenant's data is technically isolated and cannot be accessed by other tenants.
[0003] Data permission control is mainly isolated at the code level, which means that each tenant's data access rights need to be carefully managed in the application code. However, with the continuous updates of the application and changes to the code, this data permission control may be affected. For example, if the data isolation rules are not strictly followed when the code is updated, there is a risk of data leakage. To deal with this situation, regression testing has become a necessary means to ensure data isolation capabilities. Regression testing refers to re-running previous test cases after the system or code is changed to verify whether the system's functions and performance still meet expectations and ensure that the new changes have not destroyed the original functions. In order to ensure the most basic data isolation capabilities of the SaaS platform, regression testing must be performed on this part to ensure that user data is not leaked. Summary of the Invention
[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a method and device for multi-tenant data permission testing on a travel SaaS platform to solve the problems raised in the above-mentioned background technology.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for testing multi-tenant data permissions on a travel SaaS platform, specifically comprising the following steps:
[0006] Step S1: Collect data by tenant dimension. For each tenant, extract the corresponding data from the database to form a data pool and manage basic configuration information.
[0007] Step S2: Collect interface information related to data isolation and create a data isolation test set;
[0008] Step S3: Execute the data isolation test set in batches according to the tenant configuration information, and implement batch interface calls in a multi-threaded manner;
[0009] Step S4: Based on the test set execution results and the tenant data set in the data pool, apply the verification rules to verify the test results and determine whether the tenant data isolation execution results are passed.
[0010] In a preferred embodiment, in step S1, data is extracted from the database according to the tenant dimension, a data pool for each tenant is established, and configuration information is managed. The specific steps are as follows:
[0011] Step A1: Create a tenant table and a data pool table, and establish an association between the tenant table and the data pool table so that data can be extracted from the data pool for each tenant. The tenant table is used to store the tenant ID and tenant name; the data pool table is used to store the configuration information of each tenant's data pool, including the data pool name, data source, and data storage location.
[0012] Step A2, data pool establishment: Use the database query language to select the required tenant information from the tenant table, select the corresponding tenant data pool configuration information from the data pool table based on the tenant ID, and create a data pool for each tenant based on the extracted data pool configuration information;
[0013] Step A3, Configuration Management: Provide a configuration management interface to enable tenants to manage the configuration information of the data pool, including modifying the data pool name, data source, and storage location configuration parameters.
[0014] In a preferred embodiment, in step S2, interface information related to data isolation is collected and a data isolation test set is created. Data isolation refers to isolating different data elements in a database and data processing system to prevent them from interfering with each other. The specific steps are as follows:
[0015] Step B1, Document Review: List all interfaces involved in data isolation, including data query, update, and delete operations, and check the interface documentation to confirm whether each interface supports tenant information transmission and verify the implementation details of the isolation policy;
[0016] Step B2, Test Set Definition: Analyze the interface data model to ensure that the tenant identification field is correctly configured and used. Based on the interface functionality and data isolation requirements, define the test set, including data scenarios and expected results for different tenants.
[0017] Step B3, Create a test set: Create specific test cases for each interface, including normal and abnormal situations, to ensure comprehensive testing of data isolation effects. Configure test data for multiple tenants in the test environment to ensure the effectiveness of the data isolation test set.
[0018] In a preferred embodiment, in step S3, data isolation test sets are executed in batches according to tenant configuration information, and batch interface calls are implemented in a multi-threaded manner. The specific steps are as follows:
[0019] Step C1: Read configuration information: Read the tenant's configuration information from the configuration file, including the tenant ID and related parameters. Based on the configuration information, set up an independent test environment for each tenant. Prepare the corresponding test cases and request data based on the data isolation test set.
[0020] Step C2, create a thread pool: Initialize the multi-threaded environment, set an appropriate thread pool size to balance concurrency and resource consumption, and assign test cases to threads in the thread pool. Each thread is responsible for executing a group of test cases.
[0021] Step C3, execute the test: start the thread pool, execute batch interface calls, ensure that each thread makes interface calls according to the tenant configuration information, and after the test execution is completed, summarize and analyze the test results of each thread, and record the success and failure of the test.
[0022] In a preferred embodiment, in step S4, based on the test set execution result and the tenant data set in the data pool, the verification rules are applied to verify the test result to determine whether the tenant data isolation execution result passes. The specific steps are as follows:
[0023] Step D1, Get Test Results: Collect the test results for each tenant from the test execution in step C3, including the success and failure of the operation, data comparison results, and exception information. Extract the corresponding data set from the data pool based on the tenant ID to ensure that the data pool contains all data corresponding to the test set;
[0024] Step D2, result verification: Apply the inspection rules, compare the actual test results with the expected results, confirm whether the data isolation meets the requirements, and after the test is completed, clean up the test environment to ensure that there is no residual data that affects subsequent tests. It further includes the following steps:
[0025] Step D201: Define verification rules: The verification rules include data consistency check, data integrity check, and data access control check. The data consistency check verifies whether the test set data is consistent with the tenant data set. The data integrity check verifies that there is no data from other tenants in the test results. The data access control check verifies that there is no data leakage or cross-tenant data access during the test process.
[0026] Step D202: Determine whether data isolation passes: traverse each verification rule, check the match between the test set results and the tenant data set according to the rule, and record the check results of each rule. If all verification rules pass, the data isolation verification is considered to have passed. If any verification rule fails, the data isolation verification is considered to have failed, and a detailed error message is generated, including the failed rule and the reason.
[0027] Step D3: Summarize verification results: Summarize the verification results of all tenants and generate a final test report. The test report contains each tenant's isolated test results, error information, and recommended improvement measures. The test report is stored in the database and sent to relevant personnel so that the problem can be reproduced and repaired.
[0028] This application also provides a device for multi-tenant data permission testing on a travel SaaS platform, which specifically includes a tenant configuration module, a test set management module, an execution module, and a result verification module;
[0029] Tenant configuration module: collects data by tenant dimension, extracts corresponding data from the database for each tenant, forms a data pool, and manages basic configuration information;
[0030] Test set management module: collects interface information related to data isolation and creates data isolation test sets;
[0031] Execution module: executes data isolation test sets in batches according to tenant configuration information, and implements batch interface calls through multi-threading;
[0032] Result verification module: Based on the test set execution results and the tenant data set in the data pool, the verification rules are applied to verify the test results to determine whether the tenant data isolation execution results are passed.
[0033] The beneficial effects of the present invention are: extracting tenant data from the database to form a data pool, and managing basic configuration information; creating a data isolation test set by collecting interface information related to data isolation; batch executing the data isolation test set according to tenant configuration information; realizing batch interface calls in a multi-threaded manner; applying inspection rules to verify the test results according to the test set execution results and the tenant data set in the data pool, and judging whether the tenant data isolation execution results are passed; a method and device for multi-tenant data permission testing on a travel SaaS platform can well cope with multi-tenant data isolation regression testing under the SaaS model, and realizes the ability of a set of data isolation sets to support multi-tenant regression testing; and when a new tenant joins, only the basic tenant information and the corresponding data set need to be added to realize data isolation regression testing; through permission testing of multiple tenants, it can effectively identify and prevent data leakage and cross-border access of permissions, ensure the security of user data, and support horizontal expansion of data isolation verification by defining different inspection rules, which greatly improves the efficiency of data isolation regression testing on the SaaS platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a flow chart of the method of the present invention;
[0035] Figure 2 It is a structural block diagram of the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0037] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the described features. In the description of this application, "plurality" means two or more, unless otherwise specifically specified.
[0038] In the description of this application, the term "for example" is used to mean "used as an example, illustration or explanation". Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any person skilled in the art to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art will recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.
[0039] Example 1
[0040] This embodiment provides Figure 1 A method for testing multi-tenant data permissions on a travel SaaS platform is shown, specifically including the following steps:
[0041] Step S1: Collect data by tenant dimension. For each tenant, extract the corresponding data from the database to form a data pool and manage basic configuration information.
[0042] Step S2: Collect interface information related to data isolation and create a data isolation test set;
[0043] Step S3: Execute the data isolation test set in batches according to the tenant configuration information, and implement batch interface calls in a multi-threaded manner;
[0044] Step S4: Based on the test set execution results and the tenant data set in the data pool, apply the verification rules to verify the test results and determine whether the tenant data isolation execution results are passed.
[0045] Preferably, in step S1, data is extracted from the database according to tenant dimensions, a data pool for each tenant is established, and configuration information is managed. The specific steps are as follows:
[0046] Step A1: Create a tenant table and a data pool table, and establish an association between the tenant table and the data pool table so that data can be extracted from the data pool for each tenant. The tenant table is used to store the tenant ID and tenant name; the data pool table is used to store the configuration information of each tenant's data pool, including the data pool name, data source, and data storage location.
[0047] Step A2, Data Pool Creation: Use the database query language to select the required tenant information from the tenant table. Based on the tenant ID, select the corresponding tenant data pool configuration information from the data pool table. Create a data pool for each tenant based on the extracted data pool configuration information. By creating an independent data pool for each tenant, the data of different tenants can be effectively isolated, improving data security and reducing the risk of data leakage.
[0048] Step A3, Configuration Management: Provide a configuration management interface so that tenants can manage the configuration information of the data pool, including modifying the data pool name, data source, and storage location configuration parameters. By centrally managing configuration information, the configuration update and change process can be simplified, making it easier to quickly respond to the needs of each tenant.
[0049] Preferably, in step S2, interface information related to data isolation is collected and a data isolation test set is created. When a problem occurs, the data isolation test set can quickly identify the scope of the problem, which helps troubleshooting and repair. Data isolation refers to isolating different data elements in the database and data processing system to prevent them from interfering with each other. The specific steps are as follows:
[0050] Step B1, Document Review: List all interfaces involved in data isolation, including data query, update, and delete operations, and check the interface documentation to confirm whether each interface supports tenant information transmission and verify the implementation details of the isolation policy;
[0051] Step B2, Test Set Definition: Analyze the interface data model to ensure that the tenant identification field is correctly configured and used. Based on the interface functionality and data isolation requirements, define the test set, including data scenarios and expected results for different tenants.
[0052] Step B3, Create Test Set: Create specific test cases for each interface, including normal and abnormal situations, to ensure comprehensive testing of data isolation. Configure test data for multiple tenants in the test environment to ensure the effectiveness of the data isolation test set. By confirming the isolation of data operations between different tenants, user confusion caused by data interference is reduced, and the user experience is improved.
[0053] Preferably, in step S3, data isolation test sets are executed in batches according to tenant configuration information, and batch interface calls are implemented in a multi-threaded manner. The specific steps are as follows:
[0054] Step C1: Read configuration information: Read the tenant's configuration information from the configuration file, including the tenant ID and related parameters. Based on the configuration information, set up an independent test environment for each tenant. Prepare the corresponding test cases and request data based on the data isolation test set.
[0055] Step C2: Create a thread pool: Initialize the multi-threaded environment, set an appropriate thread pool size to balance concurrency and resource consumption, and assign test cases to threads in the thread pool. Each thread is responsible for executing a group of test cases. Through batch execution, test results can be obtained quickly, facilitating timely identification and repair of problems, and improving the feedback speed of development and testing.
[0056] Step C3, execute the test: start the thread pool, execute batch interface calls, ensure that each thread makes interface calls according to the tenant configuration information, and after the test execution is completed, summarize and analyze the test results of each thread, and record the success and failure of the test.
[0057] Preferably, in step S4, based on the test set execution result and the tenant data set in the data pool, the verification rules are applied to verify the test result to determine whether the tenant data isolation execution result passes. When the test result fails, the verification rules can help quickly locate the problem, facilitate rapid implementation of repair measures, and reduce the difficulty of troubleshooting. The specific steps are as follows:
[0058] Step D1, Get Test Results: Collect the test results for each tenant from the test execution in step C3, including the success and failure of the operation, data comparison results, and exception information. Extract the corresponding data set from the data pool based on the tenant ID to ensure that the data pool contains all data corresponding to the test set;
[0059] Step D2, result verification: Apply the inspection rules, compare the actual test results with the expected results, confirm whether the data isolation meets the requirements, and after the test is completed, clean up the test environment to ensure that there is no residual data that affects subsequent tests. It further includes the following steps:
[0060] Step D201: Define verification rules: The verification rules include data consistency check, data integrity check, and data access control check. The data consistency check verifies whether the test set data is consistent with the tenant data set. The data integrity check verifies that there is no data from other tenants in the test results. The data access control check verifies that there is no data leakage or cross-tenant data access during the test process.
[0061] Step D202: Determine whether data isolation passes: traverse each verification rule, check the match between the test set results and the tenant data set according to the rule, and record the check results of each rule. If all verification rules pass, the data isolation verification is considered to have passed. If any verification rule fails, the data isolation verification is considered to have failed, and a detailed error message is generated, including the failed rule and the reason.
[0062] Step D3: Summarize verification results: Summarize the verification results of all tenants and generate a final test report. The test report contains each tenant's isolated test results, error information, and recommended improvement measures. The test report is stored in the database and sent to relevant personnel so that the problem can be reproduced and repaired.
[0063] Example 2
[0064] This embodiment provides a device for multi-tenant data permission testing on a travel SaaS platform, specifically including a tenant configuration module, a test set management module, an execution module, and a result verification module;
[0065] Tenant configuration module: collects data by tenant dimension, extracts corresponding data from the database for each tenant, forms a data pool, and manages basic configuration information;
[0066] Test set management module: collects interface information related to data isolation and creates data isolation test sets;
[0067] Execution module: executes data isolation test sets in batches according to tenant configuration information, and implements batch interface calls through multi-threading;
[0068] Result verification module: Based on the test set execution results and the tenant data set in the data pool, the verification rules are applied to verify the test results to determine whether the tenant data isolation execution results are passed.
[0069] It should be noted that, in the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0070] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0071] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0072] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0073] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0074] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0075] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A method for multi-tenant data permission testing on a travel SaaS platform, characterized in that: The specific steps include: Step S1: Collect data by tenant dimension. For each tenant, extract the corresponding data from the database to form a data pool and manage basic configuration information. Step S2: Collect interface information related to data isolation and create a data isolation test set; Step S3: Execute the data isolation test set in batches according to the tenant configuration information, and implement batch interface calls in a multi-threaded manner; Step S4: Based on the test set execution results and the tenant data set in the data pool, apply the verification rules to verify the test results and determine whether the tenant data isolation execution results are passed.
2. The method for multi-tenant data permission testing for a travel SaaS platform according to claim 1 is characterized by: In step S1, data is extracted from the database according to the tenant dimension, a data pool for each tenant is established, and configuration information is managed. The specific steps are as follows: Step A1: Create a tenant table and a data pool table, and establish a relationship between the tenant table and the data pool table so that data can be extracted from the data pool for each tenant. Step A2, data pool establishment: Use the database query language to select the required tenant information from the tenant table, select the corresponding tenant data pool configuration information from the data pool table based on the tenant ID, and create a data pool for each tenant based on the extracted data pool configuration information; Step A3, Configuration Management: Provide a configuration management interface to enable tenants to manage the configuration information of the data pool, including modifying the data pool name, data source, and storage location configuration parameters.
3. The method for multi-tenant data permission testing for a travel SaaS platform according to claim 2, characterized in that: The tenant table is used to store tenant IDs and tenant names, and the data pool table is used to store configuration information of each tenant's data pool, including data pool name, data source, and data storage location.
4. The method for multi-tenant data permission testing for a travel SaaS platform according to claim 3 is characterized by: In step S2, interface information related to data isolation is collected and a data isolation test set is created. The specific steps are as follows: Step B1, Document Review: List all interfaces involved in data isolation, including data query, update, and delete operations, and check the interface documentation to confirm whether each interface supports tenant information transmission and verify the implementation details of the isolation policy; Step B2, Test Set Definition: Analyze the interface data model to ensure that the tenant identification field is correctly configured and used. Based on the interface functionality and data isolation requirements, define the test set, including data scenarios and expected results for different tenants. Step B3, Create a test suite: Create specific test cases for each interface, including normal and abnormal conditions, and configure test data for multiple tenants in the test environment.
5. The method for multi-tenant data permission testing for a travel SaaS platform according to claim 4 is characterized by: In step S3, data isolation test sets are executed in batches according to tenant configuration information, and batch interface calls are implemented in a multi-threaded manner. The specific steps are as follows: Step C1: Read configuration information: Read the tenant's configuration information from the configuration file, including the tenant ID and related parameters. Based on the configuration information, set up an independent test environment for each tenant. Prepare the corresponding test cases and request data based on the data isolation test set. Step C2, create a thread pool: Initialize the multi-threaded environment, set an appropriate thread pool size to balance concurrency and resource consumption, and assign test cases to threads in the thread pool. Each thread is responsible for executing a group of test cases. Step C3, execute the test: start the thread pool, execute batch interface calls, and after the test execution is completed, summarize and analyze the test results of each thread, and record the success and failure of the test.
6. The method for multi-tenant data permission testing for a travel SaaS platform according to claim 5, characterized in that: In step S4, based on the test set execution results and the tenant data set in the data pool, the verification rules are applied to verify the test results and determine whether the tenant data isolation execution results pass. The specific steps are as follows: Step D1, obtain test results: Collect the test results of each tenant from the test executed in step C3, including the success and failure of the operation, data comparison results, and exception information. Extract the corresponding data set from the data pool based on the tenant ID; Step D2, result verification: Apply the inspection rules, compare the actual test results with the expected results, confirm whether the data isolation meets the requirements, and clean up the test environment after completing the test. Step D3: Summarize verification results: Summarize the verification results of all tenants and generate a final test report. The test report contains each tenant's isolated test results, error information, and recommended improvement measures. The test report is stored in the database and sent to relevant personnel so that the problem can be reproduced and repaired.
7. The method for multi-tenant data permission testing for a travel SaaS platform according to claim 6, characterized in that: In the result verification of step D2, the test rules are applied to compare the actual test results with the expected results to confirm whether the data isolation meets the requirements, which further includes the following steps: Step D201, defining verification rules: the verification rules include data consistency check, data integrity check and data access control check; Step D202, determine whether data isolation passes: traverse each verification rule, check the matching of the test set results and the tenant data set according to the rules, and record the inspection results of each rule. When all verification rules pass, the data isolation verification is judged to pass; when any verification rule fails, the data isolation verification is judged to fail, and a detailed error message is generated, including the failed rules and their reasons.
8. A device for testing multi-tenant data permissions on a travel SaaS platform is applied to a method for testing multi-tenant data permissions on a travel SaaS platform as described in any one of claims 1 to 7, characterized in that: Includes tenant configuration module, test set management module, execution module, and result verification module; Tenant configuration module: collects data by tenant dimension, extracts corresponding data from the database for each tenant, forms a data pool, and manages basic configuration information; Test set management module: collects interface information related to data isolation and creates data isolation test sets; Execution module: executes data isolation test sets in batches according to tenant configuration information, and implements batch interface calls through multi-threading; Result verification module: Based on the test set execution results and the tenant data set in the data pool, the verification rules are applied to verify the test results to determine whether the tenant data isolation execution results are passed.