CN116680203B - Multi-tenant-oriented SaaS platform testing method, device, equipment and medium - Google Patents

Multi-tenant-oriented SaaS platform testing method, device, equipment and medium Download PDF

Info

Publication number
CN116680203B
CN116680203B CN202310967085.XA CN202310967085A CN116680203B CN 116680203 B CN116680203 B CN 116680203B CN 202310967085 A CN202310967085 A CN 202310967085A CN 116680203 B CN116680203 B CN 116680203B
Authority
CN
China
Prior art keywords
information
http
tenant
http interface
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310967085.XA
Other languages
Chinese (zh)
Other versions
CN116680203A (en
Inventor
于志杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Bailong Mayun Technology Co ltd
Original Assignee
Beijing Bailong Mayun Technology Co ltd
Filing date
Publication date
Application filed by Beijing Bailong Mayun Technology Co ltd filed Critical Beijing Bailong Mayun Technology Co ltd
Priority to CN202310967085.XA priority Critical patent/CN116680203B/en
Publication of CN116680203A publication Critical patent/CN116680203A/en
Application granted granted Critical
Publication of CN116680203B publication Critical patent/CN116680203B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The application relates to a test method, a test device, test equipment and test media for a multi-tenant-oriented SaaS platform. The method comprises the following steps: receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform; acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable; acquiring the value of each variable from configuration data created in advance for tenant information; assembling the http request according to the http interface information and the values of the variables; the assembled http request is sent to a SaaS platform, and a return result is obtained; and determining a test result corresponding to the current test scene according to the returned result. By adopting the method, the test corresponding to the multi-tenant can be tested in one test scene, and the test efficiency is improved.

Description

Multi-tenant-oriented SaaS platform testing method, device, equipment and medium
Technical Field
The application relates to the technical field of data processing, in particular to a test method, a test device, test equipment and test media for a multi-tenant SaaS platform.
Background
The SaaS (Software as a service) platform is a system for serving a plurality of companies, wherein a company renting system is a tenant, a set of SasS travel systems has a plurality of tenants, data among the tenants are isolated, and each tenant can configure data according to own requirements, so that the data of each tenant system is different, and the testing difficulty and the complexity of a tester are caused.
Constructing a test scenario set based on the traditional TestNG (Next Generation Testing, next generation test technology) framework requires that the testers must use Java and that there is extremely high code writing capability, and that the testers using Java are few in the market at the present time, and the recruitment of enterprises is difficult. Based on the fact that the online automation platform on the market has no tenant concept, one set of scene sets are only suitable for testing of single tenants, and the same scene set cannot switch tenant operation.
Therefore, the conventional method has a problem of low test efficiency.
Disclosure of Invention
Based on this, it is necessary to provide a test method, device, equipment and medium for a multi-tenant-oriented SaaS platform for the above technical problems.
A test method of a multi-tenant-oriented SaaS platform comprises the following steps:
receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform;
acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable;
Acquiring the value of each variable from configuration data created in advance for tenant information;
assembling the http request according to the http interface information and the values of the variables;
the assembled http request is sent to a SaaS platform, and a return result is obtained;
and determining a test result corresponding to the current test scene according to the returned result.
In one embodiment, the method further comprises:
extracting each placeholder in the http interface information;
Determining each variable in the http interface information according to each placeholder;
The assembling of the http request according to the http interface information and the values of the variables includes:
And replacing each placeholder in the http interface information with the value of each variable to assemble the http request.
In one embodiment, the http interface information includes information of a plurality of http interfaces, the http interface information includes a dependency relationship between the http interfaces, and the assembling the http request according to the http interface information and the values of the variables includes:
determining the last http interface of the current http interface according to the dependency relationship;
Acquiring a return result corresponding to the last http interface;
Determining the parameter of the current http interface according to the dependency relationship and the return result corresponding to the last http interface;
and assembling the http request corresponding to the current http interface according to the parameters of the current http interface and the values of the variables in the current http interface.
In one embodiment, the method further comprises:
receiving a scene arrangement request of a current test scene;
extracting the information of each target http interface in the scene arrangement request and the dependency relationship among each target http interface;
according to the information of each target http interface and the dependency relationship among each target http interface, determining the http interface information of the current test scene;
and storing the http interface information of the current test scene in association with the current test scene so as to arrange the current test scene.
In one embodiment, the http request further carries environment information, the configuration data created in advance for the tenant information includes configuration data corresponding to the environment information, the configuration data includes key value pairs matched with the tenant information and the environment information, and the obtaining the value of each variable from the configuration data created in advance for the tenant information includes:
And acquiring values corresponding to the key names matched with the variables according to the key values corresponding to the tenant information and the environment information, and obtaining the values of the variables.
In one embodiment, the method further comprises:
Receiving a new http request corresponding to the current test scene, wherein the new http request carries new tenant information of the SaaS platform;
And returning to the step of acquiring the http interface information configured for the current test scene information in advance by using the new tenant information.
In one embodiment, the method further comprises:
receiving a new adding request for target tenant information;
Extracting a new key value pair in the new adding request;
and creating new configuration data according to the target tenant information and the new key value pair.
A testing device of a multi-tenant-oriented SaaS platform comprises:
The receiving module is used for receiving an http request, wherein the http request is a request for testing the current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform;
The first acquisition module is used for acquiring http interface information which is configured for the current test scene information in advance, wherein the http interface information comprises at least one variable;
The second acquisition module is used for acquiring the values of all variables from configuration data created in advance for tenant information;
the assembly module is used for assembling the http request according to the http interface information and the values of the variables;
The sending module is used for sending the assembled http request to the SaaS platform and obtaining a return result;
And the determining module is used for determining a test result corresponding to the current test scene according to the returned result.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform;
acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable;
Acquiring the value of each variable from configuration data created in advance for tenant information;
assembling the http request according to the http interface information and the values of the variables;
the assembled http request is sent to a SaaS platform, and a return result is obtained;
and determining a test result corresponding to the current test scene according to the returned result.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform;
acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable;
Acquiring the value of each variable from configuration data created in advance for tenant information;
assembling the http request according to the http interface information and the values of the variables;
the assembled http request is sent to a SaaS platform, and a return result is obtained;
and determining a test result corresponding to the current test scene according to the returned result.
According to the testing method, device, equipment and medium of the multi-tenant-oriented SaaS platform, the http interfaces can be defined for all testing scenes, the defined interfaces comprise the variables, the values of the variables are different, and the http requests obtained by subsequent assembly based on the variables are different. Meanwhile, the value of the variable depends on the configuration data of tenant information, if the tenant information is different, the configuration data is different, the value of the variable is different, and the http request obtained by subsequent assembly based on the variable is different. In the same test scene, when the tenant needs to be switched, a user can carry the tenant information after switching in the request to initiate the request. Therefore, the value of the variable in the http interface corresponding to the test scene can be changed along with the change of the tenant, when the test scene is unchanged and the user switches the tenant, the application can determine the value of the variable in the http interface based on the configuration data of the new tenant, thereby assembling a new http request, realizing that the same test scene can switch the operation of the tenant, realizing the test corresponding to the test scene for testing the multi-tenant, and improving the test efficiency.
Drawings
FIG. 1 is an application environment diagram of a test method of a multi-tenant-oriented SaaS platform in one embodiment;
FIG. 2 is a flow chart of a test method of a multi-tenant-oriented SaaS platform in one embodiment;
FIG. 3 is a functional block diagram of a test method of a multi-tenant oriented SaaS platform in one embodiment;
FIG. 4 is a schematic diagram illustrating the content of interface information when defining an http interface in one embodiment;
FIG. 5 is a schematic diagram illustrating an operation sequence of each http interface in the current test scenario in one embodiment;
FIG. 6 is a flow diagram of a test method of a multi-tenant-oriented SaaS platform in one embodiment;
FIG. 7 is a block diagram of a testing device of the multi-tenant-oriented SaaS platform in one embodiment;
fig. 8 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Referring to fig. 1, fig. 1 is an application environment schematic diagram of a testing method of a multi-tenant-oriented SaaS platform according to an exemplary embodiment of the present application. As shown in fig. 1, the application environment includes a server 100 and a terminal 101, and the server 100 and the terminal 101 may be connected in a communication manner through a network 102, so as to implement the testing method of the multi-tenant-oriented SaaS platform of the present application.
The server 100 is configured to receive an http request, where the http request is a request for testing a current test scenario in the SaaS platform, and the http request carries tenant information of the SaaS platform; acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable; acquiring the value of each variable from configuration data created in advance for tenant information; assembling the http request according to the http interface information and the values of the variables; the assembled http request is sent to a SaaS platform, and a return result is obtained; and according to the returned result, determining a test result corresponding to the current test scene, and sending the test result to the terminal 101 for display.
The server 100 may be implemented as a stand-alone server or as a server cluster including a plurality of servers.
The terminal 101 is configured to receive and display the test result sent by the server 100. The terminal 101 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
Network 102 is used to implement a network connection between terminal 101 and server 100. In particular, network 102 may comprise various types of wired or wireless networks.
In one embodiment, as shown in fig. 2, a testing method for a multi-tenant-oriented SaaS platform is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
s11, receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform.
In the application, the SaaS platform is a system for serving a plurality of companies, wherein the company renting system is a tenant, a set of SaaS system has a plurality of tenants, data among the tenants are isolated, and each tenant can configure data according to own requirements, so that the data of each tenant system is different, and when the SaaS system is tested, the test is required to be carried out on different tenant data under different scenes. In the conventional scheme, the test of the same scene is only applicable to one tenant, and when the tenant is switched, the code corresponding to the test scene needs to be changed, so that the test efficiency is low.
In the application, the current test scene refers to one of the test scenes in the SaaS platform. The test scenario may be, for example, a specific test scenario for filling data, a specific test scenario for auditing data, and a test scenario for filling data plus auditing data. The former is a simple scene, and filling data and auditing data can be understood as a complex scene obtained by combining a plurality of simple scenes. Most of the test scenes in the application refer to complex test scenes, and simple test scenes are not excluded.
The http request refers to a request message from a client to a server. The tenant information refers to information of an enterprise renting the SaaS platform. The tenant information here may include information such as identification information, name, account number, and the like of the tenant.
S12, acquiring http interface information which is preset for the current test scene information, wherein the http interface information comprises at least one variable.
In the present application, the http interface information refers to information related to an http interface. In particular, the http interface information here may include a domain name, a path, a request body, a request header, and the like. The path is unchanged, and the variable content corresponding to the variable is present in other parts, and is changed along with the change of the variable value. Thus, the http interface information can be correspondingly changed by modifying the content of the variable.
Specifically, the application introduces the http interface information configured by the interface for the current test scene information. For example, the terminal provides an interface for introducing an interface through which a user can introduce. The http interface is referenced in the scene without redefining the http interface, the http interface which is created in advance can be selected, and a user can fill in a new request body and a new request head in the scene.
In the application, a plurality of http interfaces are pre-created for application. The plurality of http interfaces may be applied by a plurality of scenes. Illustratively, http interfaces 1,2,3, and 4 are created in advance. Scenario a may apply interfaces 1,2 and 3, scenario B may apply interfaces 2,3 and 4, scenario C may refer to interfaces 1,2 and 4, etc. The user selects the http interface referenced by each test scene, and after the server is submitted by the terminal, the server is equivalent to storing the relation between each test scene and the http interface information.
S13, acquiring the value of each variable from configuration data created in advance for tenant information.
In the present application, the configuration data refers to configuration data associated with the tenant information. The configuration data includes a plurality of key value pairs, and each key value pair includes a key name and a corresponding value.
The application matches the variable in the http interface information with the key name in the key value pair in the configuration data, and when the matching is consistent, or the value corresponding to the key name is used as the value of the variable.
In the application, the server creates configuration data corresponding to each tenant information in advance. Specifically, tenant information corresponds to configuration data one by one. The configuration data corresponding to each tenant information comprises at least one key value pair. When the server extracts the tenant information in the http request, further acquiring configuration data matched with the tenant information, and acquiring the value of the variable from the acquired configuration data.
S14, assembling the http request according to the http interface information and the values of the variables.
In the application, the above assembling refers to assembling the http request into a okhttp required format according to the obtained http interface information and the values of the variables in the http interface information, and then initiating the call through okhttp to take the returned result. Okhttp is a mainstream high performance network framework. Other frameworks for initiating network calls may also be utilized with the present application, and okhttp may be optional.
S15, sending the assembled http request to the SaaS platform, and acquiring a return result.
In the application, after receiving the http request, the SaaS platform returns a corresponding result in response to the request. When interface information of a plurality of http interfaces is related in the current test scene, returning a return value of each interface in the return result.
S16, determining a test result corresponding to the current test scene according to the returned result.
In the application, according to the returned result, determining the test result corresponding to the current test scene can specifically include checking the returned result to obtain a check result, and when the check is successful, determining that the current test of the current test scene is successful, otherwise, determining that the test is failed.
Specifically, when the returned result is checked, the database query can be performed on the returned value in the returned result, and when the query result is that the returned value exists, the check is determined to be successful, otherwise, the check is failed.
In one embodiment, a target value is set as the assertion result for each test, the returned result is compared with the target value, if the returned result is consistent with the target value, the test is successful, and if the returned result is not consistent with the target value, the test is failed.
In one embodiment, the method may further include:
extracting each placeholder in the http interface information;
Determining each variable in the http interface information according to each placeholder;
Assembling the http request according to the http interface information and the value of each variable, including:
And replacing each placeholder in the http interface information with the value of each variable to assemble the http request.
In the present application, the placeholders described above may be used in the format ""Fill out as placeholders to corresponding locations" means using values in the configuration data described above, e.g. "/>"Means to use the value of the key" driver_host "in the configuration space.
According to placeholders'And if the name of the variable can be determined to be driver_host, finding a value corresponding to the key name of the driver_host in the corresponding deconfiguration data as the value of the variable.
Further, when the http request is assembled, the placeholders in the http interface information are replaced by the values of the variables obtained from the configuration data.
For example, when the variable name of the variable is driver_host obtained from the http interface information, searching the key name of driver_host from the configuration data corresponding to the tenant information, further obtaining a value corresponding to the key name, and replacing the placeholder' in the http interface information with the value "", To enable assembly of http.
According to the application, the placeholder in the http interface information is replaced by the value of the key value pair in the configuration data corresponding to the tenant information, so that the value of the http interface changes along with the change of the tenant information, the http request can change along with the change of the tenant information, when the tenant information is switched, the value of the corresponding variable can be obtained from the configuration data of the new tenant information to assemble the http request, the http request of the current test scene also changes along with the value of the corresponding variable, the whole set of codes of the test scene is not required to be modified, and the situation that one scene can test multiple tenants is realized.
In one embodiment, the http interface information includes information of a plurality of http interfaces, the http interface information includes a dependency relationship between the http interfaces, and the assembling the http request according to the http interface information and the values of the variables includes:
determining the last http interface of the current http interface according to the dependency relationship;
Acquiring a return result corresponding to the last http interface;
Determining the parameter of the current http interface according to the dependency relationship and the return result corresponding to the last http interface;
and assembling the http request corresponding to the current http interface according to the parameters of the current http interface and the values of the variables in the current http interface.
In the application, when the current test scene comprises a plurality of http interfaces, the http interface information corresponding to the current test scene can contain the dependency relationship among the http interfaces besides the domain name, the request path, the request head and the request body. The above-mentioned dependency relationship means that if the http interface of a certain step needs the return value of the previous http interface, then there is a dependency relationship between the two interfaces. Specifically, the dependency relationship herein may include a running sequence between two http interfaces, and may further include a dependency field between an upstream interface (running a preceding http interface) and a downstream interface (running a following http interface). The above return value of the previous http interface is used as the reference of the current http interface, where the return value is the above dependency field.
Specifically, determining the parameter of the current http interface according to the dependency relationship and the returned result corresponding to the last http interface may include:
Extracting the value of the dependent field in the returned result corresponding to the last http interface according to the dependent field in the dependent relation, and taking the value as the parameter of the current http interface.
In the application, one test scene can be a complex scene formed by combining a plurality of small scenes. The application combines http interfaces with upstream and downstream dependency relations in advance to form a more complex test scene.
When the current test scene contains a plurality of http interfaces, the server calls all the http interfaces in the test scene and the dependency relationship among the http interfaces, assembles http requests corresponding to the http interfaces once according to the dependency relationship among the http interfaces, reports the http requests to the SaaS platform to obtain corresponding return results, further determines test results corresponding to the return results, and sequentially operates the http interfaces in the current test scene by pushing the http requests to obtain final test results.
In one embodiment, the method may further include:
receiving a scene arrangement request of a current test scene;
extracting the information of each target http interface in the scene arrangement request and the dependency relationship among each target http interface;
according to the information of each target http interface and the dependency relationship among each target http interface, determining the http interface information of the current test scene;
and storing the http interface information of the current test scene in association with the current test scene so as to arrange the current test scene.
In the present application, the above-mentioned scene arrangement means to combine a plurality of simple scenes into one complex scene. The server performs scene arrangement on each test scene in advance, the purpose of the scene arrangement is to pre-configure scene arrangement data corresponding to each test scene, the scene arrangement data are equivalent to the http interface information of the current test scene, and after arrangement, the server stores each test scene in association with the corresponding scene arrangement data so as to facilitate subsequent calling.
The above-mentioned target http interface refers to an interface that needs to be introduced by a scene. The server correspondingly stores each target http interface with the dependency relationship and the dependency field so as to sequentially operate according to the dependency relationship when each http interface is operated subsequently.
In a possible embodiment, an input box for the user to input the dependency relationship is provided on the user's terminal interface. In the input box the user can enter an identification of the step, e.g. step ID1, and the value of which field in the returned result of the step is passed as an entry into the current step. For example, the user inputs "ID1" in the input box of step \number, "data.item [1]. OrderId" in the input box of type-acquisition target value, and "orderId" in the input box of backfill position-banned target value.
The subsequent server obtains the value of data.item [1] orderId in the returned result of the step with ID 1 as the tragic value to be transmitted to the participating orderId of the current step.
According to the method and the device, the arrangement of the complex scene can be realized, and the test of coping with the complex scene is realized.
In one embodiment, the http request further carries environment information, the configuration data created in advance for the tenant information includes configuration data corresponding to the environment information, the configuration data includes key value pairs matched with the tenant information and the environment information, and the obtaining the value of each variable from the configuration data created in advance for the tenant information may include:
And acquiring values corresponding to the key names matched with the variables according to the key values corresponding to the tenant information and the environment information, and obtaining the values of the variables.
In the present application, the above-mentioned environmental information refers to a stage of software update of the SaaS platform. For example, the environment information herein may include a development environment, a test environment, a prefire environment, a gray scale environment, and a generation environment.
Specifically, the server configures corresponding configuration data for each tenant information and environment information in advance, and stores the configuration data in a configuration space. In one possible embodiment, please refer to the following table 1, table 1 is a configuration data table in a configuration space.
TABLE 1
As shown in table 1, the configuration data in the configuration space includes configuration data corresponding to at least one piece of tenant information, and table 1 illustrates that the configuration data includes configuration data corresponding to tenant information 1 and tenant information 2, it can be understood that actually, the configuration data may also include configuration data corresponding to more pieces of tenant information, which is not limited herein specifically. Similarly, the tenant information 1 includes configuration data corresponding to the environment information 1 and the environment information 2, and it is understood that in practice, the tenant information 1 may also include configuration data corresponding to more environment information, which is not specifically limited herein. Similarly, the environment information 1 corresponds to the existence of the key-value pairs 1,2, and 3. In another embodiment, more key-value pairs may exist for the context information 1.
Referring to table 2 below, table 2 is a table of relationships between the current test scenario and the http interface and variables in one embodiment.
TABLE 2
Current test scenario Http interface 1 Http interface 2 Http interface 3
Variable 1 Variable 4 Variable 7
Variable 2 Variable 5 Variable 8
Variable 3 Variable 6 Variable 9
As shown in table 2, the current test scenario includes three http interfaces, and each http interface includes three variables. The server may obtain the variable names of the variables in the three interfaces. If the tenant information in the current test is tenant information 1, matching the corresponding key name from the key value pair in the configuration data corresponding to tenant information 1 year old, further obtaining the value of the key name, and obtaining the value corresponding to each variable in the three interfaces to replace the placeholders in the interface information of the three http interfaces.
Further, as can be seen from the above tables 1 and 2, there is a certain correspondence between the test scenario, the tenant information, and the environment information. Referring to table 3 below, table 3 is an association table among test scenarios, tenant information and environment information in an embodiment.
TABLE 3 Table 3
As shown in table 3, one test scenario may correspond to a plurality of tenant information and a plurality of environment information. That is, each http interface information in one test scene can be changed to enable the value of the variable to be matched with the configuration data corresponding to the tenant information, so that the interface of one test scene can test multiple tenants and multiple environments, and the test efficiency is improved.
In one embodiment, the method may further include:
Receiving a new http request corresponding to the current test scene, wherein the new http request carries new tenant information of the SaaS platform;
and returning to the step of acquiring the http interface information configured for the current test scene information in advance by using the new tenant information.
In the application, the new http request is used for testing new tenant system data on the SaaS platform in the current test scene. In the application, the SaaS platform serves the systems of a plurality of companies, the company renting system is the tenant, the SaaS platform has a plurality of tenants, the data among the tenants are isolated, and each tenant can configure the data according to the own requirement, so the data of each tenant system is different. However, the application can switch tenant information to test under the same test scene, when new tenant information is switched and the test scene is unchanged, the server can acquire new configuration data based on the new tenant information, acquire values matched with variables in the new http request from the new configuration data, and assemble the new http request based on the acquired values so as to call the SaaS service to complete the test request of the current test scene under the condition of the new tenant information.
According to the embodiment of the application, a set of test scene sets (which can be regarded as the test codes corresponding to the set of test scenes) can switch the operation of tenants and environments, so that a set of scene sets is used for testing multiple tenants and multiple environments.
In one embodiment, the method may further include:
receiving a new adding request for target tenant information;
Extracting a new key value pair in the new adding request;
and creating new configuration data according to the target tenant information and the new key value pair.
In the application, the configuration data user in the configuration space can define key value pairs, the configuration space is used for storing variables in the scene set, and each key value pair is associated with environment information and tenant information. The configuration data described above may support pairs of addable, removable, and modifiable keys.
In one embodiment, the method may further include:
And receiving a deletion or modification request of the tenant information, and correspondingly modifying or deleting the configuration data corresponding to the existing tenant information.
In one embodiment, the method may further include:
and receiving a deleting or modifying request for a certain target key value pair in the tenant information, and correspondingly modifying or deleting the target key value pair in the configuration data corresponding to the tenant information.
In one embodiment, the method may further include:
And receiving a request for adding a target key value pair to the tenant information, and correspondingly adding the target key value pair into configuration data corresponding to the tenant information.
The configuration data in the application can be flexibly added, deleted and modified into the key value pairs, the flexibility of the implementation scheme is realized, and the implementation scheme can cope with more complex test scenes.
In one embodiment, the determining, according to the returned result, the test result corresponding to the current test scenario may include:
Determining a test result corresponding to the last http interface in the current test scene according to a return result corresponding to the last http interface;
The method further comprises the following steps:
when the test result corresponding to the last http interface is successful, executing the step of determining the last http interface of the current http interface according to the dependency relationship;
and when the test result corresponding to the last http interface is a test failure, generating prompt information and feeding back the prompt information to the corresponding terminal.
In the application, when each http interface in the current test scene is operated, the return value of each http interface is checked in sequence, and when the check is passed, the next http interface is operated in sequence until all the http interfaces are operated. When the verification of the returned result of one http interface is unsuccessful, a prompt message of test failure is generated, the flow is ended, and the prompt message can comprise specific failure reasons, such as abnormal audit data, and the like. If all the http interface bacteria are operated and the corresponding returned results are checked successfully, generating prompt information of successful operation of the test.
According to the method and the device, the result of each testing step in the testing process and the final total result can be prompted through the embodiment, so that related testers can be prompted to change software of the SaaS platform.
Referring to fig. 3, fig. 3 is a schematic block diagram of a testing method of a multi-tenant-oriented SaaS platform according to an embodiment of the present application.
In fig. 3, the server obtains configuration data and scene layout data in the cache and database. The configuration data is only the tenant information carried in the http request and the configuration data corresponding to the environment information. The scene layout data refers to preset interface information of http interfaces referenced by each test scene, and dependency relationships and dependency fields between the http interfaces.
Further, the server assembles the http request according to the configuration data and the scene arrangement data, and calls the assembled http request through okhttp to return a result.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating the content of interface information when an http interface is defined in an embodiment. In fig. 4, the information of the http interface includes a path, a domain name, a request header, and a request header.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an operation sequence of each http interface in the current test scenario in an embodiment. As shown in fig. 5, the return value of the http interface 1 is used as the entry parameter of the http interface 2, the return value of the http interface 2 is checked through database query, and when the check passes, the return value of the http interface 2 is used as the entry parameter of the http interface 3, and the http interface 3 is continuously operated.
Referring to fig. 6, fig. 6 is a flow chart of a testing method of a multi-tenant-oriented SaaS platform in an embodiment. As shown in fig. 6, the testing method of the multi-tenant-oriented SaaS platform may include:
according to tenant information and environment information, configuration data and scene arrangement data are searched from a database;
extracting the value of a variable in the http interface information from the configuration data;
replacing placeholders in the http interface information according to the values of the variables;
And sequentially operating each http interface according to the scene arrangement data, assembling http requests corresponding to each http interface, and calling SaaS service through okhttp to complete the test requests.
In one possible application scenario, the early conception of the testing method of the multi-tenant-oriented SaaS platform of the present application may include the following steps:
The first determination platform is used by the tester in what way. In order to reduce the complexity of platform use, users can log in for use without installing any software on the PC end and using a browser, the technology development should be used, the server end is developed by using Java language, and the front end is developed by using Vue.
A second determines the form of the user entered data. json is a well-known data format that is approved by most testers. The http request comprises a request path, a request body and a request head. The request path and the request head user prompt input according to the input box. The request body data adopts json format data.
The third determination system has a function. An automation platform capable of coping with multi-tenant, multi-environment and complex scenarios is constructed with the following functions: configuration space management, interface entry, scene orchestration management, etc.
Specifically, the test method of the multi-tenant-oriented SaaS platform of the present application may have the following functions:
1, a user can customize key value pairs in a configuration space, the configuration space is used for storing variables in a scene set, and each key value pair is associated with an environment and a tenant. The user can add, delete, and modify key pairs.
2, In the interface input function, the user can define an http request interface in the automation platform. An http request comprises four parts of a domain name, a request path, a request header and a request body. The four parts of content can then be changed according to tenant and environment changes, but not one, the variable values in the configuration space are needed to be used, and the format of the user can be used as'"Fill out as placeholders to corresponding locations, means using values in configuration space, e.g."/>"Means to use the value of the key" driver_host "in the configuration space. When a user initiates an http request, an environment and a tenant are selected, an air filtering key value pair is configured according to the tenant and the environment, and a key value pair use value is found to replace "/>"Such that the value of the interface changes with tenant and environment changes.
And 3, in the scene arrangement function, interfaces with upstream and downstream dependency relationships are combined together by a user to form a scene. Scene composition should have the following functions.
A) And customizing the plug-in. In the scene, a user needs to not only combine interfaces but also query a database, a log and other systems, and needs to define plugins, and the user inputs a simple json query related system.
B) An interface is introduced. The http interface is referenced in the scene without redefining the http interface, the http interface is selected to be created, the user can fill in a new request body and a new request head in the scene, and if a variable value is still used'"As placeholders".
C) Editing and taking a value. An http interface entry at a step may require a return value from the previous http interface. The steps of filling in the dependencies, returning the values of which fields of the result are required. The program sequence execution is executed from upside down. The front interface can take a value after the front interface is operated.
And 4, determining a framework for initiating network call. okhttp is a mainstream high performance network framework.
5, Realizing the replacement of placeholders, and acquiring 'based on regular expression book'And (3) the key name in the' and then searching for the value corresponding to the key according to the tenant and the environment to finish replacement.
In one embodiment, as shown in fig. 7, a testing apparatus of a multi-tenant-oriented SaaS platform is provided, including: a receiving module 11, a first acquiring module 12, a second acquiring module 13, an assembling module 14, a transmitting module 15 and a determining module 16, wherein:
The receiving module 11 is configured to receive an http request, where the http request is a request for testing a current test scenario in the SaaS platform, and the http request carries tenant information of the SaaS platform;
The first obtaining module 12 is configured to obtain http interface information configured for current test scene information in advance, where the http interface information includes at least one variable;
A second obtaining module 13, configured to obtain values of variables from configuration data created in advance for tenant information;
The assembling module 14 is used for assembling the http request according to the http interface information and the values of the variables;
the sending module 15 is configured to send the assembled http request to the SaaS platform, and obtain a return result;
And the determining module 16 is configured to determine a test result corresponding to the current test scenario according to the returned result.
In one embodiment, the assembling module 14 may extract each placeholder in the http interface information, and determine each variable in the http interface information according to each placeholder; the assembling module 14 may also replace each placeholder in the http interface information with a value of each variable to assemble the http request.
In one embodiment, the above-mentioned http interface information includes information of a plurality of http interfaces, where the above-mentioned http interface information includes a dependency relationship between each http interface, and the above-mentioned assembly module 14 may further determine a last http interface of the current http interface according to the dependency relationship, obtain a return result corresponding to the last http interface, determine an entry parameter of the current http interface according to the dependency relationship and the return result corresponding to the last http interface, and assemble an http request corresponding to the current http interface according to the entry parameter of the current http interface and the value of each variable in the current http interface.
In one embodiment, the apparatus further includes a scene arrangement module (not shown), and the arrangement module may receive a scene arrangement request of the current test scene, extract each target http interface information and a dependency relationship between each target http interface in the scene arrangement request, determine the http interface information of the current test scene according to each target http interface information and the dependency relationship between each target http interface, and store the http interface information of the current test scene in association with the current test scene, so as to arrange the current test scene.
In one embodiment, the http request further carries environment information, the configuration data created in advance for the tenant information includes configuration data corresponding to the environment information, the configuration data includes key value pairs matched with the tenant information and the environment information, and the second obtaining module 13 may obtain, according to the key values corresponding to the tenant information and the environment information, a value corresponding to a key name matched with each variable, and obtain a value of each variable.
In one embodiment, the apparatus further includes a switching module (not shown), where the switching module may receive a new http request corresponding to the current test scenario, where the new http request carries new tenant information of the SaaS platform, and returns, with the new tenant information, to the step of obtaining the http interface information configured in advance for the current test scenario information.
In one embodiment, the apparatus further includes a new adding module (not shown), and the new adding module may receive a new adding request for the target tenant information, extract a new key value pair in the new adding request, and create new configuration data according to the target tenant information and the new key value pair.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 8. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as operation data of the intelligent household equipment. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by the processor, implements a test method for a multi-tenant-oriented SaaS platform.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program: receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform; acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable; acquiring the value of each variable from configuration data created in advance for tenant information; assembling the http request according to the http interface information and the values of the variables; the assembled http request is sent to a SaaS platform, and a return result is obtained; and determining a test result corresponding to the current test scene according to the returned result.
In one embodiment, the processor, when executing the computer program, specifically further implements the steps of:
extracting each placeholder in the http interface information;
Determining each variable in the http interface information according to each placeholder;
when the processor executes the computer program to realize the assembling step of the http request according to the http interface information and the values of the variables, the following steps are specifically realized:
And replacing each placeholder in the http interface information with the value of each variable to assemble the http request.
In one embodiment, the http interface information includes information of a plurality of http interfaces, the http interface information includes a dependency relationship between the http interfaces, and the processor executes a computer program to implement the assembling of the http request according to the http interface information and the values of the variables, and specifically implement the following steps:
determining the last http interface of the current http interface according to the dependency relationship;
Acquiring a return result corresponding to the last http interface;
Determining the parameter of the current http interface according to the dependency relationship and the return result corresponding to the last http interface;
and assembling the http request corresponding to the current http interface according to the parameters of the current http interface and the values of the variables in the current http interface.
In one embodiment, the following steps are embodied when the processor executes a computer program:
receiving a scene arrangement request of a current test scene;
extracting the information of each target http interface in the scene arrangement request and the dependency relationship among each target http interface;
according to the information of each target http interface and the dependency relationship among each target http interface, determining the http interface information of the current test scene;
and storing the http interface information of the current test scene in association with the current test scene so as to arrange the current test scene.
In one embodiment, the http request further carries environment information, the configuration data created in advance for the tenant information includes configuration data corresponding to the environment information, the configuration data includes key value pairs matched with the tenant information and the environment information, and when the processor executes the computer program to implement the step of obtaining the values of the variables from the configuration data created in advance for the tenant information, the specific implementation further includes the following steps:
And acquiring values corresponding to the key names matched with the variables according to the key values corresponding to the tenant information and the environment information, and obtaining the values of the variables.
In one embodiment, the following steps are embodied when the processor executes a computer program:
Receiving a new http request corresponding to the current test scene, wherein the new http request carries new tenant information of the SaaS platform;
and returning to the step of acquiring the http interface information configured for the current test scene information in advance by using the new tenant information.
In one embodiment, the following steps are embodied when the processor executes a computer program:
receiving a new adding request for target tenant information;
Extracting a new key value pair in the new adding request;
and creating new configuration data according to the target tenant information and the new key value pair.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving an http request, wherein the http request is a request for testing a current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform; acquiring http interface information which is preset for current test scene information, wherein the http interface information comprises at least one variable; acquiring the value of each variable from configuration data created in advance for tenant information; assembling the http request according to the http interface information and the values of the variables; the assembled http request is sent to a SaaS platform, and a return result is obtained; and determining a test result corresponding to the current test scene according to the returned result.
In one embodiment, the computer program when executed by the processor, specifically further performs the steps of:
extracting each placeholder in the http interface information;
Determining each variable in the http interface information according to each placeholder;
when the computer program is executed by the processor to realize the assembling step of the http request according to the http interface information and the values of the variables, the following steps are specifically realized:
And replacing each placeholder in the http interface information with the value of each variable to assemble the http request.
In one embodiment, the http interface information includes information of a plurality of http interfaces, the http interface information includes a dependency relationship between the http interfaces, and the computer program is executed by the processor to implement the assembling of the http request according to the http interface information and the values of the variables, and specifically implement the following steps:
determining the last http interface of the current http interface according to the dependency relationship;
Acquiring a return result corresponding to the last http interface;
Determining the parameter of the current http interface according to the dependency relationship and the return result corresponding to the last http interface;
and assembling the http request corresponding to the current http interface according to the parameters of the current http interface and the values of the variables in the current http interface.
In one embodiment, the computer program, when executed by a processor, performs the steps of:
receiving a scene arrangement request of a current test scene;
extracting the information of each target http interface in the scene arrangement request and the dependency relationship among each target http interface;
according to the information of each target http interface and the dependency relationship among each target http interface, determining the http interface information of the current test scene;
and storing the http interface information of the current test scene in association with the current test scene so as to arrange the current test scene.
In one embodiment, the http request further carries environment information, the configuration data created in advance for the tenant information includes configuration data corresponding to the environment information, the configuration data includes key value pairs matched with the tenant information and the environment information, and when the computer program is executed by the processor to implement the step of obtaining the value of each variable from the configuration data created in advance for the tenant information, the specific implementation further includes the following steps:
And acquiring values corresponding to the key names matched with the variables according to the key values corresponding to the tenant information and the environment information, and obtaining the values of the variables.
In one embodiment, the computer program, when executed by a processor, performs the steps of:
Receiving a new http request corresponding to the current test scene, wherein the new http request carries new tenant information of the SaaS platform;
and returning to the step of acquiring the http interface information configured for the current test scene information in advance by using the new tenant information.
In one embodiment, the computer program, when executed by a processor, performs the steps of:
receiving a new adding request for target tenant information;
Extracting a new key value pair in the new adding request;
and creating new configuration data according to the target tenant information and the new key value pair.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile 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. By way of illustration and not limitation, RAM is available in a variety of 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), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (8)

1. The test method of the multi-tenant-oriented SaaS platform is characterized by comprising the following steps of:
receiving an http request, wherein the http request is a request for testing a current test scene in a SaaS platform, and the http request carries tenant information of the SaaS platform;
acquiring http interface information configured for the current test scene information in advance, wherein the http interface information comprises at least one variable;
Extracting each placeholder in the http interface information;
Determining each variable in the http interface information according to each placeholder;
acquiring the value of each variable from configuration data created in advance for the tenant information;
Replacing each placeholder in the http interface information with the value of each variable to assemble the http request;
Sending the assembled http request to the SaaS platform, and acquiring a return result;
determining a test result corresponding to the current test scene according to the return result;
Receiving a new http request corresponding to the current test scene, wherein the new http request carries new tenant information of the SaaS platform;
And returning the new tenant information to the step of acquiring the http interface information configured for the current test scene information in advance.
2. The method according to claim 1, wherein the http interface information includes information of a plurality of http interfaces, the http interface information includes a dependency relationship between the http interfaces, and the assembling the http request according to the http interface information and the value of each variable includes:
determining the last http interface of the current http interface according to the dependency relationship;
Acquiring a return result corresponding to the last http interface;
Determining the parameter entry of the current http interface according to the dependency relationship and the return result corresponding to the last http interface;
and assembling the http request corresponding to the current http interface according to the parameters of the current http interface and the values of the variables in the current http interface.
3. The method according to claim 2, wherein the method further comprises:
receiving a scene arrangement request of a current test scene;
Extracting information of each target http interface and a dependency relationship among each target http interface in the scene arrangement request;
Determining the http interface information of the current test scene according to the target http interface information and the dependency relationship between the target http interfaces;
And carrying out association storage on the http interface information of the current test scene and the current test scene so as to arrange the current test scene.
4. The method according to claim 1, wherein the http request further carries environment information, the configuration data created in advance for the tenant information includes configuration data corresponding to the environment information, the configuration data includes key value pairs matched with the tenant information and the environment information, and the obtaining the value of each variable from the configuration data created in advance for the tenant information includes:
And acquiring values corresponding to the key names matched with the variables according to the key values corresponding to the tenant information and the environment information, and acquiring the values of the variables.
5. The method according to claim 4, wherein the method further comprises:
receiving a new adding request for target tenant information;
Extracting a new key value pair in the new addition request;
And creating new configuration data according to the target tenant information and the new key value pair.
6. A testing device for a multi-tenant-oriented SaaS platform, the device comprising:
The receiving module is used for receiving an http request, wherein the http request is a request for testing the current test scene in the SaaS platform, and the http request carries tenant information of the SaaS platform;
The first acquisition module is used for acquiring http interface information configured for the current test scene information in advance, wherein the http interface information comprises at least one variable;
the second acquisition module is used for extracting each placeholder in the http interface information, determining each variable in the http interface information according to each placeholder, and acquiring each variable from configuration data created in advance for the tenant information;
The assembling module is used for replacing each placeholder in the http interface information with the value of each variable so as to assemble the http request;
the sending module is used for sending the assembled http request to the SaaS platform and obtaining a return result;
The determining module is configured to determine a test result corresponding to the current test scene according to the return result, receive a new http request corresponding to the current test scene, where the new http request carries new tenant information of the SaaS platform, and return the step of obtaining the http interface information configured for the current test scene information in advance with the new tenant information.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 5 when the computer program is executed by the processor.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
CN202310967085.XA 2023-08-02 Multi-tenant-oriented SaaS platform testing method, device, equipment and medium Active CN116680203B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310967085.XA CN116680203B (en) 2023-08-02 Multi-tenant-oriented SaaS platform testing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310967085.XA CN116680203B (en) 2023-08-02 Multi-tenant-oriented SaaS platform testing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN116680203A CN116680203A (en) 2023-09-01
CN116680203B true CN116680203B (en) 2024-05-03

Family

ID=

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108990047A (en) * 2018-07-03 2018-12-11 中国联合网络通信集团有限公司 Test method, device and the medium of contract signing relationship management data preparation platform
CN112052182A (en) * 2020-09-27 2020-12-08 平安信托有限责任公司 Interface automation test method and device, computer equipment and storage medium
CN112860451A (en) * 2021-01-21 2021-05-28 中国建设银行股份有限公司 Multi-tenant data processing method and device based on SaaS
CN113779444A (en) * 2021-11-12 2021-12-10 北京宇信科技集团股份有限公司 Interface development method, zero code engine and zero code data interface development system
CN114238085A (en) * 2021-11-30 2022-03-25 企查查科技有限公司 Interface testing method and device, computer equipment and storage medium
CN114816676A (en) * 2022-05-27 2022-07-29 中国建设银行股份有限公司 System and method for realizing multi-tenant deployment of low code development platform

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108990047A (en) * 2018-07-03 2018-12-11 中国联合网络通信集团有限公司 Test method, device and the medium of contract signing relationship management data preparation platform
CN112052182A (en) * 2020-09-27 2020-12-08 平安信托有限责任公司 Interface automation test method and device, computer equipment and storage medium
CN112860451A (en) * 2021-01-21 2021-05-28 中国建设银行股份有限公司 Multi-tenant data processing method and device based on SaaS
CN113779444A (en) * 2021-11-12 2021-12-10 北京宇信科技集团股份有限公司 Interface development method, zero code engine and zero code data interface development system
CN114238085A (en) * 2021-11-30 2022-03-25 企查查科技有限公司 Interface testing method and device, computer equipment and storage medium
CN114816676A (en) * 2022-05-27 2022-07-29 中国建设银行股份有限公司 System and method for realizing multi-tenant deployment of low code development platform

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN110290212B (en) Service call recording method, device, computer equipment and storage medium
WO2021042914A1 (en) Test data generation method and apparatus, computer device and storage medium
CN111563051B (en) Crawler-based data verification method and device, computer equipment and storage medium
CN110688598B (en) Service parameter acquisition method and device, computer equipment and storage medium
CN109361628B (en) Message assembling method and device, computer equipment and storage medium
CN110109712A (en) Service Component loading method, device, computer equipment and storage medium
CN112286934A (en) Database table importing method, device, equipment and medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN114168190A (en) Interface document generation method and device, computer equipment and storage medium
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN110275703B (en) Method and device for assigning key value to data, computer equipment and storage medium
CN115617780A (en) Data import method, device, equipment and storage medium
CN112395182A (en) Automatic testing method, device, equipment and computer readable storage medium
CN110119277A (en) Data sharing method, device, computer equipment and storage medium
CN116680203B (en) Multi-tenant-oriented SaaS platform testing method, device, equipment and medium
CN116680203A (en) Multi-tenant-oriented SaaS platform testing method, device, equipment and medium
CN109240906B (en) Database configuration information adaptation method and device, computer equipment and storage medium
CN115705297A (en) Code call detection method, device, computer equipment and storage medium
CN114371866A (en) Version reconfiguration test method, device and equipment of service system
CN112800127A (en) Data mining analysis method and device based on transaction bill
CN111966506A (en) Content sharing method based on different application programs and computer equipment
CN117234512B (en) Method, system, electronic equipment and storage medium for rapidly developing business
CN114595159B (en) Test data generation method, device, equipment and storage medium
CN110321284B (en) Test data entry method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant