Assertion determination method and device, equipment, storage medium and program product
By automatically obtaining and filtering network traffic, generating a set of traffic parameter fields value collection, and matching the assertion type list, it solves the problems of high cost of writing assertion rules and insufficient coverage in automated tests, and achieves efficient and accurate assertion generation.
Patent Information
- Application Number
- CN202411986672.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-08
AI Technical Summary
When designing assertion rules for automated testing, the prior art has problems such as high writing costs, difficulty in ensuring high coverage, and a lot of noise affecting assertion accuracy.
By obtaining the original traffic in the network and the current business scenario, the intermediate traffic is obtained, and preprocessed to obtain the set of values of the traffic parameter field, and matching the assertion type list according to the set, it automatically generates high-coverage and low-noise logical assertions.
It realizes reducing the cost of assertion scripting, improving the coverage and accuracy of assertions, and improving manual efficiency and accuracy of assertion generation.
Smart Images

Figure CN119782186A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, storage medium, and program product for assertion determination. Background Art
[0002] Interface automation testing is an important way to ensure business quality in the software quality system. Interface automation use cases mainly include test execution logic, assertion methods, and result measurement.
[0003] The construction of interface automation is becoming increasingly important, but the common problem in the industry is that interface automation testing is not mature enough and the defects generated by traditional interface automation testing are not recalled enough. For assertions in automated testing, handwritten assertion scripts rely on business experience, have high writing costs, and are difficult to ensure high coverage; assertions based on traffic recording or real-time traffic diversion before and after comparison have more noise in the comparison process due to changes in timestamps or storage quantities, affecting the accuracy of assertions.
[0004] Therefore, when designing assertion rules for automated testing, related technologies have problems such as high writing costs, difficulty in ensuring high coverage, and the presence of a lot of noise that affects assertion accuracy. Summary of the invention
[0005] In view of this, the present disclosure provides a method, apparatus, device, storage medium and program product for assertion determination to solve the problems of high writing cost, difficulty in ensuring high coverage and the presence of more noise affecting assertion accuracy when designing assertion rules for automated testing in related technologies.
[0006] In a first aspect, the present disclosure provides a method for assertion determination, the method comprising:
[0007] Obtain the original traffic and current business scenarios in the network;
[0008] Filter the original traffic according to the business scenario to obtain the intermediate traffic;
[0009] Preprocess the intermediate traffic to obtain a set of traffic output parameter field values;
[0010] According to the traffic outgoing parameter field value set, match the assertion type list to obtain the target assertion.
[0011] In the disclosed embodiment, the original traffic in the network and the current business scenario are obtained; the original traffic is filtered according to the business scenario to obtain the intermediate traffic; the intermediate traffic is preprocessed to obtain the traffic output parameter field value set; the assertion type list is matched according to the traffic output parameter field value set to obtain the target assertion. In this way, the disclosed embodiment implements traffic filtering based on the current business scenario, and then determines the traffic output parameter field value set based on the filtered traffic to automatically match the assertion type list, thereby automatically and low-costly generating high-coverage and low-noise logical assertions, thereby achieving the purpose of improving manual efficiency, reducing noise, and improving the accuracy of generated logical assertions.
[0012] In an optional implementation, the intermediate traffic is preprocessed to obtain a traffic output parameter field value set, including:
[0013] Preprocess the intermediate traffic to obtain the corresponding relationship between the traffic output parameter field and the traffic output parameter field value;
[0014] The flow output parameter field value set is determined based on the corresponding relationship.
[0015] In the disclosed embodiment, a set of traffic output parameter field values is obtained from the correspondence between the traffic output parameter fields and the traffic output parameter field values, so as to facilitate subsequent acquisition of accurate assertion rules.
[0016] In an optional implementation, determining a flow outgoing parameter field value set according to the corresponding relationship includes:
[0017] Match the flow output parameter field with the key field, where the key field is the field that affects the flow;
[0018] When the traffic output parameter field is a key field, obtain the traffic output parameter field value corresponding to the key field;
[0019] Determine the flow output parameter field value set according to the flow output parameter field value.
[0020] In the disclosed embodiment, the traffic output parameter fields are screened to obtain a set of traffic output parameter field values corresponding to the key fields, thereby reducing the processing of useless traffic output parameter fields.
[0021] In an optional implementation, the target assertion is obtained by matching the assertion type list according to the traffic outbound parameter field value set, including:
[0022] Determine the set type of the flow outgoing parameter field value set;
[0023] Compare the element value in the collection type with the preset threshold value to obtain a comparison result;
[0024] The assertion type of the traffic outgoing parameter field is determined according to the comparison result to obtain the target assertion.
[0025] In the embodiment of the present disclosure, by obtaining the set type of the flow parameter field value set, the element value in the set type is compared with the preset threshold, and then the target assertion rule is obtained, so as to achieve the purpose of automatically generating logical assertions and solve the problems of high cost, low coverage and high noise of manually written assertions.
[0026] In an optional implementation, comparing the element value in the set type with a preset threshold to obtain a comparison result includes:
[0027] Get the preset threshold value corresponding to the collection type;
[0028] When the collection type is the first collection type, the number of elements in the flow output parameter field value set is obtained;
[0029] Compare the number of elements with a first threshold to obtain a first comparison result;
[0030] When the set type is the second set type, obtain the number of non-empty times in the flow output parameter field value set;
[0031] The non-empty times are compared with a second threshold to obtain a second comparison result.
[0032] In an optional implementation, determining the assertion type of the traffic outbound parameter field according to the comparison result to obtain the target assertion includes:
[0033] When both the first comparison result and the second comparison result are true, selecting the first assertion type from the assertion type list to obtain a target assertion;
[0034] When the first comparison result and / or the second comparison result is false, a second assertion type is selected from the assertion type list to obtain a target assertion.
[0035] In an optional implementation, after matching the assertion type list according to the traffic outbound parameter field value set to obtain the target assertion, the method further includes:
[0036] Get the verification task type;
[0037] Generate verification traffic according to the verification task type;
[0038] Verify the traffic according to the target assertion and obtain the assertion verification result;
[0039] Feedback notification information based on the assertion verification results.
[0040] In the disclosed embodiment, target assertions are tested for verification task types, so that the provided logic assertion mode can reduce costs, improve efficiency, reduce noise, and improve the ability to proactively recall problems.
[0041] In a second aspect, the present disclosure provides a device for assertion determination, the device comprising:
[0042] The acquisition module is used to obtain the original traffic and current business scenarios in the network;
[0043] The filtering module is used to filter the original traffic according to the business scenario to obtain the intermediate traffic;
[0044] The preprocessing module is used to preprocess the intermediate traffic and obtain a set of traffic output parameter field values;
[0045] The matching module is used to match the assertion type list according to the value set of the flow parameter field to obtain the target assertion.
[0046] In a third aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the assertion determination method of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0047] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to cause a computer to execute the assertion determination method of the first aspect or any corresponding embodiment thereof.
[0048] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, where the computer instructions are used to enable a computer to execute the assertion determination method of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 is a flowchart of a method for assertion determination according to an embodiment of the present disclosure;
[0051] Figure 2 is a schematic diagram of a process of verifying a target assertion based on a regression test scenario according to an embodiment of the present disclosure;
[0052] Figure 3 is a schematic diagram of a process of verifying a target assertion based on an online test scenario according to an embodiment of the present disclosure;
[0053] Figure 4 is a schematic diagram of an assertion rule mining method according to an embodiment of the present disclosure;
[0054] Figure 5 is a structural block diagram of an apparatus for assertion determination according to an embodiment of the present disclosure;
[0055] Figure 6 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0057] In conjunction with the application scenarios on which the execution of the method determined by the assertion depends, the application scenarios are described here.
[0058] As interface automated testing becomes increasingly important, the defect recall rate generated by traditional interface automated testing is very low. There are two core reasons for this: poor quality of automated testing construction leads to difficulty in recall, and low efficiency of automated testing construction leads to low willingness to build. For assertions (assertions are scripts used to verify whether actual results meet expected results), there are currently two common ways to generate assertions: (1) handwritten assertion scripts, which have problems: handwritten assertion scripts rely on business experience, have high writing costs, and are difficult to ensure high coverage; (2) generating assertions by recording traffic and replaying it in a specific test lane, and comparing the difference values of the playback results. There are problems: assertions are noisy.
[0059] In order to solve the above problems, according to an embodiment of the present disclosure, a method embodiment of assertion determination is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0060] In this embodiment, a method for assertion determination is provided. Figure 1 is a flowchart of a method for determining an assertion according to an embodiment of the present disclosure, the method being applied to a server side, such as Figure 1As shown, the method flow includes the following steps:
[0061] Step S101, obtaining original traffic and current service scenarios in the network.
[0062] Optionally, first, the scenario is a series of feature combinations with business semantics. Under risk business, the corresponding risk scenario should include risk fields, combination methods, risk values, etc. Traffic includes request and response content, which can be used for playback execution. Different risk scenarios can be associated with different test traffic.
[0063] In the disclosed embodiment, the server will obtain all the traffic flowing in the network, which is called raw traffic. A traffic is composed of input parameters + output parameters, that is, the specified input parameters call the API interface to generate the corresponding output parameters, and the traffic is obtained according to the input parameters and output parameters.
[0064] If all the input parameters can match a certain scenario, the traffic is considered to belong to this scenario. Therefore, based on these raw traffic and some traffic reading algorithms, the current business scenario is mined. For example, the current business scenario is obtained as a live broadcast scenario through the json key-value pair of the traffic input parameter: "$.ProjectID":"4xxxx", etc. The current business scenario can also be determined by the user entering the scenario, such as the current business scenario is a short video scenario through the expression of the traffic input parameter: Req? .Body? .buff_level==nil and Req.Body.gift_id=='4xx'.
[0065] Step S102, filtering the original traffic according to the business scenario to obtain the intermediate traffic.
[0066] Optionally, filter the original traffic according to the input parameter corresponding to the business scenario to obtain the filtered intermediate traffic. For example, the input parameter corresponding to a business scenario is: "$.k1":"v1", the original traffic is: {"k1":"v1","k2":"v2","k3":"v3","k4":"v4"}; {"k1":"v2","k2":"v2","k3":"v3","k4":"v4"}; {"k1":"v1","k2":"v2","k3":"v3","k4":"v4"}; {"k1":"v1","k2":"v2","k3":"v3","k4":"v4"}; 2":"v2","k3":"v3"}, and filter the above original traffic by the input parameter "$.k1":"v1" to obtain the intermediate traffic that meets the scenario traffic: {"k1":"v1","k2":"v2","k3":"v3","k4":"v4"}; {"k1":"v1","k2":"v2","k3":"v33"}; {"k1":"v1","k2":"v2","k3":"v3"}.
[0067] Step S103, pre-processing the intermediate traffic to obtain a set of traffic output parameter field values.
[0068] Optionally, traverse the above intermediate traffic and perform flattening preprocessing on the output parameters of these intermediate traffic by converting the JSON object into a key-value pair, thereby obtaining a key-value pair in the form of a key-value, where the key can represent the traffic output parameter field and the value is the value of the output parameter field. It should be understood that a key can correspond to multiple values, so a set of traffic output parameter field values can be obtained.
[0069] Step S104, matching the assertion type list according to the flow outgoing parameter field value set to obtain the target assertion.
[0070] Optionally, a set of traffic parameters in a certain scenario needs to satisfy a certain logical relationship, and the abstraction of this relationship is the assertion rule. A scenario can correspond to multiple traffic, and one traffic corresponds to an assertion rule. In this way, a scenario can correspond to multiple assertion rules. Therefore, after obtaining the value set of the traffic output parameter field, you can match the assertion type list to obtain the matched target assertion. For example, the output parameter value of IsUpdating for all traffic in the scenario can only be true or false. Match the assertion type list, and the target assertion is response.body.IsUpdating in{true,false}.
[0071] In the disclosed embodiment, the original traffic in the network and the current business scenario are obtained; the original traffic is filtered according to the business scenario to obtain the intermediate traffic; the intermediate traffic is preprocessed to obtain the traffic output parameter field value set; the assertion type list is matched according to the traffic output parameter field value set to obtain the target assertion. In this way, the disclosed embodiment implements traffic filtering based on the current business scenario, and then determines the traffic output parameter field value set based on the filtered traffic to automatically match the assertion type list, thereby automatically and low-costly generating high-coverage and low-noise logical assertions, thereby achieving the purpose of improving manual efficiency, reducing noise, and improving the accuracy of generated logical assertions.
[0072] In some optional implementations, the above step S103 includes:
[0073] Step S1031, pre-processing the intermediate traffic to obtain the corresponding relationship between the traffic output parameter field and the traffic output parameter field value.
[0074] Optionally, the disclosed embodiment determines the current business scenario with the flow input parameter, matches the assertion type list with the flow output parameter, and obtains the target assertion. Therefore, when preprocessing the intermediate flow, the flow output parameter of the intermediate flow is flattened, and then a key-value pair correspondence consisting of the flow output parameter field and the flow output parameter field value is obtained.
[0075] Step S1032, determine the flow output parameter field value set according to the corresponding relationship.
[0076] Optionally, the multiple groups of correspondences obtained in step S1031 can obtain the flow output parameter field value set corresponding to each output parameter field key. For example, the intermediate flow: {"k1":"v1","k2":"v2","k3":"v3","k4":"v4"}; {"k1":"v1","k2":"v2","k3":"v33"}; {"k1":"v1","k2":"v2","k3":"v3"}, the flow output parameter field value set corresponding to the flow output parameter field k2 is v2; the flow output parameter field value set corresponding to the flow output parameter field k3 is v3, v33; the flow output parameter field value set corresponding to the flow output parameter field k4 is v4.
[0077] In the disclosed embodiment, a set of traffic output parameter field values is obtained from the correspondence between the traffic output parameter fields and the traffic output parameter field values, so as to facilitate subsequent acquisition of accurate assertion rules.
[0078] In some optional implementations, the above step S1032 includes:
[0079] Step a1, matching the flow output parameter field with the key field, wherein the key field is the field affecting the flow.
[0080] Step a2: when the traffic output parameter field is a key field, obtain the traffic output parameter field value corresponding to the key field.
[0081] Step a3, determining a flow output parameter field value set according to the flow output parameter field value.
[0082] Optionally, the traffic fields in the interface that have an important impact on the business results are called key fields, which are determined by the business party. For example, in the traffic output parameter field, response.body.CoverageData.CoveredLine, response.body.CoverageData.GitAddLine, and response.body.IsUpdating are key fields. Then match the traffic output parameter field with the key fields set above.
[0083] The flow output parameter field is matched with the key field set in step a21. If the matching rate reaches 99%, the flow output parameter field is considered to be a key field. At this time, the flow output parameter field value under the key field is obtained. According to the flow output parameter field value under the key field, the flow output parameter field value set belonging to the key field is determined.
[0084] In the disclosed embodiment, the traffic output parameter fields are screened to obtain a set of traffic output parameter field values corresponding to the key fields, thereby reducing the processing of useless traffic output parameter fields.
[0085] In some optional implementations, the above step S104 includes:
[0086] Step S1041, determine the set type of the flow outgoing parameter field value set.
[0087] Optionally, since the value of the flow output parameter field can be some specific value characters, such as v2, v22, or some numerical values, such as non-empty times, the set composed of the flow output parameter field values can be a value value set, a value value non-empty times set, etc.
[0088] Step S1042, comparing the element value in the set type with a preset threshold to obtain a comparison result.
[0089] Optionally, each set type includes a corresponding element value, which can be a specific value, such as a non-empty number of times; or a set, such as a set consisting of value characters such as v2, v22, etc. Here, it is necessary to compare these element values with corresponding preset thresholds, such as the first threshold and the second threshold, to obtain corresponding comparison results.
[0090] Step S1043, determining the assertion type of the traffic outgoing parameter field according to the comparison result, and obtaining the target assertion.
[0091] Optionally, since a scenario can have multiple types of assertion rules and multiple assertion rules, some assertion rules are set in advance, as shown in the following table:
[0092]
[0093] According to the above comparison results, match each assertion type in the above table to obtain the target assertion.
[0094] In the embodiment of the present disclosure, by obtaining the set type of the flow parameter field value set, the element value in the set type is compared with the preset threshold, and then the target assertion rule is obtained, so as to achieve the purpose of automatically generating logical assertions and solve the problems of high cost, low coverage and high noise of manually written assertions.
[0095] In some optional implementations, the above step S1042 includes:
[0096] Step b1, obtaining a preset threshold corresponding to the set type.
[0097] Step b2: when the set type is the first set type, obtain the number of elements in the flow output parameter field value set.
[0098] Step b3, comparing the number of elements with a first threshold to obtain a first comparison result.
[0099] Step b4, when the set type is the second set type, obtain the number of non-empty times in the flow output parameter field value set.
[0100] Step b5, comparing the non-empty times with a second threshold value to obtain a second comparison result.
[0101] Optionally, the server will obtain the preset threshold value corresponding to each collection type respectively, wherein the preset threshold value is used to determine whether the element value in each collection type satisfies the assertion type.
[0102] Specifically, when the set type is the first set type (such as the value set), obtain the number of all elements in the traffic output parameter field value set, such as "k2": ["v2"], the number of elements is 1; "k3": ["v3", "v33"], the number of elements is 2; "k4": ["v4"], the number of elements is 1.
[0103] Compare the number of elements with a first threshold (such as 3) to obtain a first comparison result;
[0104] When the set type is the second set type (for example, a set of non-empty times of value), obtain the non-empty times of the flow output parameter field value set, for example, "k2":3; "k3":3; "k4":1.
[0105] Compare the number of non-empty times with the second threshold (such as 2) to obtain the second comparison result.
[0106] It should be noted that the embodiment of the present disclosure can also set map1 and map2. Here, the key of map1 is the jsonpath of the flow output parameter field, and the value is the value set of the output parameter field. The key of map2 is the jsonpath of the flow output parameter field, and the value is the number of times the value of the output parameter field is non-empty, which is specifically expressed as follows:
[0107] map1:
[0108] {
[0109] "k2":["v2"],
[0110] "k3":["v3","v33"],
[0111] "k4":["v4"]
[0112] }
[0113] First threshold: 3
[0114] map2:
[0115] {
[0116] "k2":3,
[0117] "k3":3,
[0118] "k4":1
[0119] }
[0120] Second threshold: 2
[0121] In some optional implementations, the above step S1043 includes:
[0122] Step c1, when both the first comparison result and the second comparison result are true, select the first assertion type from the assertion type list to obtain the target assertion.
[0123] Step c2: when the first comparison result and / or the second comparison result is false, select a second assertion type from the assertion type list to obtain a target assertion.
[0124] Optionally, the mathematical logic of "and&&" can be used to process the first comparison result and the second comparison result. For example, the number of elements in the value set of key in map1 < the first threshold value && the number of non-empty values of key in map2 > the second threshold value. If both the first comparison result and the second comparison result are true, the above-mentioned and expression is 1, and the first assertion type, that is, the unique value rule type of key, is selected from the assertion type list as the target assertion; if the first comparison result and the second comparison result, the first comparison result or the second comparison result is false, the above-mentioned and expression is 0, and the second assertion type, that is, the enumeration rule type of key, is selected from the assertion type list as the target assertion.
[0125] In some optional implementations, after the above step S104, the method further includes:
[0126] Get the verification task type;
[0127] Generate verification traffic according to the verification task type;
[0128] Verify the traffic according to the target assertion and obtain the assertion verification result;
[0129] Feedback notification information based on the assertion verification results.
[0130] Optionally, after obtaining the target assertion, the target assertion can be verified. Here, the regression verification task and the online verification task are selected to generate verification traffic respectively, and the target assertion is tested based on the verification traffic to obtain the assertion verification result, and then the assertion verification result is fed back to the business staff, notifying the business staff to adjust the assertion script or the traffic generated in the network according to the assertion verification result.
[0131] like Figure 2 As shown, Figure 2 The present invention is a flowchart of verifying target assertions based on regression test scenarios according to an embodiment of the present invention, including creating a playback task, replaying available traffic to generate playback traffic, querying target assertions, an assertion engine verifying playback traffic, sending an assertion result report to an executor, and ending the regression task. The assertion engine inserts assertion statements into the code to check whether the program status and variable values meet expectations, thereby ensuring the correctness of the program.
[0132] like Figure 3 As shown, Figure 3 It is a flow chart of verifying a target assertion based on an online test scenario according to an embodiment disclosed in the present invention, including online traffic collection, filtering scenario traffic, loading scenario assertion rules (i.e., target assertions), an assertion engine verifying scenario traffic, generating a scenario verification report, an alarm notification, and triggering a user.
[0133] In the disclosed embodiment, target assertions are tested for verification task types, so that the provided logic assertion mode can reduce costs, improve efficiency, reduce noise, and improve the ability to proactively recall problems.
[0134] In some optional embodiments, such as Figure 4 As shown, Figure 4 Schematic diagram of the assertion rule mining method according to the disclosed embodiment of the present invention, including the following process:
[0135] The access service provides interface information, interface core fields, interface scenarios and other information for generating logical assertion rules, which are managed by the management center;
[0136] The management center initiates traffic recording and stores the recorded traffic in the big data storage component, while providing information such as scenarios and core fields in the form of interfaces;
[0137] The assertion rule mining task generates assertion rules through mining + training based on the traffic recorded by the management center, and stores them in the big data storage component;
[0138] The assertion rules of the offline data synchronization big data storage component are managed online, and the online service provides an assertion rule interface for subsequent calls.
[0139] In this embodiment, a device for assertion determination is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0140] This embodiment provides a device for assertion determination, such as Figure 5 As shown, including:
[0141] The acquisition module 501 is used to acquire the original traffic and the current service scenario in the network;
[0142] The filtering module 502 is used to filter the original traffic according to the business scenario to obtain the intermediate traffic;
[0143] A preprocessing module 503 is used to preprocess the intermediate traffic to obtain a set of traffic output parameter field values;
[0144] The matching module 504 is used to match the assertion type list according to the flow outgoing parameter field value set to obtain the target assertion.
[0145] In the disclosed embodiment, the original traffic in the network and the current business scenario are obtained; the original traffic is filtered according to the business scenario to obtain the intermediate traffic; the intermediate traffic is preprocessed to obtain the traffic output parameter field value set; the assertion type list is matched according to the traffic output parameter field value set to obtain the target assertion. In this way, the disclosed embodiment implements traffic filtering based on the current business scenario, and then determines the traffic output parameter field value set based on the filtered traffic to automatically match the assertion type list, thereby automatically and low-costly generating high-coverage and low-noise logical assertions, thereby achieving the purpose of improving manual efficiency, reducing noise, and improving the accuracy of generated logical assertions.
[0146] In some optional implementations, the preprocessing module 503 includes:
[0147] The preprocessing submodule is used to preprocess the intermediate traffic and obtain the corresponding relationship between the traffic output parameter field and the traffic output parameter field value;
[0148] The first determination submodule is used to determine a flow output parameter field value set according to the corresponding relationship.
[0149] In some optional implementations, the determining submodule includes:
[0150] A matching unit, used for matching a flow output parameter field with a key field, wherein the key field is a field affecting flow;
[0151] A first acquisition unit is used to acquire a flow output parameter field value corresponding to the key field when the flow output parameter field is a key field;
[0152] The determination unit is used to determine a flow output parameter field value set according to the flow output parameter field value.
[0153] In some optional implementations, the matching module 504 includes:
[0154] The second determination submodule is used to determine the set type of the flow output parameter field value set;
[0155] A comparison submodule is used to compare the element value in the collection type with a preset threshold value to obtain a comparison result;
[0156] The third determination submodule is used to determine the assertion type of the flow output parameter field according to the comparison result to obtain the target assertion.
[0157] In some optional implementations, the comparison submodule includes:
[0158] A second acquisition unit is used to acquire a preset threshold value corresponding to the set type;
[0159] A third acquisition unit is used to acquire the number of elements in the flow output parameter field value set when the set type is the first set type;
[0160] A first comparison unit, used for comparing the number of elements with a first threshold value to obtain a first comparison result;
[0161] A fourth acquisition unit, configured to acquire the number of non-empty times in the flow outbound parameter field value set when the set type is the second set type;
[0162] The second comparison unit is used to compare the non-empty number of times with a second threshold to obtain a second comparison result.
[0163] In some optional implementations, the third determining submodule includes:
[0164] A first selection unit is used to select a first assertion type from the assertion type list to obtain a target assertion when both the first comparison result and the second comparison result are true;
[0165] The second selection unit is used to select a second assertion type from the assertion type list to obtain a target assertion when the first comparison result and / or the second comparison result is false.
[0166] In some optional embodiments, the device further comprises:
[0167] The first acquisition module is used to match the assertion type list according to the flow parameter field value set, obtain the target assertion, and then obtain the verification task type;
[0168] A generation module, used to generate verification traffic according to the verification task type;
[0169] A verification module is used to verify the verification flow according to the target assertion and obtain the assertion verification result;
[0170] The feedback module is used to feedback notification information based on the assertion verification results.
[0171] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0172] The assertion determination device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0173] The present disclosure also provides a computer device having the above Figure 5 The assertion shown determines the device.
[0174] See also Figure 6 , Figure 6 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0175] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0176] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0177] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0178] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0179] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0180] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0181] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0182] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for assertion determination, characterized in that The method comprises: Obtain the original traffic and current business scenarios in the network; Filtering the original traffic according to the business scenario to obtain intermediate traffic; Preprocessing the intermediate traffic to obtain a traffic output parameter field value set; The target assertion is obtained by matching the assertion type list according to the flow outgoing parameter field value set.
2. The method according to claim 1, characterized in that The preprocessing of the intermediate traffic to obtain a traffic output parameter field value set includes: Preprocessing the intermediate traffic to obtain a corresponding relationship between the traffic output parameter field and the traffic output parameter field value; The flow output parameter field value set is determined according to the corresponding relationship.
3. The method according to claim 2, characterized in that The determining the flow output parameter field value set according to the corresponding relationship includes: Matching the flow output parameter field with a key field, wherein the key field is a field affecting flow; In the case where the traffic output parameter field is the key field, obtaining a value of the traffic output parameter field corresponding to the key field; The flow output parameter field value set is determined according to the flow output parameter field value.
4. The method according to any one of claims 1 to 3, characterized in that The step of matching the assertion type list according to the flow outgoing parameter field value set to obtain the target assertion includes: Determine the set type of the flow outgoing parameter field value set; Compare the element value in the set type with a preset threshold to obtain a comparison result; The assertion type of the traffic output parameter field is determined according to the comparison result to obtain the target assertion.
5. The method according to claim 4, characterized in that Comparing the element value in the set type with a preset threshold value to obtain a comparison result includes: Obtaining the preset threshold value set corresponding to the collection type; When the set type is the first set type, obtaining the number of elements in the flow output parameter field value set; Compare the number of elements with a first threshold to obtain a first comparison result; When the set type is the second set type, obtaining the number of non-empty times in the flow output parameter field value set; The non-empty number of times is compared with a second threshold to obtain a second comparison result.
6. The method according to claim 5, characterized in that The determining the assertion type of the flow output parameter field according to the comparison result to obtain the target assertion includes: When both the first comparison result and the second comparison result are true, selecting a first assertion type from the assertion type list to obtain the target assertion; When the first comparison result and / or the second comparison result is false, a second assertion type is selected from the assertion type list to obtain the target assertion.
7. The method according to claim 1, characterized in that After matching the assertion type list according to the flow outgoing parameter field value set to obtain the target assertion, the method further includes: Get the verification task type; Generate verification traffic according to the verification task type; Verify the verification flow according to the target assertion to obtain an assertion verification result; Feedback notification information based on the assertion verification result.
8. An assertion determination device, characterized in that The device comprises: The acquisition module is used to obtain the original traffic and current business scenarios in the network; A filtering module, used to filter the original traffic according to the business scenario to obtain intermediate traffic; A preprocessing module, used for preprocessing the intermediate traffic to obtain a set of traffic output parameter field values; The matching module is used to match the assertion type list according to the flow outgoing parameter field value set to obtain the target assertion.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the assertion determination method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the assertion determination method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the assertion determination method according to any one of claims 1 to 7.