Interface data desensitization test method and device, equipment, storage medium and product
Through the automated test platform, the interface data is subjected to hierarchical field matching and testing verification, which solves the problem of low accuracy of interface data desensitization test caused by manual verification in the prior art, and realizes high-accuracy automated testing.
Patent Information
- Application Number
- CN202411704343.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, interface data desensitization testing relies on manual verification, which leads to the problem of verification omissions when processing a large amount of desensitized interface data, resulting in low test accuracy.
Through the automated test platform, the interface to be tested is obtained and the communication connection is established, the data request is sent and the desensitized interface data is received, the field matching and test verification is performed step by step, and the test report is generated.
Automatic desensitization testing of multi-level structural interface data is realized, avoiding the omission of manual verification and improving the accuracy of interface data desensitization testing.
Smart Images

Figure CN119597662A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to interface data desensitization testing methods, devices, equipment, storage media and products. Background Art
[0002] At present, with the rapid development of the software industry, more and more companies are proposing to desensitize internal sensitive data due to the need for data security, such as user names, mobile phone numbers, license plates, addresses, ID numbers, etc. Usually, companies add corresponding desensitization functions during the software development process to desensitize the data under their applications, and the desensitization test of the interface data of software applications is also an indispensable part of the testing process.
[0003] In the related art, data desensitization testing usually relies on testers to verify the desensitized interface data. However, this method requires testers to manually send interface requests and manually verify the returned desensitized interface data. When a large amount of desensitized interface data needs to be processed, manual testing is prone to verification omissions, resulting in low accuracy of interface data desensitization testing.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide an interface data desensitization testing method, aiming to solve the technical problem of low accuracy of interface data desensitization testing.
[0006] To achieve the above purpose, the present application proposes an interface data desensitization test method, the interface data desensitization test method comprising:
[0007] Acquire the interface to be tested, and establish a communication connection with the interface to be tested;
[0008] Sending a data request to the interface to be tested, and receiving desensitized interface data fed back by the interface to be tested;
[0009] Performing field matching on the desensitized interface data layer by layer to obtain the target field, and testing and verifying the field value corresponding to the target field to obtain the target verification result;
[0010] Generate a test report corresponding to the target verification results.
[0011] Optionally, the step of performing field matching on the desensitized interface data layer by layer to obtain a target field, and testing and verifying a field value corresponding to the target field to obtain a target verification result includes:
[0012] Get the field matching script;
[0013] Based on the field matching script, the desensitized interface data is identified by level-by-level classification fields to obtain target classification fields at each level;
[0014] Performing a positioning operation on the parameter fields under the target classification fields of each level to obtain the parameter fields corresponding to the target classification fields of each level, and performing field matching on the parameter fields to obtain the fields to be tested corresponding to the target classification fields of each level;
[0015] The fields to be tested corresponding to the target classification fields of each level are merged into the target field, and the field values corresponding to the target field are tested and verified to obtain the target verification result.
[0016] Optionally, the interface to be tested includes multiple interfaces to be tested, and the step of sending a data request to the interface to be tested and receiving desensitized interface data fed back by the interface to be tested includes:
[0017] Generate a target request configuration corresponding to each of the interfaces to be tested;
[0018] Send a data request corresponding to the target request configuration to each of the interfaces to be tested, and receive the desensitized interface data fed back by the interface to be tested.
[0019] Optionally, the step of generating a target request configuration corresponding to each of the interfaces to be tested includes:
[0020] Obtaining an initial request configuration, wherein the initial request configuration includes an initial header parameter configuration, an initial interface token configuration, and an initial request body parameter configuration;
[0021] Scan each of the interfaces to be tested to obtain interface information of each of the interfaces to be tested;
[0022] Based on the interface information, the initial target request configuration is adjusted to obtain the target header parameter configuration, the target interface token configuration and the target request body parameter configuration corresponding to each of the interfaces to be tested;
[0023] Based on the target header parameter configuration, the target interface token configuration and the target request body parameter configuration, a target request configuration corresponding to each interface to be tested is formed.
[0024] Optionally, the step of performing field matching on the desensitized interface data layer by layer to obtain a target field, and testing and verifying a field value corresponding to the target field to obtain a target verification result includes:
[0025] According to a preset hierarchical order, the classification field of the current level is identified for the desensitized interface data to obtain the target classification field of the current level;
[0026] Performing a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, performing field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and performing a test check on the field value corresponding to the target field to obtain a field check result of the target classification field of the current level;
[0027] According to a preset hierarchical order, the desensitized interface data is subjected to next-level classification field identification to obtain a next-level target classification field;
[0028] Perform a parameter field positioning operation on the target category field of the next level to obtain the corresponding parameter field, and perform field matching on the parameter field to obtain the target field corresponding to the target category field of the current execution order, and perform test verification on the field value corresponding to the target field to obtain the field verification result of the target category field of the current level, until the field value test verification of the target category fields of all levels is completed to obtain the target verification result.
[0029] Optionally, the step of performing a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, performing field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and performing a test check on the field value corresponding to the target field to obtain a field check result of the target classification field of the current level includes:
[0030] According to the preset execution order of the classification fields, a parameter field positioning operation is performed on the target classification field of the current execution order to obtain the corresponding parameter field, and field matching is performed on the parameter field to obtain the target field corresponding to the target classification field of the current execution order, and the field value corresponding to the target field is tested and verified to obtain the field verification result of the target classification field of the current execution order;
[0031] Perform parameter field positioning operation on the target category field of the next execution order to obtain the corresponding parameter field, perform field matching on the parameter field to obtain the target field corresponding to the target category field of the current execution order, perform test verification on the field value corresponding to the target field, and obtain the field verification result, until the field value test verification of the target category fields of the current level is completed, and the field verification result of the target category fields of the current level is obtained.
[0032] In addition, to achieve the above purpose, the present application also proposes an interface data desensitization test device, the interface data desensitization test device comprising:
[0033] An acquisition module, used to acquire the interface to be tested and establish a communication connection with the interface to be tested;
[0034] A receiving module, used for sending a data request to the interface to be tested, and receiving the desensitized interface data fed back by the interface to be tested;
[0035] A matching module is used to perform field matching on the desensitized interface data layer by layer to obtain a target field, and to test and verify the field value corresponding to the target field to obtain a target verification result;
[0036] A generation module is used to generate a test report corresponding to the target verification result.
[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes an interface data desensitization testing device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the interface data desensitization testing method as described above.
[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the interface data desensitization test method described above are implemented.
[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the interface data desensitization testing method described above.
[0040] One or more technical solutions proposed in this application have at least the following technical effects:
[0041] Compared with the data desensitization test in the related art, which usually relies on the tester to verify the desensitized interface data. However, this method requires the tester to manually send an interface request and manually verify the returned desensitized interface data. When a large amount of desensitized interface data is required to be processed, the problem of verification omission is prone to occur in human testing, resulting in low accuracy of interface data desensitization testing. In comparison, this application uses an automated testing platform, after establishing a communication connection with the interface to be tested, sends a data request to the interface to be tested, and receives the desensitized interface data fed back by the interface to be tested, and then performs field matching on the desensitized interface data level by level to obtain the target field, and tests and verifies the field value corresponding to the target field to obtain the target verification result, and finally generates a test report corresponding to the target verification result. It can be understood that the present application utilizes an automated testing platform to perform layer-by-layer field matching and test verification on the interface data of the interface to be tested, i.e., automatically implements data desensitization testing of interface data with a multi-level structure without the need for manual verification by testers, and prevents omissions in the testing of individual interface data in the multi-level structure through layer-by-layer field matching and test verification, thereby improving the accuracy of interface data desensitization testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A flowchart of the first embodiment of the interface data desensitization test method provided in this application;
[0045] Figure 2 A flowchart of the second embodiment of the interface data desensitization test method provided in this application;
[0046] Figure 3 A flowchart diagram of the third embodiment of the interface data desensitization testing method of the present application;
[0047] Figure 4 This is a schematic diagram of the module structure of the interface data desensitization test device according to an embodiment of the present application;
[0048] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the interface data desensitization testing method in the embodiment of the present application.
[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0052] The main solution of the embodiment of the present application is: obtain the interface to be tested and establish a communication connection with the interface to be tested; send a data request to the interface to be tested, and receive the desensitized interface data fed back by the interface to be tested; perform field matching on the desensitized interface data layer by layer to obtain the target field, and test and verify the field value corresponding to the target field to obtain the target verification result; generate a test report corresponding to the target verification result.
[0053] In this embodiment, an automated testing platform is used as the execution entity. For ease of description, it will be referred to as a “testing platform” hereinafter.
[0054] In the related technology, data desensitization testing usually relies on testers to verify the desensitized interface data. However, this method requires testers to manually send interface requests and manually verify the returned desensitized interface data. When a large amount of desensitized interface data needs to be processed, manual testing is prone to verification omissions, resulting in low accuracy of interface data desensitization testing.
[0055] The present application provides a solution to implement desensitization testing of interface data and improve the accuracy of desensitization testing of interface data.
[0056] It can be seen from the above embodiments that the present application uses an automated testing platform to establish a communication connection with the interface to be tested, sends a data request to the interface to be tested, receives the desensitized interface data fed back by the interface to be tested, and then performs field matching on the desensitized interface data level by level to obtain the target field, and performs test verification on the field value corresponding to the target field to obtain the target verification result, and finally generates a test report corresponding to the target verification result. It is understandable that the present application uses an automated testing platform to perform level by level field matching and test verification on the interface data of the interface to be tested, that is, automatically implements data desensitization testing of interface data of a multi-level structure, without the need for manual verification by testers, and prevents the test omission of individual interface data in the interface data of a multi-level structure through level by level field matching and test verification, thereby improving the accuracy of the interface data desensitization test.
[0057] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a terminal system, etc. The following takes the test platform as an example to illustrate this embodiment and the following embodiments.
[0058] Based on this, the present application embodiment provides an interface data desensitization test method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the interface data desensitization testing method of the present application.
[0059] In this embodiment, the interface data desensitization test method includes steps S100 to S400:
[0060] Step S100, obtaining an interface to be tested, and establishing a communication connection with the interface to be tested;
[0061] It should be noted that the interface to be tested refers to the interface of the software component or system that needs to be tested and verified during the interface data desensitization test, including but not limited to API interface, database interface, service interface and third-party integration interface.
[0062] It is understandable that the interface to be tested is specifically one or more interfaces of the desensitized application to be tested after desensitization, wherein the application to be tested after desensitization refers to the application to be tested after the desensitization process, that is, the sensitive data in the application to be tested after desensitization has been desensitized, and the desensitization test of the present application is specifically to test whether the sensitive data after the desensitization process is desensitized according to the preset desensitization rules. It should be noted that in software testing, desensitization generally refers to the process of removing or replacing sensitive data from the test environment to ensure the security and compliance of the test data, specifically through desensitization, to ensure that the test data will not leak any sensitive information, such as personal identity information, financial data, etc., wherein the desensitization process specifically replaces the actual sensitive data with simulated data or pseudo data, which are similar to real data in function and format, but do not contain any real information.
[0063] In a specific implementation, the test platform obtains the interface to be tested by receiving the IP address of the interface to be tested uploaded by the tester; or the device extracts the IP address of the corresponding interface to be tested according to the set application file to be tested, which is not specifically limited here.
[0064] Furthermore, after obtaining the interface to be tested, the test platform establishes a communication connection with the interface to be tested. Specifically, the communication connection between the test platform and the interface to be tested refers to a communication link established between the test platform and the interface of the software system under test. This connection enables the test platform to send requests to the interface to be tested, receive responses, and verify whether the behavior of the interface meets expectations.
[0065] In a specific implementation, the test platform of the present application supports testing multiple interfaces at a time, so the tester can manually add and / or configure multiple interfaces. The test platform obtains multiple interfaces to be tested at a time and establishes communication connections with all interfaces to be tested.
[0066] Step S200, sending a data request to the interface to be tested, and receiving desensitized interface data fed back by the interface to be tested;
[0067] In a specific implementation, after establishing a communication connection with the interface to be tested, the test platform sends a data request to the interface to be tested. After the interface to be tested receives the data request and passes the authentication, the interface data corresponding to the interface is fed back to the test platform, wherein the interface data is the interface data desensitized by the desensitization function of the application, that is, the desensitized interface data. The goal of this application is to use the test platform to implement a desensitization test on the desensitized interface data, that is, to verify whether the desensitized interface data is in accordance with the expected desensitization rules, and replace the actual sensitive data with simulated data or pseudo data. Therefore, the test platform first needs to receive the desensitized interface data fed back by the interface to be tested, and then perform a desensitization test on it.
[0068] Step S300, performing field matching on the desensitized interface data layer by layer to obtain a target field, and testing and verifying the field value corresponding to the target field to obtain a target verification result;
[0069] It should be noted that the interface data structure in the application programming interface design is usually nested or hierarchical, which allows information to be logically grouped and can clearly represent complex relationships and attributes, i.e., multi-level interface data. This application takes into account the complexity of the multi-level interface data, and in order to prevent the omission of the test of individual interface data in the interface data of the multi-level structure, it is proposed that the test platform performs field matching and test verification on the desensitized interface data layer by layer, so as to improve the accuracy of the interface data desensitization test.
[0070] It is understandable that the field matching refers to the operation of ensuring that the data field matches the expected value or pattern during data processing, data verification, search or testing. In this embodiment, the test platform is required to match the sensitive field of the specific desensitized requirement from the desensitized interface data, that is, the target field.
[0071] In the specific implementation, after the test platform matches the target field, it tests and verifies the field value corresponding to the target field to obtain the target verification result. Specifically, the test verification method performed by the test platform on the field value corresponding to the target field includes but is not limited to: 1. Assertion verification, specifically using the assertion method in the automated testing framework, such as the assert statement, to verify whether the text or attribute of the element meets the expected desensitization result; 2. Regular expression matching, specifically using regular expressions to verify whether the text of the element meets the desensitization rules, such as some characters are replaced with asterisks; 3. Attribute verification, specifically checking whether the attribute value of the element meets the desensitization rules, such as whether the data in the data attribute is desensitized; 4. UI automated testing, specifically using the UI automated testing tool to write test scripts, simulate user operations, and verify the performance of desensitized information in different scenarios. Through the above methods, the device can comprehensively verify whether the application meets the expected desensitization rules and security requirements when processing sensitive information. For example, a mobile phone number only displays the first three and last four digits, a two-character name displays the last name, a name with more than three characters displays the first and last one, an ID card displays the first three and last four digits, a VIN code displays the first six and last four digits, an email address displays the first digit and everything after @, a bank card displays the first six and last four digits, etc. It can also be set independently according to the requirements of the company or the security department.
[0072] In the specific implementation, the test platform can set up multiple return fields for a certain interface at a time. Each field corresponds to a desensitization rule. The desensitization rule needs to be set to check the data from the first to the last data of the field that displays *. Regular expressions can be used to implement this. You can also check which data are not *, such as the first character of a 2-character name is not *, and the first and last characters of a 3-character name are not *. The return field can be obtained in multiple levels or using regular expressions.
[0073] In a specific implementation, the test platform performs field matching on the desensitized interface data layer by layer to obtain the target field, and performs test verification on the field value corresponding to the target field to obtain the target verification result, including:
[0074] Obtain a field matching script; based on the field matching script, identify the classification fields of the desensitized interface data layer by layer to obtain the target classification fields of each layer; perform a positioning operation on the parameter fields under the target classification fields of each layer to obtain the parameter fields corresponding to the target classification fields of each layer, perform field matching on the parameter fields to obtain the fields to be tested corresponding to the target classification fields of each layer; merge the fields to be tested corresponding to the target classification fields of each layer into target fields, and test and verify the field values corresponding to the target fields to obtain target verification results.
[0075] It should be noted that the field matching script is a test script used by the test platform for field matching, specifically a series of instructions or codes for automated desensitization testing of interface data, which can be executed by the test tool to verify whether the desensitization function of the software meets expectations, that is, the main purpose of the test script is to ensure that the software can work properly during the development process and after release, and to promptly discover and fix defects. Further, the field matching script can be a recording script or a test case. The present application is preferably a test case, wherein the test case is written by the developer according to the test logic, and the specific test case is a set of well-defined test inputs, execution conditions, test steps and expected results to verify whether a specific part of the software works as expected, that is, the test case is the basic unit in the software testing process, which is used to ensure that the functionality, performance, security and availability of the software product meet the predetermined requirements.
[0076] In a specific implementation, the test platform performs layer-by-layer classification field identification on the desensitized interface data based on the field matching script to obtain the target classification fields of each layer, wherein the layer-by-layer classification field identification refers to the test platform identifying the fields about classification attributes in the interface data of each layer. For example, the desensitized interface data includes: class, Class 3, Grade 7, name, Zhang San, wherein the "class" and "name" fields are both target classification fields, and the "class" field is the target classification field of the first layer, and the "name" field is the target classification field of the second layer.
[0077] Furthermore, as can be seen from the above, each target classification field is followed by one or more parameter fields. The test platform performs field matching on the parameter fields to obtain the fields to be tested corresponding to the target classification fields at each level. The fields to be tested are the fields that require desensitization detection after desensitization. In this embodiment, after all the fields to be tested at each level are successfully matched or / located, the test platform merges the fields to be tested corresponding to the target classification fields at each level into target fields, and then tests and verifies the field values corresponding to the target fields (i.e., all the fields to be tested) to obtain the target verification results.
[0078] Step S400, generating a test report corresponding to the target verification result.
[0079] In the specific implementation, after obtaining the target verification result, the test platform will generate a test report corresponding to the target verification result. Under the report module, you can set the specific sending method to send the report, such as email, etc. Furthermore, the test report contains the total number of test cases, the number of successes, the number of failures, and the specific case execution log. The cause of the error can be determined based on the log to facilitate the modification of the maintenance interface data desensitization test case.
[0080] It is understandable that the test platform of the present application can set multiple triggering modes such as automatic self-execution, scheduled execution, service release trigger execution, etc., so as to ensure the desensitization of sensitive data, reduce the risk of sensitive data leakage, and protect the privacy of enterprises or users.
[0081] Compared with the data desensitization test in the related art, which usually relies on the tester to verify the desensitized interface data. However, this method requires the tester to manually send an interface request and manually verify the returned desensitized interface data. When a large amount of desensitized interface data is required to be processed, the problem of verification omission is prone to occur in human testing, resulting in low accuracy of interface data desensitization testing. In comparison, this application uses an automated testing platform, after establishing a communication connection with the interface to be tested, sends a data request to the interface to be tested, and receives the desensitized interface data fed back by the interface to be tested, and then performs field matching on the desensitized interface data level by level to obtain the target field, and tests and verifies the field value corresponding to the target field to obtain the target verification result, and finally generates a test report corresponding to the target verification result. It can be understood that the present application utilizes an automated testing platform to perform layer-by-layer field matching and test verification on the interface data of the interface to be tested, i.e., automatically implements data desensitization testing of interface data with a multi-level structure without the need for manual verification by testers, and prevents omissions in the testing of individual interface data in the multi-level structure through layer-by-layer field matching and test verification, thereby improving the accuracy of interface data desensitization testing.
[0082] Based on the above first embodiment, the present application also proposes another embodiment, referring to Figure 2 , the interface data desensitization testing method includes:
[0083] In a specific implementation, the test platform sends a data request to the interface to be tested, and receives the desensitized interface data fed back by the interface to be tested, including:
[0084] Step A100, generating a target request configuration corresponding to each of the interfaces to be tested;
[0085] It should be noted that the target request configuration refers to a series of parameters and options that need to be set when the test platform sends an API request to the interface to be tested to ensure that the request can be correctly sent to the server and the expected response can be received. The target request configuration includes but is not limited to HTTP header information, authentication tokens (such as OAuth tokens), data in the request body, etc.
[0086] In the specific implementation, this application proposes that after the test platform obtains the interface to be tested, the target request configuration corresponding to each interface to be tested is automatically generated, rather than manual configuration by the tester, so as to improve the efficiency and accuracy of the interface data desensitization test.
[0087] In a specific implementation, the step of generating a target request configuration corresponding to each interface to be tested by the test platform includes:
[0088] Obtain an initial request configuration, wherein the initial request configuration includes an initial header parameter configuration, an initial interface token configuration, and an initial request body parameter configuration; scan each of the interfaces to be tested to obtain interface information of each of the interfaces to be tested; based on the interface information, adjust the initial target request configuration to obtain a target header parameter configuration, a target interface token configuration, and a target request body parameter configuration corresponding to each of the interfaces to be tested; based on the target header parameter configuration, the target interface token configuration, and the target request body parameter configuration, compose a target request configuration corresponding to each of the interfaces to be tested.
[0089] It should be noted that the initial request configuration refers to the request configuration pre-configured in the relevant database of the test platform. The initial request configuration is a request configuration proposed manually based on experiments or historical data. For multiple and different interfaces to be tested, only minor adjustments need to be made to the initial request configuration. There is no need to reconfigure and fill in the multiple interfaces to be tested from scratch, so as to achieve the generation of the target request configuration, thereby improving the efficiency and accuracy of the interface data desensitization test. Specifically, the test platform makes corresponding configuration adjustments to the initial request configuration including the initial header parameter configuration, the initial interface token configuration and the initial request body parameter configuration based on the interface information of each interface to be tested, and finally obtains the target request configuration including the target header parameter configuration, the target interface token configuration and the target request body parameter configuration.
[0090] Step A200, sending a data request corresponding to the target request configuration to each of the interfaces to be tested, and receiving the desensitized interface data fed back by the interface to be tested.
[0091] In a specific implementation, the test platform sends a data request corresponding to the target request configuration to each interface to be tested, and receives the desensitized interface data fed back by the interface to be tested, that is, this application supports testing multiple interfaces at a time, and multiple interfaces can be added manually, wherein the header parameter settings, token settings, and parameter settings of the request body of the interface request are automatically generated. This part of the setting is mainly because some interfaces have different data fields due to different responses to the request header or request parameters. That is, this application automatically generates the target request configuration corresponding to each interface to be tested, rather than manual configuration by the tester, so as to improve the efficiency and accuracy of the interface data desensitization test.
[0092] Based on the above first and second embodiments, the present application also proposes another embodiment, referring to Figure 3 , the interface data desensitization testing method includes:
[0093] Step B100, according to a preset hierarchical order, the classification field of the current level is identified for the desensitized interface data to obtain the target classification field of the current level;
[0094] Step B200, performing a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, performing field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and performing a test check on the field value corresponding to the target field to obtain a field check result of the target classification field of the current level;
[0095] In a specific implementation, the test platform performs a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, performs field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and performs a test verification on the field value corresponding to the target field to obtain a field verification result of the target classification field of the current level, including:
[0096] According to the preset category field execution order, a parameter field positioning operation is performed on the target category field of the current execution order to obtain the corresponding parameter field, and field matching is performed on the parameter field to obtain the target field corresponding to the target category field of the current execution order, and the field value corresponding to the target field is tested and verified to obtain the field verification result of the target category field of the current execution order; a parameter field positioning operation is performed on the target category field of the next execution order to obtain the corresponding parameter field, and field matching is performed on the parameter field to obtain the target field corresponding to the target category field of the current execution order, and the field value corresponding to the target field is tested and verified to obtain the field verification result, until the target category fields of the current level have all completed the field value testing and verification, and the field verification result of the target category fields of the current level is obtained.
[0097] In a specific implementation, the same level usually involves multiple classification fields. To obtain the target classification field of the current level on the test platform, the parameter field positioning operation is performed on the target classification field of the current execution order according to the preset classification field execution order to obtain the corresponding parameter field, and the parameter field is matched to obtain the target field corresponding to the target classification field of the current execution order. The field value corresponding to the target field is tested and verified to obtain the field verification result of the target classification field of the current execution order. Only after the field verification of all the target classification fields of the current execution order is the field verification of the target classification field of the next execution order performed.
[0098] Step B300, according to a preset hierarchical order, the classification field of the next level is identified for the desensitized interface data to obtain the target classification field of the next level;
[0099] Step B400, performs parameter field positioning operation on the target classification field of the next level to obtain the corresponding parameter field, and performs field matching on the parameter field to obtain the target field corresponding to the target classification field of the current execution order, and performs test verification on the field value corresponding to the target field to obtain the field verification result of the target classification field of the current level, until the target classification fields of all levels complete the field value test verification to obtain the target verification result.
[0100] It should be noted that the hierarchical order is specifically determined according to the hierarchical logic of the interface data. For example, the desensitized interface data includes: class, Class 3, Grade 7, name, Zhang San, where the "class" field is the target classification field of the first level, and the "name" field is the target classification field of the second level. The hierarchical order is the first level, then the second level.
[0101] It is understandable that this method is different from the first embodiment in which all the fields to be tested are matched before testing and verification. In this embodiment, the test platform performs a test and verification on each field to be tested on each level page after matching, and obtains the field verification result of the target classification field of the current level. After the test platform obtains the target classification field of the current level, it performs a parameter field positioning operation on the target classification field of the current level to obtain the corresponding parameter field, and performs field matching on the parameter field to obtain the target field corresponding to the target classification field of the current execution order, and tests and verifies the field value corresponding to the target field to obtain the field verification result of the target classification field of the current level.
[0102] For example, the interface to be tested includes the A1 level and the A2 level, wherein the A1 level is the upper level of the A2 level. In this embodiment, the A1 level is firstly subjected to field matching to obtain the target field X1 and the target field X2 under the A1 level, and then X1 and X2 are tested and verified to obtain the field verification results Y1 and Y2 of the A1 level. After the A1 level is fully verified, the A2 level is entered, and the A2 level is subjected to field matching to obtain the target field X3 and the target field X4 under the A2 level, and then X3 and X4 are tested and verified to obtain the field verification results Y3 and Y4 of the A2 level. In the first embodiment, after all fields X1-X4 are located, the test verification is uniformly performed to obtain the corresponding field verification results Y1-Y4.
[0103] In the specific implementation, the present application utilizes an automated testing platform to perform layer-by-layer field matching and test verification on the interface data of the interface to be tested, that is, to automatically implement data desensitization testing of interface data with a multi-level structure without the need for manual verification by testers, and to prevent omissions in the testing of individual interface data in the interface data with a multi-level structure through layer-by-layer field matching and test verification, thereby improving the accuracy of interface data desensitization testing.
[0104] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the interface data desensitization testing method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0105] This application also provides an interface data desensitization test device, please refer to Figure 4 , the interface data desensitization testing device comprises:
[0106] The acquisition module 10 is used to acquire the interface to be tested and establish a communication connection with the interface to be tested;
[0107] The receiving module 20 is used to send a data request to the interface to be tested, and receive the desensitized interface data fed back by the interface to be tested;
[0108] The matching module 30 is used to perform field matching on the desensitized interface data layer by layer to obtain a target field, and to test and verify the field value corresponding to the target field to obtain a target verification result;
[0109] The generating module 40 is used to generate a test report corresponding to the target verification result.
[0110] Optionally, the matching module 30 includes:
[0111] Script acquisition module, used to obtain field matching scripts;
[0112] An identification module, used to identify the classification fields of the desensitized interface data layer by layer based on the field matching script, and obtain target classification fields of each layer;
[0113] A field matching module is used to perform a positioning operation on the parameter fields under the target classification fields of each level to obtain the parameter fields corresponding to the target classification fields of each level, and to perform field matching on the parameter fields to obtain the fields to be tested corresponding to the target classification fields of each level;
[0114] The verification module is used to merge the fields to be tested corresponding to the target classification fields of each level into target fields, and test and verify the field values corresponding to the target fields to obtain target verification results.
[0115] Optionally, the receiving module 20 includes:
[0116] A generation module, used to generate a target request configuration corresponding to each of the interfaces to be tested;
[0117] The request sending module is used to send a data request corresponding to the target request configuration to each interface to be tested, and receive the desensitized interface data fed back by the interface to be tested.
[0118] Optionally, the generating module includes:
[0119] A configuration acquisition module, used to acquire an initial request configuration, wherein the initial request configuration includes an initial header parameter configuration, an initial interface token configuration, and an initial request body parameter configuration;
[0120] A scanning module, used for scanning each of the interfaces to be tested to obtain interface information of each of the interfaces to be tested;
[0121] An adjustment module, used to adjust the initial target request configuration based on the interface information to obtain a target header parameter configuration, a target interface token configuration, and a target request body parameter configuration corresponding to each of the interfaces to be tested;
[0122] The composition module is used to compose the target request configuration corresponding to each of the interfaces to be tested based on the target header parameter configuration, the target interface token configuration and the target request body parameter configuration.
[0123] Optionally, the matching module 30 further includes:
[0124] A target classification field identification module is used to identify the classification fields of the current level for the desensitized interface data according to a preset hierarchical order to obtain the target classification fields of the current level;
[0125] A positioning module is used to perform a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, and to perform field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and to perform a test verification on the field value corresponding to the target field to obtain a field verification result of the target classification field of the current level;
[0126] A layer-by-layer field identification module is used to identify the classification fields of the next layer on the desensitized interface data according to a preset hierarchical order to obtain the target classification fields of the next layer;
[0127] A circular verification module is used to perform a parameter field positioning operation on the target classification field of the next level to obtain the corresponding parameter field, and perform field matching on the parameter field to obtain the target field corresponding to the target classification field of the current execution order, and perform test verification on the field value corresponding to the target field to obtain the field verification result of the target classification field of the current level, until the field value test verification of the target classification fields of all levels is completed to obtain the target verification result.
[0128] Optionally, the positioning module includes:
[0129] A field positioning module is used to perform a parameter field positioning operation on the target classification field of the current execution order according to a preset classification field execution order, obtain a corresponding parameter field, and perform field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and perform test verification on the field value corresponding to the target field to obtain a field verification result of the target classification field of the current execution order;
[0130] A loop positioning module is used to perform parameter field positioning operations on the target category field of the next execution order, obtain the corresponding parameter field, and perform field matching on the parameter field to obtain the target field corresponding to the target category field of the current execution order, and test and verify the field value corresponding to the target field to obtain the field verification result, until the field value test and verification of the target category fields at the current level are all completed, and the field verification result of the target category fields at the current level is obtained.
[0131] The interface data desensitization test device provided by the present application adopts the interface data desensitization test method in the above embodiment, which can solve the technical problems of the interface data desensitization test. Compared with the prior art, the beneficial effects of the interface data desensitization test device provided by the present application are the same as the beneficial effects of the interface data desensitization test method provided by the above embodiment, and the other technical features in the interface data desensitization test device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0132] The present application provides an interface data desensitization testing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the interface data desensitization testing method in the above-mentioned embodiment one.
[0133] Reference below Figure 5 , which shows a schematic diagram of the structure of an interface data desensitization test device suitable for implementing an embodiment of the present application. The interface data desensitization test device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The interface data desensitization test device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0134] like Figure 5As shown, the interface data desensitization test device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the interface data desensitization test device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the interface data desensitization test device to communicate wirelessly or wired with other devices to exchange data. Although the interface data desensitization test device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0135] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0136] The interface data desensitization test device provided by the present application adopts the interface data desensitization test method in the above embodiment, which can solve the technical problems of the interface data desensitization test. Compared with the prior art, the beneficial effects of the interface data desensitization test device provided by the present application are the same as the beneficial effects of the interface data desensitization test method provided by the above embodiment, and the other technical features in the interface data desensitization test device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0137] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0138] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0139] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the interface data desensitization testing method in the above-mentioned embodiment.
[0140] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0141] The above-mentioned computer-readable storage medium may be included in the interface data desensitization test device; or it may exist independently without being assembled into the interface data desensitization test device.
[0142] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the interface data desensitization testing device, the interface data desensitization testing device performs: interface data desensitization testing.
[0143] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0144] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0145] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0146] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned interface data desensitization test method, and can solve the technical problems of the interface data desensitization test. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the interface data desensitization test method provided in the above-mentioned embodiment, and will not be repeated here.
[0147] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned interface data desensitization testing method when executed by a processor.
[0148] The computer program product provided by this application can solve the technical problem of interface data desensitization testing. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the interface data desensitization testing method provided by the above embodiment, which will not be repeated here.
[0149] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. An interface data desensitization testing method, characterized in that: Applied to the automated testing platform, the method for interface data desensitization testing includes: Acquire the interface to be tested, and establish a communication connection with the interface to be tested; Sending a data request to the interface to be tested, and receiving desensitized interface data fed back by the interface to be tested; Performing field matching on the desensitized interface data layer by layer to obtain the target field, and testing and verifying the field value corresponding to the target field to obtain the target verification result; Generate a test report corresponding to the target verification results.
2. The interface data desensitization testing method according to claim 1, characterized in that: The step of performing level-by-level field matching on the desensitized interface data to obtain a target field, and testing and verifying a field value corresponding to the target field to obtain a target verification result includes: Get the field matching script; Based on the field matching script, the desensitized interface data is identified by level by level of classification fields to obtain target classification fields at each level; Performing a positioning operation on the parameter fields under the target classification fields of each level to obtain the parameter fields corresponding to the target classification fields of each level, and performing field matching on the parameter fields to obtain the fields to be tested corresponding to the target classification fields of each level; The fields to be tested corresponding to the target classification fields of each level are merged into the target field, and the field values corresponding to the target field are tested and verified to obtain the target verification result.
3. The interface data desensitization testing method according to claim 1, characterized in that: The interface to be tested includes multiple interfaces to be tested, and the step of sending a data request to the interface to be tested and receiving desensitized interface data fed back by the interface to be tested includes: Generate a target request configuration corresponding to each of the interfaces to be tested; Send a data request corresponding to the target request configuration to each of the interfaces to be tested, and receive the desensitized interface data fed back by the interface to be tested.
4. The interface data desensitization testing method according to claim 3, characterized in that: The step of generating a target request configuration corresponding to each of the interfaces to be tested includes: Obtaining an initial request configuration, wherein the initial request configuration includes an initial header parameter configuration, an initial interface token configuration, and an initial request body parameter configuration; Scan each of the interfaces to be tested to obtain interface information of each of the interfaces to be tested; Based on the interface information, the initial target request configuration is adjusted to obtain the target header parameter configuration, the target interface token configuration and the target request body parameter configuration corresponding to each of the interfaces to be tested; Based on the target header parameter configuration, the target interface token configuration and the target request body parameter configuration, a target request configuration corresponding to each interface to be tested is formed.
5. The interface data desensitization testing method according to claim 1, characterized in that: The step of performing level-by-level field matching on the desensitized interface data to obtain a target field, and testing and verifying a field value corresponding to the target field to obtain a target verification result includes: According to a preset hierarchical order, the classification field of the current level is identified for the desensitized interface data to obtain the target classification field of the current level; Performing a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, performing field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and performing a test check on the field value corresponding to the target field to obtain a field check result of the target classification field of the current level; According to a preset hierarchical order, the desensitized interface data is subjected to next-level classification field identification to obtain a next-level target classification field; Perform a parameter field positioning operation on the target category field of the next level to obtain the corresponding parameter field, and perform field matching on the parameter field to obtain the target field corresponding to the target category field of the current execution order, and perform test verification on the field value corresponding to the target field to obtain the field verification result of the target category field of the current level, until the field value test verification of the target category fields of all levels is completed to obtain the target verification result.
6. The interface data desensitization testing method according to claim 5, characterized in that: The step of performing a parameter field positioning operation on the target classification field of the current level to obtain a corresponding parameter field, performing field matching on the parameter field to obtain a target field corresponding to the target classification field of the current execution order, and performing a test check on the field value corresponding to the target field to obtain a field check result of the target classification field of the current level includes: According to the preset execution order of the classification fields, a parameter field positioning operation is performed on the target classification field of the current execution order to obtain the corresponding parameter field, and field matching is performed on the parameter field to obtain the target field corresponding to the target classification field of the current execution order, and the field value corresponding to the target field is tested and verified to obtain the field verification result of the target classification field of the current execution order; Perform parameter field positioning operation on the target category field of the next execution order to obtain the corresponding parameter field, perform field matching on the parameter field to obtain the target field corresponding to the target category field of the current execution order, perform test verification on the field value corresponding to the target field, and obtain the field verification result, until the field value test verification of the target category fields of the current level is completed, and the field verification result of the target category fields of the current level is obtained.
7. An interface data desensitization testing device, characterized in that: The device comprises: An acquisition module, used to acquire the interface to be tested and establish a communication connection with the interface to be tested; A receiving module, used for sending a data request to the interface to be tested, and receiving the desensitized interface data fed back by the interface to be tested; A matching module is used to perform field matching on the desensitized interface data layer by layer to obtain a target field, and to test and verify the field value corresponding to the target field to obtain a target verification result; A generation module is used to generate a test report corresponding to the target verification result.
8. An interface data desensitization test device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the interface data desensitization testing method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the interface data desensitization testing method as described in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the interface data desensitization testing method as claimed in any one of claims 1 to 6 are implemented.