Traffic playback test method, device, equipment and medium based on desensitized logs
The rule engine is used to simulate, restore and filter sensitive information in desensitized logs, which solves the problem of data filtering caused by sensitive information in production logs, improves the accuracy and efficiency of traffic playback testing, and achieves efficient processing of production logs. use.
Patent Information
- Application Number
- CN202211519522.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-11-30
AI Technical Summary
In the traffic playback test based on desensitized logs, there were many interface packets involving sensitive information in the production logs, resulting in a large amount of data being filtered out, and the production logs could not be fully and effectively used for testing.
Use the rule engine to simulate and restore the desensitization request message, generate a collection of restoration request messages, filter the desensitization field on the returned message, generate an interface test script, execute the test and compare it, and realize the detection of sensitive information. Simulation reduction and self-feedback to improve testing accuracy and efficiency.
It improves the accuracy and efficiency of traffic playback testing based on desensitized logs, realizes efficient utilization of data in production logs, and ensures the accuracy and efficiency of test results.
Smart Images

Figure CN115865488B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a traffic playback test method, device, equipment and medium based on desensitized logs. Background Art
[0002] Traffic replay testing based on desensitized logs requires extracting interface requests and return messages from system production logs. However, in order to protect user information, some fields in production logs, such as customer name, ID number, address information, etc., are often desensitized and displayed as special characters. This makes it difficult to restore the fields of request messages and compare the fields of return messages in traffic replay.
[0003] At present, when encountering a request message with an anonymized field in the production log, it is usually skipped directly and the request message is not restored. If there are many interface messages involving sensitive information in the log, a large amount of data will be filtered out, and the production log cannot be fully and effectively used for traffic playback testing based on the anonymized log. Summary of the invention
[0004] The present application provides a traffic playback test method, device, equipment and medium based on desensitized logs, thereby solving the technical problem that when there are many interface messages involving sensitive information in the log, a large amount of data will be filtered out, and the production log cannot be fully and effectively utilized to perform traffic playback tests based on desensitized logs.
[0005] In a first aspect, the present application provides a traffic playback test method based on desensitized logs, including:
[0006] Parse the desensitized request message of the interface;
[0007] Performing simulated restoration processing on the desensitized request message through a rule engine to obtain a restored request message set;
[0008] Parsing the return message of the interface, and performing desensitizing field filtering processing on the return message;
[0009] Generate an interface test script according to the restoration request message set and the filtered return message;
[0010] Execute the test according to the interface test script;
[0011] The test return message is compared with the filtered return message to obtain the test result.
[0012] Here, the present application provides a traffic replay test method based on desensitized logs, which simulates and restores the sensitive information in the message through the rule engine as much as possible, so as to make full use of the data in the production log as much as possible, improve the accuracy of the traffic replay test based on the desensitized log, and realize the efficient use of the data in the production log.
[0013] Optionally, the rule engine includes a function library, a configuration file and a feedback device.
[0014] Optionally, the performing simulated restoration processing on the desensitized request message by a rule engine to obtain a restoration request message set includes:
[0015] Determine whether the desensitization field in the desensitization request message is a key field;
[0016] If the desensitized field is not a key field, the desensitized field is replaced with a random number or a random character according to a replacement rule of the desensitized field defined in the function library and the first configuration file in the configuration file;
[0017] The number of replacements is equal to the maximum number of attempts defined in the first configuration file, and each replacement results in a restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
[0018] Among them, when the embodiment of the present application simulates the restoration request message set through the rule engine, for the desensitized field is a non-key field, for example, the interface is a "new" operation interface, a set of rules can be predefined, according to different field types, by calling the method defined in the function library to generate random numbers or random characters of a specific type and length, generate random numbers or random characters to replace the field value, and perform multiple replacements according to the maximum number of attempts defined in the first configuration file to form a restoration request message set, simulate the restoration of sensitive information in the message as much as possible, and further ensure the success rate of the traffic replay test based on the desensitized log.
[0019] Optionally, the performing simulated restoration processing on the desensitized request message by a rule engine to obtain a restoration request message set includes:
[0020] Determine whether the desensitization field in the desensitization request message is a key field;
[0021] If the desensitized field is a key field, and the desensitized field is not the only query condition, then according to the query rules defined in the second configuration file in the configuration file, query processing is performed in the preset database table through other non-desensitized specific fields in the desensitized request message, and if the number of query results is less than or equal to the maximum number of attempts defined in the second configuration file, all query results are taken, and the desensitized fields are replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface;
[0022] If the number of query results is greater than the maximum number of attempts defined in the second configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the second configuration file, and the desensitized field is replaced in turn with each filtered query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
[0023] Optionally, the performing simulated restoration processing on the desensitized request message by a rule engine to obtain a restoration request message set includes:
[0024] Determine whether the desensitization field in the desensitization request message is a key field;
[0025] If the desensitized field is a key field, and the desensitized field is the only query condition, query processing is performed in a preset database table through a specific field of the returned message according to the query rule defined in the third configuration file in the configuration file, and if the number of query results is less than or equal to the maximum number of attempts defined in the third configuration file, all query results are taken, and the desensitized field is replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a simulated restoration request message set of the interface;
[0026] If the number of query results is greater than the maximum number of attempts defined in the third configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the third configuration file, and the desensitized field is replaced in turn with each filtered query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
[0027] Among them, when the embodiment of the present application simulates the restoration of a request message set through a rule engine, the desensitized field is a key field. For example, the interface is a "query" operation interface. According to whether the desensitized field is the only query condition, the query rule defined in the second or third configuration file can be selected respectively, and the query processing is performed in the preset database table through the specific field in the request or return message, and the desensitized field is replaced with the query result value, and multiple replacements are performed according to the maximum number of attempts defined in the second or third configuration file to form a restoration request message set, and the sensitive information in the message is simulated and restored as much as possible, thereby further ensuring the success rate of the traffic replay test based on the desensitized log.
[0028] Optionally, performing desensitized field filtering processing on the returned message includes:
[0029] The returned message is subjected to desensitized field filtering processing to obtain a filtered returned message.
[0030] Optionally, after comparing the test return message with the filtered return message to obtain the test result, the method further includes:
[0031] All test return messages corresponding to the interface restoration request message set are compared with the filtered return messages of the interface. If any test return message is successfully compared with the filtered return message, the test is determined to be successful and the configuration file remains unchanged; if all test return messages corresponding to the interface restoration request message set are unsuccessful in comparing with the filtered return messages, the test is determined to have failed and the interface is removed from the configuration file.
[0032] Here, the embodiment of the present application can also compare all test return messages corresponding to the interface with the return messages after filtering of the interface in sequence to determine whether the test is successful. If any test return message is compared successfully, the test is judged to be successful, and the configuration file remains unchanged. The current rule engine can be used to implement the test. If the comparison is unsuccessful, the test is judged to have failed, and the interface is removed from the configuration file of the rule engine, thereby realizing self-feedback of restoration accuracy and improving test efficiency.
[0033] In a second aspect, an embodiment of the present application provides a traffic playback test device based on a desensitized log, including:
[0034] The first parsing module is used to parse the desensitized request message of the interface;
[0035] A simulation and restoration module, used for performing simulation and restoration processing on the desensitized request message through a rule engine to obtain a restoration request message set;
[0036] A second parsing module is used to parse the return message of the interface and perform desensitized field filtering processing on the return message;
[0037] A generation module, used to generate an interface test script according to the restoration request message set and the filtered return message;
[0038] A test module, used to execute the test according to the interface test script;
[0039] The comparison module is used to compare the test return message with the filtered return message to obtain the test result.
[0040] Optionally, the rule engine includes a function library, a configuration file and a feedback device.
[0041] Optionally, the simulation restoration module is specifically used for:
[0042] Determine whether the desensitization field in the desensitization request message is a key field;
[0043] If the desensitized field is not a key field, the desensitized field is replaced with a random number or a random character according to a replacement rule of the desensitized field defined in the function library and the first configuration file in the configuration file;
[0044] The number of replacements is equal to the maximum number of attempts defined in the first configuration file, and each replacement results in a restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
[0045] Optionally, the simulation restoration module is further specifically used for:
[0046] Determine whether the desensitization field in the desensitization request message is a key field;
[0047] If the desensitized field is a key field, and the desensitized field is not the only query condition, then according to the query rules defined in the second configuration file in the configuration file, query processing is performed in the preset database table through other non-desensitized specific fields in the desensitized request message, and if the number of query results is less than or equal to the maximum number of attempts defined in the second configuration file, all query results are taken, and the desensitized fields are replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface;
[0048] If the number of query results is greater than the maximum number of attempts defined in the second configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the second configuration file, and the desensitized field is replaced in turn with each filtered query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
[0049] Optionally, the simulation restoration module is further specifically used for:
[0050] The method of performing simulated restoration processing on the desensitized request message by the rule engine to obtain a restoration request message set includes:
[0051] Determine whether the desensitization field in the desensitization request message is a key field;
[0052] If the desensitized field is a key field, and the desensitized field is the only query condition, query processing is performed in a preset database table through a specific field of the returned message according to the query rule defined in the third configuration file in the configuration file, and if the number of query results is less than or equal to the maximum number of attempts defined in the third configuration file, all query results are taken, and the desensitized field is replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a simulated restoration request message set of the interface;
[0053] If the number of query results is greater than the maximum number of attempts defined in the third configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the third configuration file, and the desensitized field is replaced in turn with each filtered query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
[0054] Optionally, the filtering module is specifically used for:
[0055] The returned message is subjected to desensitized field filtering processing to obtain a filtered returned message.
[0056] Optionally, after the comparison module compares the test return message with the filtered return message to obtain the test result, the apparatus further includes:
[0057] The self-feedback module is used to compare all the test return messages corresponding to the interface restoration request message set with the filtered return messages of the interface. If any one of the test return messages is successfully compared with the filtered return message, the test is determined to be successful and the configuration file is kept unchanged; if all the test return messages corresponding to the interface restoration request message set are unsuccessful in comparing with the filtered return messages, the test is determined to have failed and the interface is removed from the configuration file.
[0058] In a third aspect, the present application provides a traffic playback test device based on a desensitized log, comprising: at least one processor and a memory;
[0059] The memory stores computer-executable instructions;
[0060] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the traffic replay test method based on desensitized logs as described in the first aspect and various possible designs of the first aspect.
[0061] In a fourth aspect, the present invention provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the traffic replay test method based on desensitized logs as described in the first aspect and various possible designs of the first aspect is implemented.
[0062] In a fifth aspect, the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the traffic replay test method based on desensitized logs as described in the first aspect and various possible designs of the first aspect.
[0063] The present application provides a traffic replay test method, device, equipment and medium based on desensitized logs, wherein the method designs a set of rule engines for traffic replay testing based on desensitized logs, simulates the desensitized fields in the restoration request message, and can also perform self-feedback on the restoration mechanism based on the comparison results of the returned message, thereby realizing efficient use of data in the production log. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] 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, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0065] Figure 1A schematic diagram of the architecture of a traffic playback test system based on desensitized logs provided in an embodiment of the present application;
[0066] Figure 2 A flow chart of a traffic playback test method based on a desensitized log provided in an embodiment of the present application;
[0067] Figure 3 A flow chart of another traffic playback test method based on desensitized logs provided in an embodiment of the present application;
[0068] Figure 4 A flow chart of another traffic playback test method based on desensitized logs provided in an embodiment of the present application;
[0069] Figure 5 A schematic diagram of the structure of a traffic playback test device based on a desensitized log provided in an embodiment of the present application;
[0070] Figure 6 A structural diagram of a traffic playback test device based on desensitized logs provided in an embodiment of the present application.
[0071] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0072] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0073] The terms "first", "second", "third", and "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0074] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0075] Traffic replay testing needs to be based on the system production log, from which the interface request and return messages are extracted. However, in order to protect user information, some fields in the production log, such as customer name, ID number, address information, etc., are often desensitized and displayed as special characters. This makes it difficult to restore the fields of the request message and compare the fields of the return message during traffic replay. Currently, when encountering request messages with desensitized fields in the production log, they are usually skipped directly and the request message will not be restored. If there are many interface messages involving sensitive information in the log, a large amount of data will be filtered out, and the production log cannot be fully and effectively used for traffic replay testing.
[0076] In order to solve the above problems, the embodiments of the present application provide a traffic playback test method, device, equipment and medium based on desensitized logs, wherein the method simulates the restoration of sensitive information in the message as much as possible, and performs self-feedback on the restoration accuracy to make full use of the data in the production log as much as possible.
[0077] The embodiment of the present application proposes a testing method for approximately restoring an anonymized log and performing self-feedback on the restoration mechanism based on the comparison result of the returned message.
[0078] Optional, Figure 1 A schematic diagram of the traffic playback test system architecture based on desensitized logs provided in an embodiment of the present application. Figure 1 In the above architecture, the above architecture includes at least one of a data acquisition device 101, a processing device 102 and a display device 103.
[0079] It is understandable that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the architecture of the traffic playback test system based on the desensitized log. In other feasible implementations of the present application, the above architecture may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown may be implemented in hardware, software, or a combination of software and hardware.
[0080] In the specific implementation process, the data acquisition device 101 may include an input / output interface and may also include a communication interface. The data acquisition device 101 may collect\parse the desensitized request messages and return messages of the interface.
[0081] The processing device 102 can simulate and restore the sensitive information in the message by using random numbers or random characters, and perform self-feedback on the restoration accuracy to make full use of the data in the production log as much as possible.
[0082] The display device 103 can be used to display the above results, etc., and can also interact with the user through the display device. The display device 103 can be a user terminal or a server.
[0083] The display device 103 may also be a touch display screen, which is used to receive user instructions while displaying the above content to achieve interaction with the user.
[0084] The technical solution of the present application is described in detail below in conjunction with specific embodiments:
[0085] Optionally, Figure 2 A flow chart of a traffic playback test method based on desensitized logs provided in an embodiment of the present application. The execution subject of the embodiment of the present application can be Figure 1 The specific execution subject can be determined according to the actual application scenario. Figure 2 As shown, the method comprises the following steps:
[0086] S201: parse the desensitized request message of the interface.
[0087] S202: Perform simulated restoration processing on the desensitized request message through the rule engine to obtain a set of restored request messages.
[0088] Optionally, the rule engine includes a function library, a configuration file and a feedback device.
[0089] In a possible implementation, the functions of the function library, configuration file, and feedback device are as follows:
[0090] Function library: defines various methods for generating random numbers or random characters. For example, generating a random number with a specified number of digits; generating a random character with a specified number of digits; randomly generating an ID card number that complies with the ID card verification rules.
[0091] Configuration file: defines the rules for simulating restore request messages on different interfaces.
[0092] Optionally, the configuration file may include a first configuration file, a second configuration file, and a third configuration file. In actual application, the implementation of the first configuration file, the second configuration file, and the third configuration file may be determined according to circumstances, and the embodiment of the present application does not impose any specific limitation on this.
[0093] Among them, the first configuration file includes: interface number, interface path, maximum number of attempts, desensitized fields to be restored, and methods in the function library used by each desensitized field.
[0094] Among them, the second configuration file includes: interface number, interface path, maximum number of attempts, desensitized fields to be restored, non-desensitized fields in the request message to be used for query, and query methods in the preset database corresponding to each desensitized field.
[0095] Among them, the third configuration file includes: interface number, interface path, maximum number of attempts, desensitized fields to be restored, non-desensitized fields in the return message to be used for query, and query methods in the preset database corresponding to each desensitized field.
[0096] Feedback device: used to update and maintain configuration files.
[0097] Specifically, the embodiments of the present application can adopt different methods to implement simulated restoration processing of the desensitized request message according to whether the desensitized field in the desensitized request message is a key field.
[0098] Key field: The value of this field in the request message will not only affect whether the interface can return normally, but also affect the specific value of the returned message. Commonly used in the "query" interface, the values of each field in the request message constitute the query conditions, and the values of each field in the returned message constitute the query results.
[0099] Non-key fields: The value of this field in the request message will only affect whether the interface function can be successfully executed, but will not affect the specific value of the return message. Commonly used in the "Add" interface, the fields in the request message constitute the data to be inserted into the backend database through this interface, but the return message usually only shows the insertion result, that is, "insertion successful", "insertion failed", etc.
[0100] Optionally, the desensitized request message is simulated and restored by a rule engine to obtain a restored request message set, including:
[0101] Determine whether the desensitized field in the desensitized request message is a key field; if the desensitized field is not a key field, replace the desensitized field with a random number or random character according to the replacement rule of the desensitized field defined in the first configuration file in the function library and the configuration file.
[0102] The number of replacements is equal to the maximum number of attempts defined in the first configuration file, and each replacement results in a restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
[0103] In one possible implementation, a set of request messages is restored by simulating a rule engine, and the desensitized fields are non-key fields. For example, if the interface is a "new" operation interface, a set of rules are predefined to replace the field value with a random number or random character according to different field types.
[0104] Among them, when the embodiment of the present application simulates the restoration request message set through the rule engine, for the desensitized field is a non-key field, for example, the interface is a "new" operation interface, a set of rules can be predefined, according to different field types, by calling the method defined in the function library to generate random numbers or random characters of a specific type and length, generate random numbers or random characters to replace the field value, and perform multiple replacements according to the maximum number of attempts defined in the first configuration file to form a restoration request message set, simulate the restoration of sensitive information in the message as much as possible, and further ensure the success rate of the traffic replay test based on the desensitized log.
[0105] Optionally, the desensitized request message is simulated and restored by a rule engine to obtain a return message, including:
[0106] Determine whether the desensitized field in the desensitization request message is a key field;
[0107] If the desensitized field is a key field, and the desensitized field is not the only query condition, then according to the query rules defined in the second configuration file in the configuration file, query processing is performed in the preset database table through other non-masked specific fields in the desensitized request message. If the number of query results is less than or equal to the maximum number of attempts defined in the second configuration file, all query results are taken, and the desensitized fields are replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface;
[0108] If the number of query results is greater than the maximum number of attempts defined in the second configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the second configuration file. The masked fields are replaced in turn with each filtered query result value, where each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
[0109] Optionally, the desensitized request message is simulated and restored by a rule engine to obtain a restored request message set, including:
[0110] Determine whether the desensitized field in the desensitization request message is a key field;
[0111] If the desensitized field is a key field, and the desensitized field is the only query condition, query processing is performed in the preset database table through the specific field of the returned message according to the query rules defined in the third configuration file in the configuration file. If the number of query results is less than or equal to the maximum number of attempts defined in the third configuration file, all query results are taken, and the desensitized fields are replaced in turn with the value of each query result, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a simulated restoration request message set of the interface;
[0112] If the number of query results is greater than the maximum number of attempts defined in the third configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the third configuration file. The masked fields are replaced in sequence with each filtered query result value, where each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
[0113] It is understandable that the maximum number of attempts defined here can be determined based on actual conditions, and the embodiments of the present application do not impose any specific limitations.
[0114] Among them, query processing can be performed in a preset database according to the query rules to obtain query results, and the query results include one or more query result values. The specific query result values are used to replace the value of the desensitized field in the request message.
[0115] Among them, the number of desensitized field values and restoration request messages is one-to-one corresponding, and each desensitized field value can obtain a restoration request message.
[0116] In one possible implementation, for example, the interface is a "query" operation interface, and the desensitized field of the request message is part of the query condition. If there are other fields in the request message that are also used as query conditions, these fields can be used to query the corresponding database table for desensitized field values that may meet the conditions, and the values that meet the conditions are traversed one by one, and the number of traversals does not exceed the defined maximum number of attempts.
[0117] In one possible implementation, if the interface is a "query" operation interface, and the desensitized field of the request message is the only query condition, the desensitized field values that may meet the conditions can be queried in the corresponding database table through the specific field in the return message of the interface in the log, and the values that meet the conditions can be traversed one by one, and the number of traversals does not exceed the defined maximum number of attempts.
[0118] Among them, when the embodiment of the present application simulates the restoration of a request message set through a rule engine, the desensitized field is a key field. For example, the interface is a "query" operation interface. According to the query rules defined in the second or third configuration file, query processing is performed in the preset database table through specific fields in the request or return message, and the desensitized field is replaced with the query result value. Multiple replacements are performed according to the maximum number of attempts defined in the second or third configuration file to form a restoration request message set, simulate the restoration of sensitive information in the message as much as possible, and further ensure the success rate of the traffic replay test based on the desensitized log.
[0119] S203: parse the return message of the interface, and perform desensitizing field filtering on the return message.
[0120] Among them, both the request message and the return message come from the log.
[0121] Optionally, perform desensitized field filtering on the returned message, including:
[0122] Perform desensitizing field filtering on the returned message to obtain the filtered returned message.
[0123] If there is a desensitized field in the return message in the log, the desensitized field is filtered out to obtain the returned message after filtering.
[0124] S204: Generate an interface test script according to the restoration request message set and the filtered return message.
[0125] The interface test script is generated by restoring the request message set and filtering the return message.
[0126] S205: Execute the test according to the interface test script.
[0127] S206: Compare the test return message with the filtered return message to obtain a test result.
[0128] If a desensitized field is encountered in the returned message, the field is skipped and no comparison is performed.
[0129] The test return message here refers to the test return message obtained after executing the test according to the interface test script.
[0130] The present application provides a traffic replay test method based on desensitized logs, which simulates and restores sensitive information in messages through a rule engine as much as possible, and can provide self-feedback on the restoration accuracy, so as to make full use of the data in the production logs as much as possible, thereby improving the accuracy of the traffic replay test based on the desensitized logs and realizing the efficient use of the data in the production logs.
[0131] Optionally, the embodiment of the present application can also implement self-feedback, and accordingly, Figure 3 A flow chart of another traffic playback test method based on desensitized logs provided in an embodiment of the present application is as follows: Figure 3 As shown, the method includes:
[0132] S301: parse the desensitized request message of the interface.
[0133] S302: Perform simulated restoration processing on the desensitized request message through the rule engine to obtain a set of restored request messages.
[0134] S303: parse the return message of the interface, and perform desensitizing field filtering on the return message.
[0135] S304: Generate an interface test script according to the restoration request message set and the filtered return message.
[0136] S305: Execute the test according to the interface test script.
[0137] S306: Compare the test return message with the filtered return message to obtain a test result.
[0138] Among them, the implementation method of steps S301-S306 is similar to the implementation method of steps S201-S206, and the embodiment of the present application will not be repeated here.
[0139] S307: Compare all the test return messages corresponding to the interface restoration request message set with the filtered return messages of the interface. If any of the test return messages is successfully compared with the filtered return message, the test is determined to be successful and the configuration file remains unchanged; if all the test return messages corresponding to the interface restoration request message set are unsuccessful in the comparison with the filtered return messages, the test is determined to have failed and the interface is removed from the configuration file.
[0140] After executing the traffic replay test and obtaining the return message comparison result, if within the defined maximum number of attempts, there is a test return message of the simulated request that matches the return message in the filtered log, the interface traffic replay test is considered successful and the configuration file remains unchanged; if there is no test return message that is consistent with the message in the log, the interface traffic replay test is considered to have failed, and the interface is removed from the configuration file and replaced by manual testing.
[0141] Here, the embodiment of the present application can also compare all test return messages corresponding to the interface with the return messages after filtering of the interface in sequence to determine whether the test is successful. If any return message is compared successfully, the test is judged to be successful, and the configuration file remains unchanged. The current rule engine can be used to implement the test. If the comparison is unsuccessful, the test is judged to have failed, and the interface is removed from the configuration file of the rule engine, thereby realizing self-feedback of restoration accuracy and improving test efficiency.
[0142] Figure 4 A flow chart of another traffic replay test method based on desensitized logs provided in an embodiment of the present application, in which Y represents "yes" and N represents "no".
[0143] like Figure 4 As shown in the figure, a set of rule engines is designed for traffic playback testing based on desensitized logs, which simulates the desensitized fields in the restoration request message and performs self-feedback on the restoration mechanism based on the comparison results of the returned message. This achieves efficient use of data in production logs.
[0144] Optionally, if a desensitized field is encountered in the return message, the field is skipped and no comparison is performed.
[0145] Optionally, after executing the traffic replay test and obtaining the return message comparison result, if within the defined maximum number of attempts, the return message of the simulated request matches the return message in the log, the interface traffic replay test is judged to be successful and the configuration file remains unchanged; if there is no return message consistent with the message in the log, the interface traffic replay test is judged to have failed, and the interface is removed from the configuration file and replaced by manual testing.
[0146] This traffic replay test method is planned to be applied to the traffic replay function module of the automated test platform, and the function library of the rule engine will be continuously expanded according to different system requirements, and the configuration files for different systems will be customized. The traffic replay test method will make full use of the data in the production log as much as possible, making traffic replay testing based on desensitized logs possible.
[0147] Figure 5 A schematic diagram of the structure of a traffic playback test device based on a desensitized log provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the device of the embodiment of the present application includes: a first analysis module 501, a simulation and restoration module 502, a second analysis module 503, a generation module 504, a test module 505 and a comparison module 506. The traffic playback test device based on the desensitized log here can be the above-mentioned processing device itself, or a chip or integrated circuit that realizes the function of the processing device, or a server. It should be noted here that the division of the first analysis module 501, the simulation and restoration module 502, the second analysis module 503, the generation module 504, the test module 505 and the comparison module 506 is only a division of logical functions. Physically, the two can be integrated or independent.
[0148] Wherein, the first parsing module is used to parse the desensitized request message of the interface;
[0149] A simulation restoration module is used to perform simulation restoration processing on the desensitized request message through a rule engine to obtain a restoration request message set;
[0150] The second parsing module is used to parse the return message of the interface and perform desensitized field filtering on the return message;
[0151] A generation module, used to generate an interface test script according to the restoration request message set and the filtered return message;
[0152] Test module, used to execute tests according to interface test scripts;
[0153] The comparison module is used to compare the test return message with the filtered return message to obtain the test result.
[0154] Optionally, the rule engine includes a function library, a configuration file and a feedback device.
[0155] Optionally, the simulation restoration module is specifically used for:
[0156] Determine whether the desensitized field in the desensitization request message is a key field;
[0157] If the desensitized field is not a key field, the desensitized field is replaced with a random number or random character according to the replacement rule of the desensitized field defined in the first configuration file in the function library and the configuration file;
[0158] The number of replacements is equal to the maximum number of attempts defined in the first configuration file, and each replacement results in a restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
[0159] Optionally, the simulation restoration module is further specifically used for:
[0160] Determine whether the desensitized field in the desensitization request message is a key field;
[0161] If the desensitized field is a key field, and the desensitized field is not the only query condition, then according to the query rules defined in the second configuration file in the configuration file, query processing is performed in the preset database table through other non-masked specific fields in the desensitized request message. If the number of query results is less than or equal to the maximum number of attempts defined in the second configuration file, all query results are taken, and the desensitized fields are replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface;
[0162] If the number of query results is greater than the maximum number of attempts defined in the second configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the second configuration file. The masked fields are replaced in turn with each filtered query result value, where each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
[0163] Optionally, the simulation restoration module is further specifically used for:
[0164] The rule engine simulates the restoration of the desensitized request message to obtain a set of restored request messages, including:
[0165] Determine whether the desensitized field in the desensitization request message is a key field;
[0166] If the desensitized field is a key field, and the desensitized field is the only query condition, query processing is performed in the preset database table through the specific field of the returned message according to the query rules defined in the third configuration file in the configuration file. If the number of query results is less than or equal to the maximum number of attempts defined in the third configuration file, all query results are taken, and the desensitized fields are replaced in turn with the value of each query result, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a simulated restoration request message set of the interface;
[0167] If the number of query results is greater than the maximum number of attempts defined in the third configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the third configuration file. The masked fields are replaced in sequence with each filtered query result value, where each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
[0168] Optionally, the filtering module is specifically used for:
[0169] Determine whether there is a desensitized field in the returned message;
[0170] If the returned message does not contain a desensitized field, an interface test script is generated based on the returned message and the restoration request message set of the interface;
[0171] If the return message contains a desensitized field, the desensitized field is filtered to obtain a filtered return message, and an interface test script is generated based on the filtered return message and the restoration request message set of the interface.
[0172] Optionally, after the comparison module compares the test return message with the filtered return message to obtain the test result, the apparatus further includes:
[0173] The self-feedback module is used to compare all the test return messages corresponding to the interface restoration request message set with the filtered return messages of the interface. If any test return message is successfully compared with the filtered return message, the test is judged to be successful and the configuration file remains unchanged; if all the test return messages corresponding to the interface restoration request message set are unsuccessful in comparing with the filtered return messages, the test is judged to have failed and the interface is removed from the configuration file.
[0174] refer to Figure 6 , which shows a schematic diagram of the structure of a traffic playback test device 600 based on anonymized logs suitable for implementing an embodiment of the present disclosure, and the traffic playback test device 600 based on anonymized logs can be a terminal device or a server. The terminal device can include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The traffic playback test device based on the desensitized log shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0175] like Figure 6 As shown, the traffic replay test device 600 based on the desensitized log may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (Read Only Memory, referred to as ROM) 602 or the program loaded from the storage device 608 to the random access memory (Random Access Memory, referred to as RAM) 603. In RAM 603, various programs and data required for the operation of the traffic replay test device 600 based on the desensitized log are also stored. The processing device 601, ROM 602 and RAM 603 are connected to each other via a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0176] Typically, the following devices can be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 609. The communication device 609 can allow the traffic playback test device 600 based on the desensitized log to communicate wirelessly or wired with other devices to exchange data. Although Figure 6 The traffic playback test device 600 based on the desensitized log is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0177] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes 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 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0178] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, 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 the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0179] The above-mentioned computer-readable medium may be included in the above-mentioned traffic replay test device based on desensitized logs; or it may exist independently without being assembled into the traffic replay test device based on desensitized logs.
[0180] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the traffic replay test device based on the desensitized log, the traffic replay test device based on the desensitized log executes the method shown in the above-mentioned embodiment.
[0181] Computer program code for performing the operations of the present disclosure 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 an independent 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 via 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).
[0182] 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 disclosure. In this regard, each square 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 implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square 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.
[0183] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0184] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0185] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0186] The traffic replay test device based on desensitized logs in the embodiment of the present application can be used to execute the technical solutions in the above-mentioned method embodiments of the present application. Its implementation principles and technical effects are similar and will not be repeated here.
[0187] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement any of the above-mentioned data processing methods.
[0188] An embodiment of the present application also provides a computer program product, including a computer program, which is used to implement any of the above-mentioned data processing methods when the computer program is executed by a processor.
[0189] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0190] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0191] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0192] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A traffic playback test method based on desensitized logs, characterized in that: include: Parse the desensitized request message of the interface; Performing simulated restoration processing on the desensitized request message through a rule engine to obtain a restored request message set; The rule engine includes a function library, a configuration file and a feedback device; Parsing the return message of the interface, and performing desensitizing field filtering processing on the return message; Generate an interface test script according to the restoration request message set and the filtered return message; Execute the test according to the interface test script; Compare the test return message with the filtered return message to obtain the test result; The method of performing simulated restoration processing on the desensitized request message by the rule engine to obtain a restoration request message set includes: Determine whether the desensitization field in the desensitization request message is a key field; If the desensitized field is not a key field, the desensitized field is replaced with a random number or a random character according to a replacement rule of the desensitized field defined in the function library and the first configuration file in the configuration file; The number of replacements is equal to the maximum number of attempts defined in the first configuration file, and each replacement results in a restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
2. The method according to claim 1, characterized in that The method of performing simulated restoration processing on the desensitized request message by the rule engine to obtain a restoration request message set includes: Determine whether the desensitization field in the desensitization request message is a key field; If the desensitized field is a key field, and the desensitized field is not the only query condition, then according to the query rules defined in the second configuration file in the configuration file, query processing is performed in the preset database table through other non-desensitized specific fields in the desensitized request message, and if the number of query results is less than or equal to the maximum number of attempts defined in the second configuration file, all query results are taken, and the desensitized fields are replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface; If the number of query results is greater than the maximum number of attempts defined in the second configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the second configuration file, and the desensitized field is replaced in turn with each filtered query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
3. The method according to claim 1, characterized in that The method of performing simulated restoration processing on the desensitized request message by the rule engine to obtain a restoration request message set includes: Determine whether the desensitization field in the desensitization request message is a key field; If the desensitized field is a key field, and the desensitized field is the only query condition, query processing is performed in a preset database table through a specific field of the returned message according to the query rule defined in the third configuration file in the configuration file, and if the number of query results is less than or equal to the maximum number of attempts defined in the third configuration file, all query results are taken, and the desensitized field is replaced in turn with each query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute a simulated restoration request message set of the interface; If the number of query results is greater than the maximum number of attempts defined in the third configuration file, data is randomly filtered in the query results, and the number of filtered data is equal to the maximum number of attempts defined in the third configuration file, and the desensitized field is replaced in turn with each filtered query result value, wherein each query result obtains a corresponding restoration request message, and all restoration request messages constitute the restoration request message set of the interface.
4. The method according to any one of claims 1 to 3, characterized in that: The performing desensitizing field filtering processing on the returned message includes: The returned message is subjected to desensitized field filtering processing to obtain a filtered returned message.
5. The method according to any one of claims 1 to 3, characterized in that: After comparing the test return message with the filtered return message to obtain the test result, the method further includes: All test return messages corresponding to the interface restoration request message set are compared with the filtered return messages of the interface. If any test return message is successfully compared with the filtered return message, the test is determined to be successful and the configuration file remains unchanged; if all test return messages corresponding to the interface restoration request message set are unsuccessful in comparing with the filtered return messages, the test is determined to have failed and the interface is removed from the configuration file.
6. A traffic playback test device based on desensitized logs, characterized in that: include: The first parsing module is used to parse the desensitized request message of the interface; A simulation restoration module, used for performing simulation restoration processing on the desensitized request message through a rule engine to obtain a restoration request message set; the rule engine includes a function library, a configuration file and a feedback device; A second parsing module is used to parse the return message of the interface and perform desensitized field filtering processing on the return message; A generation module, used to generate an interface test script according to the restoration request message set and the filtered return message; A test module, used to execute the test according to the interface test script; A comparison module, used for comparing the test return message with the filtered return message to obtain a test result; The simulation restoration module is specifically used to determine whether the desensitized field in the desensitization request message is a key field; If the desensitized field is not a key field, the desensitized field is replaced with a random number or a random character according to the replacement rule of the desensitized field defined in the function library and the first configuration file in the configuration file; wherein the number of replacements is equal to the maximum number of attempts defined in the first configuration file, and each replacement obtains a restoration request message, and all restoration request messages constitute a restoration request message set of the interface.
7. A traffic playback test device based on desensitized logs, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed 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 traffic replay test method based on desensitized logs as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the traffic replay test method based on desensitized logs as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Flow playback method and device
CN111488252A
Bank payment log playback method, device and equipment and readable storage medium
CN114240622A
Test method and device based on flow playback
CN115080433A
Data verification method and device for traffic playback
CN115297041A
Data desensitization and restoration method based on symmetric encryption
CN115333809A
