CN117453577B - Method, device and computer equipment for generating interface automation use case based on flow recording - Google Patents

Method, device and computer equipment for generating interface automation use case based on flow recording Download PDF

Info

Publication number
CN117453577B
CN117453577B CN202311788148.1A CN202311788148A CN117453577B CN 117453577 B CN117453577 B CN 117453577B CN 202311788148 A CN202311788148 A CN 202311788148A CN 117453577 B CN117453577 B CN 117453577B
Authority
CN
China
Prior art keywords
data
interface
target
response
request data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311788148.1A
Other languages
Chinese (zh)
Other versions
CN117453577A (en
Inventor
李蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Xingsheng Optimization Network Technology Co ltd
Original Assignee
Hunan Xingsheng Optimization Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Xingsheng Optimization Network Technology Co ltd filed Critical Hunan Xingsheng Optimization Network Technology Co ltd
Priority to CN202311788148.1A priority Critical patent/CN117453577B/en
Publication of CN117453577A publication Critical patent/CN117453577A/en
Application granted granted Critical
Publication of CN117453577B publication Critical patent/CN117453577B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable

Abstract

The application relates to a method, a device and computer equipment for generating an interface automation use case based on flow recording. Comprising the following steps: acquiring recorded flow data, and determining the interface type of a target interface corresponding to the flow data; analyzing request data and response data in the flow data, and performing assertion analysis according to whether the response data is consistent with the request data or not to obtain an assertion result; when the interface type is a single interface, parameterizing the request data according to the request data and the assertion result to obtain target request data; and determining the interface automation use case of the target interface according to the target request data. By adopting the method, the accuracy of the automatic use case generation of the interface is improved.

Description

Method, device and computer equipment for generating interface automation use case based on flow recording
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, and a computer device for generating an interface automation use case based on flow recording.
Background
In the field of computer technology, it is often necessary to test a system or an application program, such as testing an internal interface based on an interface flow, and then performing an interface automation use case generation based on a result of a test analysis.
At present, when interface data is acquired in a flow recording mode, the flow data is directly stored as an automatic interface use case for a single interface, then playback is performed in a Mock sub-calling mode, and whether the playback is successful is judged by comparing certain fields appointed in a returned result. For the link interface, if the same identification is adopted, the traffic with the same identification is automatically assembled into the link interface for playback.
The existing scheme has the following defects: (1) If the request data is out of date, the interface return value does not return an expected result under the condition that the Mock is not called by the sub-call; (2) When the identifiers of different interfaces are different, the interfaces cannot be automatically connected in series, and if a scene has a plurality of link interfaces, the specific scene is difficult to intuitively distinguish through the naming of the interfaces; (3) When the request parameters change, the interface assertion fails to assert or the assertion of the key field is easy to miss.
Disclosure of Invention
Based on this, the present application aims to provide a method, a device and a computer device for generating an interface automation use case based on flow recording, so as to solve the above-mentioned technical problems.
In a first aspect, the present application provides a method for generating an interface automation use case based on a flow record. Comprising the following steps:
acquiring recorded flow data, and determining the interface type of a target interface corresponding to the flow data;
analyzing request data and response data in the flow data, and performing assertion analysis according to whether the response data is consistent with the request data or not to obtain an assertion result;
when the interface type is a single interface, parameterizing the request data according to the request data and the assertion result to obtain target request data;
and determining the interface automation use case of the target interface according to the target request data.
In one embodiment, after parsing the request data and the response data in the traffic data, the method further comprises: storing the request data to the first data set in the form of key value pairs, and storing the response data to the second data set in the form of key value pairs; the key-value pair includes a key and a key value.
In one embodiment, performing an assertion analysis on the response data to obtain an assertion result includes: determining node information of response data acquired from the second data set; determining all historical flow of a target interface in a preset period and corresponding historical node information of response data in each historical flow; and obtaining an assertion result according to the node information and each history node information.
In one embodiment, parameterizing the request data according to the request data and the assertion result to obtain target request data includes: when the interface type is single interface and the assertion result representation is asserted, replacing the request key value in the request data according to the preset target configuration to obtain target request data.
In one embodiment, the method further comprises: when the interface type is a link interface, determining upstream flow data and downstream flow data in a plurality of pieces of sub-flow data; matching the upstream response data in the upstream flow data with the downstream request data in the downstream flow data to obtain target upstream response data and target downstream request data; and determining an interface automation use case of the link interface according to the target upstream response data and the target downstream request data.
In one embodiment, matching the upstream response data in the upstream traffic data with the downstream request data in the downstream traffic data to obtain target upstream response data and target downstream request data includes: traversing a target key value pair matched with a current upstream key value pair from a plurality of downstream key value pairs in downstream request data aiming at each of the plurality of upstream key value pairs; taking the target keywords in the target key value pair as post variables of the upstream response data to obtain target upstream response data; and carrying out parameterization processing on the downstream request data through the target key value in the target key value pair to obtain target downstream request data.
In one embodiment, determining an interface automation use case of the link interface according to the target upstream response data and the target downstream request data comprises: carrying out interface serial connection on upstream flow data corresponding to the target upstream response data and downstream flow data corresponding to the target downstream request data, and generating an interface automation use case; further comprises: and naming an upstream interface and a downstream interface in the interface serial connection through the target key value pair.
In a second aspect, the present application further provides a device for generating an interface automation use case based on flow recording. Comprising the following steps:
the data analysis module is used for acquiring recorded flow data and determining the interface type of a target interface corresponding to the flow data; analyzing request data and response data in the flow data, and carrying out assertion analysis on the response data to obtain an assertion result;
the parameterization processing module is used for parameterizing the request data according to the request data and the assertion result when the interface type is a single interface, so as to obtain target request data;
and the use case generating module is used for determining the interface automation use case of the target interface according to the target request data.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring recorded flow data, and determining the interface type of a target interface corresponding to the flow data;
analyzing request data and response data in the flow data, and carrying out assertion analysis on the response data to obtain an assertion result;
when the interface type is a single interface, parameterizing the request data according to the request data and the assertion result to obtain target request data;
and determining the interface automation use case of the target interface according to the target request data.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which when executed by a processor performs the steps of:
acquiring recorded flow data, and determining the interface type of a target interface corresponding to the flow data;
analyzing request data and response data in the flow data, and carrying out assertion analysis on the response data to obtain an assertion result;
when the interface type is a single interface, parameterizing the request data according to the request data and the assertion result to obtain target request data;
and determining the interface automation use case of the target interface according to the target request data.
In the method, the device and the computer equipment for generating the interface automation use case based on the flow recording, the recorded flow data is analyzed to determine the interface type of the target interface corresponding to the flow data, so that the request data and the response data in the flow data can be analyzed, and further the response data is subjected to assertion analysis to obtain an assertion result. Therefore, the problem that when the request parameters change, the whole data assertion comparison fails and the problem that part of data assertion comparison needs to evaluate and select assertion fields manually are avoided, so that the accuracy of assertion is improved. Meanwhile, when the interface type is a single interface, the request data can be directly parameterized according to the request data and the assertion result, so that the problem that the request data cannot be parameterized is solved, and the interface return value can return the expected result, thus improving the accuracy of the subsequent interface automation use case for generating the target interface according to the target request data.
Drawings
FIG. 1 is an application environment diagram of an automated use case method for generating interfaces based on flow recording in one embodiment;
FIG. 2 is a flow chart of an example method for generating interface automation based on flow recording in one embodiment;
FIG. 3 is a flow diagram of processing traffic data in one embodiment;
fig. 4 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The method for generating the interface automation use case based on the flow recording can be applied to an application environment shown in fig. 1. The terminal 102 communicates with the server 104 through a network, which may be a blockchain network. The terminal 102 is configured to send recorded traffic data determined by a user to the server 104. The server 104 is configured to determine an interface type of a target interface corresponding to the flow data; and analyzing the request data and the response data in the flow data, and carrying out assertion analysis on the response data to obtain an assertion result. The server 104 is further configured to, when the interface type is a single interface, perform parameterization processing on the request data according to the request data and the assertion result, so as to obtain target request data; and determining the interface automation use case of the target interface according to the target request data. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, unmanned aerial vehicle devices, intelligent vehicle devices, portable wearable devices, and the like. The server 104 may be implemented by a stand-alone server or a server cluster formed by a plurality of servers, and may also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), and basic cloud computing services such as big data and artificial intelligence platforms.
In one embodiment, as shown in fig. 2, a method for generating an interface automation use case based on a flow record is provided, and the method is applied to a computer device for example, where the computer device may be a terminal or a server in fig. 1, or may be a computer device with an integrated terminal and server, and includes:
step 202, obtaining recorded flow data, and determining the interface type of the target interface corresponding to the flow data.
Before releasing the new version, the application program or the computer system needs to test the newly developed version, and the predetermined running environment is the running environment of the application program or the computer system in use by the user. Thus, the computer device obtains a plurality of pieces of traffic data of an application program or a computer system being used by the user by recording traffic of a predetermined running environment.
Specifically, the computer device responds to the query operation of the user, and determines all flow data meeting the conditions by querying the interface with the URI identifier. The computer device responds to the selection operation of the user to select one flow from all flow data meeting the conditions as the flow of the subsequent interface automation use case needing to be generated, such as flow data A.
The interface type of the target interface at least comprises a single interface and a link interface; the single interface characterizes the flow data obtained by the target interface and can be directly stored as an interface of an interface automation use case; the link interface characterizes the parameters of one interface as the parameters of the other interface, and the interface of the automatic use case of the interface is represented by the parameter transfer relation.
And 204, analyzing the request data and the response data in the flow data, and performing assertion analysis according to whether the response data is consistent with the request data or not to obtain an assertion result.
The flow data at least comprises an interface identifier, request data and response data, wherein the interface identifier is a URI identifier; specifically, the assertion analysis characterizes a pre-judgment on the response result of the interface, if the pre-judgment result is met, the response of the interface is correct, and the pre-judgment process is, for example, whether the similarity between different response data meets the target value. More specifically, whether the response data is consistent with the request data is optional but not limited to being completely consistent or with a high probability. For example, if the data requests 100 times, a probability threshold is optionally but not limited to be set, for example, 0.8, and if more than 80 times of response data obtained by 100 times of data requests are consistent, the response data is consistent with the request data; if the data matches 80 times or less, it means that the response data does not match the request data. More specifically, the agreement may be optionally but not limited to determined based on the similarity determination. The criterion for the consistency determination can be arbitrarily set by those skilled in the art according to the determination mode of data processing.
Specifically, as shown in fig. 3, fig. 3 is a schematic flow chart of processing flow data in one embodiment. In the process of carrying out flow preprocessing on the flow data, the computer equipment can obtain request data corresponding to the input parameters and response data corresponding to the output parameters by analyzing the input parameters and the analysis parameters. The method comprises the steps that computer equipment obtains all historical flow in a preset time range of a target interface, and carries out similarity judgment on response data and response data in the historical flow, if the similarity accords with a target value, an assertion result representing assertion is obtained, namely response of the target interface is effective; if the similarity does not meet the target value, an assertion result which is characterized as not being asserted is obtained, namely the response of the target interface is invalid.
In one embodiment, after parsing the request data and the response data in the traffic data, the method further comprises: the request data is stored in the form of key value pairs to the first data set, and the response data is stored in the form of key value pairs to the second data set.
Wherein, the key value pair comprises a key word and a key value, namely a key-value format; the first data set is used for storing all parsed request data and can be named Save Deal Request; the second data set is used to store all parsed response data, which may be named Save Deal Response.
And 206, when the interface type is a single interface, carrying out parameterization processing on the request data according to the request data and the assertion result to obtain target request data.
Specifically, referring to fig. 3, for a single interface, the computer device obtains target parameters, such as target key value pairs, meeting conditions in the request data according to target rules by analyzing the request data in all traffic data and obtaining set target rules, such as all time format parameters being parameterized. The computer device compares all the flow data and judges whether the target parameters match the target rules in all the flow data. If the data are not matched, skipping, and if all the data are matched, directly parameterizing and storing the target parameters of the request data when the flow data of the target interface are stored. The computer equipment can also parameterize the target parameters when the data flow is saved by configuring the target interface and the mapping relation of the input parameters needing parameterization. The parameterized value is obtained in a self-adaptive manner according to an interface automation platform.
Step 208, determining the interface automation use case of the target interface according to the target request data.
Specifically, the computer device synthesizes the target request data and the response data subjected to the analysis of the break, can obtain new flow data, and stores the new flow data as an interface automation use case, as shown in fig. 3, so that when testing the code of the application program or the system, the application program or the interface of the system is tested through the interface automation use case.
According to the method for generating the interface automation use case based on the flow recording, the recorded flow data is analyzed to determine the interface type of the target interface corresponding to the flow data, so that the request data and the response data in the flow data can be analyzed, and further the response data is subjected to assertion analysis to obtain an assertion result. Therefore, the problem that when the request parameters change, the whole data assertion comparison fails and the problem that part of data assertion comparison needs to evaluate and select assertion fields manually are avoided, so that the accuracy of assertion is improved. Meanwhile, when the interface type is a single interface, the request data can be directly parameterized according to the request data and the assertion result, so that the problem that the request data cannot be parameterized is solved, and the interface return value can return the expected result, thus improving the accuracy of the subsequent interface automation use case for generating the standard interface according to the target request data.
In one embodiment, performing an assertion analysis on the response data to obtain an assertion result includes: determining node information of response data acquired from the second data set; determining all historical flow of a target interface in a preset period and corresponding historical node information of response data in each historical flow; and obtaining an assertion result according to the node information and each history node information.
The node information comprises a response keyword and a response key value corresponding to the response data; the history node information comprises history keywords and history key values corresponding to response data in the history traffic.
Specifically, after the computer device obtains the response data from the second data set, node information for obtaining the response data, such as JSONPath node information, is determined, where the node may also be the JSONPath node of the outermost layer. The method comprises the steps that the computer equipment determines all historical flow of a target interface in a preset period and corresponding historical node information of response data in each historical flow, and statistics is carried out on historical key values in all the historical node information. If the response key value is of a target type, such as a character string or a number type, the computer device determines the duty ratio of the number of occurrences of the response key value in all the historical key values, and if the duty ratio reaches a preset target value, the response key value is asserted. For the case where the node information corresponds to jsonoobject, array, or JSONArray, the computer device asserts by determining whether the response key is null or null set.
For example, the JSONPath node information defining the response data of an interface is "$.code", the number of all traffic data of the interface is 100, the statistics of the values corresponding to the nodes are that "1001" appears 90 times and "—1001" appears 10 times, then "1001" accounts for 90++100=90%, and "++1001" accounts for 10++100=10%, assuming that the set target value is 85% because 90++85%, and the "$.code" node of all the interfaces is asserted as "1001".
In the embodiment, the situation that the assertion needs to be determined in a targeted manner can be determined by determining the situation that the response key value in the node information of the response data accounts for all the historical traffic and further determining whether to perform assertion analysis, so that the problem of inaccurate assertion in full-data assertion or partial-data assertion is solved.
In one embodiment, performing parameterization processing on the request data according to the request data and the assertion result, and obtaining the target request data includes: when the interface type is single interface and the assertion result representation is asserted, replacing the request key value in the request data according to the preset target configuration to obtain target request data.
Wherein the request data includes a request key and a request key value. The target configuration may include a Config configuration, characterizing that data formatted as "yyyy-MM-dd" for all parameter values is parameterized as T. The computer device reads the target configuration, i.e. the configuration that is effective for all interfaces, and the configuration information in the interface configuration, i.e. the configuration that is effective for the interface that specifies the URI identification.
Specifically, the computer device stores the request data in the Map in advance according to a key-value format, wherein the key value is the information of the target node, such as a JSONPath node, where the request key appears in the request data. For example, $data. Datalist [0]. Datatime, value is the request key value in the request data, e.g. "2023-08-01". The computer equipment judges whether the request data matches the target rule, if so, the request key value conforming to the Config configuration is replaced by a new request key value, namely, the parameterized request key value is replaced by $ { T }, and the target node information corresponding to the new request key value is recorded. And the computer equipment synthesizes the request key words in the request data and the replaced new request key values to obtain target request data corresponding to the flow data.
In this embodiment, the target request data is obtained by determining a mapping relationship between the target configuration and the request key value that needs to be parameterized, and parameterizing the request key value when the traffic data is stored. Therefore, when the flow data is executed later, the return value of the target interface can be ensured to return the expected result according to the target request data accurately.
In one embodiment, the traffic data includes a plurality of pieces of sub-traffic data; when the interface type is a link interface, determining upstream flow data and downstream flow data in a plurality of pieces of sub-flow data; matching the upstream response data in the upstream flow data with the downstream request data in the downstream flow data to obtain target upstream response data and target downstream request data; and determining an interface automation use case of the link interface according to the target upstream response data and the target downstream request data.
Specifically, the computer equipment matches upstream response data of an upstream interface and downstream request data of a downstream interface of a serial link, and determines the same target parameters according to a matching result; the target parameter may be a plurality of target key value pairs. And the computer equipment respectively updates the upstream response data and the downstream request data according to the target parameters to obtain updated target upstream response data and target downstream request data. The computer equipment carries out interface serial connection on the upstream flow data corresponding to the target upstream response data and the downstream flow data corresponding to the target downstream request data, and generates an interface automation use case associated with the link interface so as to realize automatic generation of the use case for testing the logic relationship between the link interfaces.
Further, matching the upstream response data in the upstream flow data with the downstream request data in the downstream flow data to obtain target upstream response data and target downstream request data, including: traversing a target key value pair matched with a current upstream key value pair from a plurality of downstream key value pairs in downstream request data aiming at each of the plurality of upstream key value pairs; taking the target keywords in the target key value pair as post variables of the upstream response data to obtain target upstream response data; and carrying out parameterization processing on the downstream request data through the target key value in the target key value pair to obtain target downstream request data.
Wherein the upstream response data includes a plurality of upstream key-value pairs; the downstream request data includes a plurality of downstream key-value pairs; the upstream key value pair comprises an upstream key word and an upstream key value; the downstream key-value pair includes a downstream key and a downstream key-value.
Specifically, when it is determined that key value pairs in the upstream response data and the downstream request data need to be matched, the computer device traverses a plurality of downstream key values in the downstream request data until a target key value pair matched with the current upstream key value pair can be found. If not, stopping the process of the target upstream response data and the target downstream request data by the computer equipment. The computer equipment extracts the target key words in the target key value pair and takes the target key words as the post variables of the upstream response data to obtain new target upstream response data, so that the computer equipment automatically extracts the actual values of the post variables and stores the actual values after the execution of the A is completed. The computer equipment extracts a target key value in the target key value pair, replaces the downstream key value in the downstream request data according to preset target configuration to obtain target downstream request data, and enables the target key value to be replaced with a real value corresponding to the downstream key value in the downstream request data before executing the step B.
For example, there are upstream traffic data a and downstream traffic data B with different traceids, the upstream response data of a in the second data set and the downstream request data of B in the first data set are determined, where the upstream response data of a is { "request a":1, "request a1": "Zhang San," request a2":" China "}, where {" request a ":1}, {" request a1": zhang San}, {" request a2":" China "} are a key pair, and the downstream request data of B is {" request a1": zhang San," nickName ": zhang San}, respectively. And determining that the target key value pair is { "RequestA1": "Zhang Sanzh}, wherein" RequestA1 "is a target key word and" Zhang Sanzhu "is a target key value. Therefore, the target key value 'Zhang Sanj' is used as a post-variable of the upstream response data A, and the downstream key value of { "request A1": "Zhang Sanj" in B is replaced by "$ { request A }" through the target key word 'request A1', and finally the B is { "request A1": "$ { request A1}", "nickName": "Zhang Sanj" can be obtained.
It is easy to understand that the computer device may directly match an upstream key value in the upstream key values with a downstream key value in the downstream key values, and further match an upstream key and a downstream key corresponding to the matched key values. The matched key words and key values are in a condition of many-to-many or one-to-many between the upstream response data and the downstream request data. Referring to the above example, the same key value "Zhang San", was first matched from the two, and then the multiple keywords (requestA 1, nickName) were matched.
In this embodiment, the matching condition between the upstream response data of the previous interface and the downstream request data of the next interface is automatically identified in the interfaces that need to be connected in series to form a link, so that the target upstream response data and the target downstream request data are obtained according to the matching condition, the interfaces can be accurately connected in series according to the target upstream response data and the target downstream request data, the automatic interface use case associated with the link interface is quickly generated, and the real scene of the generated use case is more consistent. Meanwhile, as the parameterization processing is carried out on the downstream request data, the problem that the execution failure of the downstream interface is caused by the change of the response data of the upstream interface is avoided.
In one embodiment, upstream and downstream interfaces in the interface series are named by the target key value pair.
Specifically, the computer device performs interface naming according to the fixed prefix, the interface URI identification and the target key value pair. Wherein a corresponds to the upstream interface and B corresponds to the downstream interface, the link interface using a fixed prefix such as the form of link-; the interface URI of the upstream interface is identified as interface A, and the interface URI of the downstream interface is identified as interface B. Thus, the computer device concatenates the fixed prefix, the interface URI identification, and the target key value, e.g., the upstream interface designation: (Link-interfaceA- "RequestA1": "Zhang Sanj"). If a downstream interface corresponding to C exists in the downstream interface of B, B is taken as new A, C is taken as new B, and the matching process of the upstream response data in the upstream flow data and the downstream request data in the downstream flow data is carried out continuously. If the downstream interface does not exist in the B, the splicing of the target key value pair is omitted, and the downstream interface corresponding to the B is named as: (link-interfaceB), and a and B at this time are on one link.
In this embodiment, the interface naming uses the successfully matched target key value pair in the link as the naming key, which can play a role of name meaning, that is, the interface naming can be used to quickly index the upstream interface and the downstream interface, so that the parameter transfer relationship between different interfaces can be quickly indexed, and the problem that the naming of the interfaces is difficult to intuitively distinguish the specific scene when the application scene has a plurality of link interfaces is avoided.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a device for realizing the method for generating the interface automation use case based on the flow recording based on the method for generating the interface automation use case based on the flow recording. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the device provided below for one or more embodiments of the device for generating an interface automation case based on flow recording may be referred to above for the limitation of the method for generating an interface automation case based on flow recording, which is not described herein again.
In one embodiment, an apparatus for generating an interface automation use case based on a flow record is provided, including: the system comprises a data analysis module, a parameterization processing module and a use case generation module, wherein:
the data analysis module is used for acquiring recorded flow data and determining the interface type of a target interface corresponding to the flow data; and analyzing the request data and the response data in the flow data, and carrying out assertion analysis on the response data to obtain an assertion result.
And the parameterization processing module is used for parameterizing the request data according to the request data and the assertion result when the interface type is single interface, so as to obtain target request data.
And the use case generating module is used for determining the interface automation use case of the target interface according to the target request data.
The above-mentioned modules in the flow record-based generation interface automation use case may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing cross-chain transactions. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method for generating an interface automation use case based on a flow record.
Those skilled in the art will appreciate that the structures shown in FIG. 4 are block diagrams only and do not constitute a limitation of the computer device on which the present aspects apply, and that a particular computer device may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
Those skilled in the art will appreciate that implementing all or part of the above-described embodiment methods may be accomplished by way of a computer program that instructs associated hardware to perform the method, and that the computer program may be stored on a non-volatile computer readable storage medium, which when executed, may comprise the embodiment flows of the above-described methods. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not thereby to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (9)

1. A method for generating an interface automation use case based on flow recording, comprising:
acquiring recorded flow data and determining the interface type of a target interface corresponding to the flow data;
analyzing request data and response data in the flow data, and determining node information of the response data acquired from a second data set; the node information comprises a response keyword and a response keyword value corresponding to the response data;
determining all historical flow of the target interface in a preset period and corresponding historical node information of response data in each historical flow; the history node information comprises a history key value corresponding to response data in the history flow;
when the response keyword is of a target type, according to the ratio of the number of the response keywords appearing in the historical keywords, obtaining an assertion result;
when the interface type is a single interface, parameterizing the request data according to the request data and an assertion result representing that the response of the target interface is effective, so as to obtain target request data;
and determining an interface automation use case of the target interface according to the target request data.
2. The method of claim 1, wherein after said parsing request data and response data in said traffic data, the method further comprises:
storing the request data to a first data set in the form of key value pairs, and storing the response data to a second data set in the form of key value pairs; the key-value pair includes a key and a key value.
3. The method of claim 1, wherein the request data includes a request key and a request key value; and performing parameterization processing on the request data according to the request data and the assertion result to obtain target request data, wherein the parameterization processing comprises the following steps:
when the interface type is single interface and the assertion result represents that assertion is performed, replacing the request key value in the request data according to preset target configuration to obtain target request data.
4. The method of claim 1, wherein the traffic data comprises a plurality of pieces of sub-traffic data; the method further comprises the steps of:
when the interface type is a link interface, determining upstream flow data and downstream flow data in a plurality of pieces of sub-flow data;
matching the upstream response data in the upstream flow data with the downstream request data in the downstream flow data to obtain target upstream response data and target downstream request data;
and determining an interface automation use case of the link interface according to the target upstream response data and the target downstream request data.
5. The method of claim 4, wherein the upstream response data comprises a plurality of upstream key-value pairs; the downstream request data includes a plurality of downstream key-value pairs; the matching the upstream response data in the upstream flow data with the downstream request data in the downstream flow data to obtain target upstream response data and target downstream request data includes:
traversing a target key value pair matched with a current upstream key value pair from a plurality of downstream key value pairs in the downstream request data aiming at each of the plurality of upstream key value pairs;
taking the target keywords in the target key value pair as the post variables of the upstream response data to obtain target upstream response data;
and carrying out parameterization processing on the downstream request data through the target key value in the target key value pair to obtain target downstream request data.
6. The method of claim 5, wherein said determining an interface automation use case for the link interface based on the target upstream response data and the target downstream request data comprises:
carrying out interface serial connection on upstream flow data corresponding to the target upstream response data and downstream flow data corresponding to the target downstream request data, and generating an interface automation use case;
the method further comprises the steps of: and naming an upstream interface and a downstream interface in the interface series through the target key value pair.
7. An apparatus for generating an interface automation use case based on flow recording, comprising:
the data analysis module is used for acquiring recorded flow data and determining the interface type of a target interface corresponding to the flow data; analyzing request data and response data in the flow data, and determining node information of the response data acquired from a second data set; the node information comprises a response keyword and a response keyword value corresponding to the response data; determining all historical flow of the target interface in a preset period and corresponding historical node information of response data in each historical flow; the history node information comprises a history key value corresponding to response data in the history flow; when the response keyword is of a target type, according to the ratio of the number of the response keywords appearing in the historical keywords, obtaining an assertion result;
the parameterization processing module is used for parameterizing the request data according to the request data and the assertion result representing that the response of the target interface is effective when the interface type is a single interface, so as to obtain target request data;
and the use case generation module is used for determining an interface automation use case of the target interface according to the target request data.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311788148.1A 2023-12-25 2023-12-25 Method, device and computer equipment for generating interface automation use case based on flow recording Active CN117453577B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311788148.1A CN117453577B (en) 2023-12-25 2023-12-25 Method, device and computer equipment for generating interface automation use case based on flow recording

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311788148.1A CN117453577B (en) 2023-12-25 2023-12-25 Method, device and computer equipment for generating interface automation use case based on flow recording

Publications (2)

Publication Number Publication Date
CN117453577A CN117453577A (en) 2024-01-26
CN117453577B true CN117453577B (en) 2024-03-22

Family

ID=89591317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311788148.1A Active CN117453577B (en) 2023-12-25 2023-12-25 Method, device and computer equipment for generating interface automation use case based on flow recording

Country Status (1)

Country Link
CN (1) CN117453577B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110232016A (en) * 2019-03-08 2019-09-13 上海蔚来汽车有限公司 Interface testing case generation method, device and controller and medium
CN110990250A (en) * 2019-10-12 2020-04-10 平安医疗健康管理股份有限公司 Interface test method, device, equipment and storage medium
KR102307471B1 (en) * 2020-07-31 2021-09-30 시와소프트 주식회사 Robotic process automation system
CN113886221A (en) * 2021-09-13 2022-01-04 前海飞算云智软件科技(深圳)有限公司 Test script generation method and device, storage medium and electronic equipment
CN115629967A (en) * 2022-10-08 2023-01-20 兴业银行股份有限公司 Method and system for completing interface automation case generation and execution based on flow acquisition
WO2023123943A1 (en) * 2021-12-27 2023-07-06 深圳前海微众银行股份有限公司 Interface automation testing method and apparatus, and medium, device and program

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7149189B2 (en) * 2001-07-17 2006-12-12 Mcafee, Inc. Network data retrieval and filter systems and methods
CN111813701B (en) * 2020-09-09 2020-12-25 平安国际智慧城市科技股份有限公司 HTTP-based interface testing method and device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110232016A (en) * 2019-03-08 2019-09-13 上海蔚来汽车有限公司 Interface testing case generation method, device and controller and medium
CN110990250A (en) * 2019-10-12 2020-04-10 平安医疗健康管理股份有限公司 Interface test method, device, equipment and storage medium
KR102307471B1 (en) * 2020-07-31 2021-09-30 시와소프트 주식회사 Robotic process automation system
CN113886221A (en) * 2021-09-13 2022-01-04 前海飞算云智软件科技(深圳)有限公司 Test script generation method and device, storage medium and electronic equipment
WO2023123943A1 (en) * 2021-12-27 2023-07-06 深圳前海微众银行股份有限公司 Interface automation testing method and apparatus, and medium, device and program
CN115629967A (en) * 2022-10-08 2023-01-20 兴业银行股份有限公司 Method and system for completing interface automation case generation and execution based on flow acquisition

Also Published As

Publication number Publication date
CN117453577A (en) 2024-01-26

Similar Documents

Publication Publication Date Title
US11372694B2 (en) Systems and methods to identify breaking application program interface changes
US11748358B2 (en) Feedback on inferred sourcetypes
US11196756B2 (en) Identifying notable events based on execution of correlation searches
WO2021051627A1 (en) Database-based batch importing method, apparatus and device, and storage medium
CN113010476B (en) Metadata searching method, device, equipment and computer readable storage medium
US20230024345A1 (en) Data processing method and apparatus, device, and readable storage medium
CN112395157A (en) Audit log obtaining method and device, computer equipment and storage medium
CN112883125A (en) Entity data processing method, device, equipment and storage medium
CN109471874A (en) Data analysis method, device and storage medium
CN114238085A (en) Interface testing method and device, computer equipment and storage medium
CN117453577B (en) Method, device and computer equipment for generating interface automation use case based on flow recording
CN117376092A (en) Fault root cause positioning method, device, equipment and storage medium
CN115658680A (en) Data storage method, data query method and related device
CN114281549A (en) Data processing method and device
CN110968267A (en) Data management method, device, server and system
CN113806504B (en) Multi-dimensional report data calculation method and device and computer equipment
CN115599976B (en) User grouping method, device, electronic equipment and storage medium
CN116880927A (en) Rule management method, device, computer equipment and storage medium
CN115629958A (en) Universal field level automatic checking method and device for different service interfaces
CN117743190A (en) Verification method and device for interface data flow playback and computer equipment
CN117097617A (en) Template management method, device, computer equipment and storage medium of communication system
CN116955469A (en) Service alarm tracing method based on blood margin analysis
CN116362230A (en) Parameter verification method, device and computer equipment storable medium
CN114461659A (en) Searching and killing method and device, computer equipment and storage medium
CN117235705A (en) Centralized control method and device for embedded equipment and computer equipment

Legal Events

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