CN117785674A - Interface use case generation method, device, computer equipment and storage medium - Google Patents
Interface use case generation method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN117785674A CN117785674A CN202311729448.2A CN202311729448A CN117785674A CN 117785674 A CN117785674 A CN 117785674A CN 202311729448 A CN202311729448 A CN 202311729448A CN 117785674 A CN117785674 A CN 117785674A
- Authority
- CN
- China
- Prior art keywords
- interface
- field
- generating
- use case
- log
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 238000012360 testing method Methods 0.000 claims abstract description 49
- 238000004590 computer program Methods 0.000 claims description 21
- 230000008569 process Effects 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 6
- 230000006872 improvement Effects 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The application relates to an interface use case generation method, an interface use case generation device, computer equipment and a storage medium. The interface use case generation method comprises the following steps: generating an interface request log; the interface request log comprises various fields required for generating interface use cases; collecting data information of each field in the history log, and matching the data information of each field with each field in the interface request log to obtain a plurality of field groups; assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate; and generating an interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate. The method provided by the invention can automatically generate the interface case, and efficiently solve the problems of low writing efficiency and difficult coverage rate improvement of the interface test case.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating an interface use case, a computer device, and a storage medium.
Background
With the high-speed development of the Internet, the iterative updating speed of the product is faster and faster, and the efficiency and quality requirements of the software project development process are higher and higher. The software interface test refers to testing interfaces in a software system to verify performance of the interfaces in terms of functions, performance, safety and the like under different conditions. Interface automation testing is a process of performing interface testing by writing scripts and using automated testing tools, and thus is critical to quality and efficiency improvements.
The interface test cases are a set of test cases for testing interfaces in a software system. In the traditional technology, the interface case is manually written, however, the manual writing cost is higher, the quality of the test case is not well measured, and the test coverage of the code is not obviously improved.
Disclosure of Invention
In view of the above, it is necessary to provide an interface use case generating method, apparatus, computer device, and storage medium capable of automatically generating an interface use case, in order to solve the above-described technical problems of high cost and uncontrollable quality of manually writing an interface use case.
In a first aspect, the present application provides an interface use case generating method, where the method includes:
generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
collecting data information of each field in a history log, and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate;
and generating an interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
In one embodiment, the generating an interface request log; the interface request log includes fields required for generating an interface use case, including:
acquiring each field required by generating the interface use case, and formatting each field to make the formats of each field consistent;
and generating an interface request log based on the fields after the formatting process.
In one embodiment, the collecting each field of data information in the history log includes:
acquiring a target format after formatting processing of each field, and acquiring a history record generated by a log;
and acquiring field data information matched with each field in the history record based on the target format.
In one embodiment, before the assembling each field set obtains an interface request, performing test execution with the interface request, and generating code coverage, the method further includes:
and importing a plurality of field groups into an interface use case database.
In one embodiment, after generating the interface use case based on the interface request, in a case where the code coverage is greater than the historical code coverage, the method further includes:
and storing the interface use cases into the interface use case database.
In one embodiment, the method further comprises:
and under the condition that the code coverage rate is smaller than or equal to the historical code coverage rate, the interface use case is not generated.
In a second aspect, the present application further provides an interface use case generating device. The device comprises:
the log generation module is used for generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
the field data matching module is used for collecting each field data information in the history log and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
the code coverage rate generation module is used for assembling each field group to obtain an interface request, performing test execution by adopting the interface request and generating code coverage rate;
and the interface use case generating module is used for generating the interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
collecting data information of each field in a history log, and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate;
and generating an interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
collecting data information of each field in a history log, and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate;
and generating an interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
In a fifth aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of:
generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
collecting data information of each field in a history log, and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate;
and generating an interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
According to the method, the device, the computer equipment and the storage medium for generating the interface use case, firstly, the interface request log is generated based on the fields of the interface use case, then the field data information matched with the fields is collected in the history log, after the field data information and the fields are matched to obtain the field groups, each field group is spliced and combined according to the preset business logic algorithm to obtain the interface request, then the interface request is adopted for test execution and code coverage rate generation, if the newly obtained code coverage rate is improved, the fact that the interface use case is absent in the current interface use case database is considered to be effective, and the interface use case is generated based on the interface request. Compared with the scheme of manually generating the interface cases in the traditional technology, the method provided by the invention can automatically generate the interface cases, and efficiently solve the problems of low writing efficiency and difficult coverage rate improvement of the interface test cases.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is an application environment diagram of an interface use case generation method in one embodiment;
FIG. 2 is a flow chart of a method for generating an interface use case in one embodiment;
FIG. 3 is a flow diagram of the steps for generating an interface request log in one embodiment;
FIG. 4 is a flow chart illustrating the steps of collecting field data information in one embodiment;
FIG. 5 is a flowchart of an interface use case generation method according to another embodiment;
FIG. 6 is a block diagram of an interface use case generating device in one embodiment;
fig. 7 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 interface use case generation method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The interface use case is a set of test use cases for testing an interface in the software system, and the interface request log may be a log generated by a user in calling the interface, and then the interface use case is generated based on the interface request log. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In an exemplary embodiment, as shown in fig. 2, an interface use case generating method is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps 202 to 208. Wherein:
step 202, generating an interface request log; the interface request log includes fields required to generate the interface use case.
The interface request log is a log file in which detailed information of interface requests and responses is recorded, and specific details of each interface request including request parameters, response status codes, response data and the like can be known by looking up the interface request log.
Each field required for generating the interface use case refers to a field included in the interface use case. Illustratively, the fields may include a precondition, a request URL (Uniform Resource Locator ), a request method, a request header, a request parameter, a request body, and the like.
Step 204, collecting data information of each field in the history log, and matching the data information of each field with each field in the interface request log to obtain a plurality of field groups.
The history log is generated by triggering the use of the interface by the user in the past, and the data in the log is derived from the history request of the user to the interface.
Because each interface request at least includes each field and field data information corresponding to each field, each field in the interface request log generated in step 202 can collect the corresponding field data information in the formatted log.
Illustratively, the field includes a Polcode, using "SN4" as field data information in the history log. In the current generation case, the SN4 is matched with the Polcode to be used as a field group.
And 206, assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate.
The method comprises the steps of assembling each field, constructing an execution method according to preset business logic, splicing each field group according to the execution steps of each field group in the execution method, and forming codes by the execution method and the field groups.
Code coverage is a measure of the ratio of code that has been executed in a software test to the total code amount and is used to evaluate the comprehensiveness and quality of the test to determine whether the intended code coverage objective has been achieved during the test. Code coverage is typically expressed in percent form, representing the proportion of code that has been executed to the total code. Optionally, the code coverage index includes statement coverage, branch coverage, function coverage, and the like.
For example, if the code coverage of a certain item of software is 80%, meaning that 80% of the code has been executed at least once, the remaining 20% of the code has not been executed. Higher code coverage is generally considered a good indicator because it indicates that the test case covers most of the code logic, helping to find potential errors and problems.
Illustratively, code coverage may be calculated by a code coverage tool, such as JaCoCo, coverage. The execution of the code is recorded during test execution and a code coverage report is generated. The report displays the coverage of each file, class and method, including the number of executed code lines, the number of unexecuted code lines and the percentage coverage.
Step 208, generating an interface use case based on the interface request in the case that the code coverage rate is larger than the historical code coverage rate.
The historical code coverage rate refers to the code coverage rate before the current interface request is generated.
Under the condition that the code coverage rate is larger than the historical code coverage rate, the fact that the interface case is missing in the existing test case library is explained, and the interface case is generated based on the interface request.
In the method for generating the interface use case, based on the interface request log generated by the user using the interface, each field is included in the interface request log, then field data information matched with the field is collected in the history log, after the field data information and the field are matched to obtain field groups, each field group is spliced and combined according to a preset business logic algorithm to obtain the interface request, then the interface request is adopted for test execution, and code coverage rate is generated, if the newly obtained code coverage rate is improved to some extent, the interface use case is considered to be absent in the current interface use case database, and the interface use case is generated based on the interface request to be effective. Compared with the scheme of manually generating the interface cases in the traditional technology, the method provided by the invention can automatically generate the interface cases, and efficiently solve the problems of low writing efficiency and difficult coverage rate improvement of the interface test cases.
As shown in fig. 3, in one exemplary embodiment, an interface request log is generated in step 202; the interface request log includes fields required for generating the interface use case, including the following steps 302 to 304:
step 302, each field required for generating the interface use case is obtained, and formatting processing is performed on each field, so that the formats of each field are consistent.
The field formatting process refers to a process of performing format conversion, checksum normalization on the data to ensure that the data meets specific format requirements. The field format is modified to be consistent, such as using address to represent the address, httpmethod to represent the request method, headers to represent the request header, etc.
Illustratively, the formatting process of the fields includes format conversion, format checksum format normalization, and the like. In addition, the formatting process can be performed by defining the data type, the length, the constraint condition and the like of the field, so that the data stored in the database meets the expected format requirement.
Based on the formatted fields, the field data information corresponding to each field is conveniently collected from the history log.
Step 304, an interface request log is generated based on the fields after the formatting process.
After formatting each field, formatting and printing the log into a log file to obtain an interface request log.
In this embodiment, the data information of the field is collected at a higher rate by formatting each field to have a uniform format, so that the data information of the field can be matched and corresponding to the data information of the field.
As shown in fig. 4, in an exemplary embodiment, step 204 collects data information of each field in the history log, including steps 402 to 404:
step 402, obtaining the target format after formatting the fields, and obtaining the history record generated by the log.
Wherein the log is generated based on historical usage triggers of the interface by the user, and the data in the log is derived from the historical requests
Step 404, based on the target format, collecting field data information matched with each field in the history record.
The target format is the format of the interface use case, and may be a consistent format after the field is formatted.
The field data information collected according to the target format can be matched with each field to obtain a field group.
In this embodiment, the field data information is collected according to the target format, so that the field data information is matched with the field, thereby ensuring accuracy, consistency and security of the field data, improving efficiency and performance of the interface, and maintaining readability and maintainability of the code.
In an exemplary embodiment, the method further includes, after assembling the field sets to obtain the interface request, performing test execution using the interface request, and generating the code coverage rate: the plurality of field sets are imported into an interface use case database.
The interface case database is a stored interface case, each interface case contains a field group required by the interface case, and the interface case database can be a database system or a management tool of a similar system. Alternatively, the database may contain information such as detailed descriptions of the interface test cases, input data, expected results, and actual results.
When writing interface test cases, the fields can be assembled into specific test cases according to a certain format. The interface use case database is used for storing the interface use cases, and the field groups are imported into the interface use case database, so that the assembly and the splicing are convenient.
In this embodiment, by assembling these fields into a complete test case, the request and response of the interface can be clearly described, and the subsequent execution and result verification are facilitated. According to actual requirements, the content of the field can be expanded or adjusted to adapt to different test scenes and requirements.
In an exemplary embodiment, in a case where the code coverage rate is greater than the historical code coverage rate, after generating the interface use case based on the interface request, the interface use case generating method further includes: the interface use cases are stored in an interface use case database.
The method for storing the interface test cases in the database is a common management mode, can effectively organize and manage the test cases, and supports rapid query, modification and deletion operations. The format of the interface use case here corresponds to the format of the fields in the interface request log, as stored in a specific format.
Illustratively, the interface test cases can be stored through a table structure of the fields, so that quick query and statistics based on the fields such as keywords, case numbers, test results and the like are supported. In practical terms, the table structure can be expanded and adjusted according to specific requirements.
In an exemplary embodiment, the interface use case generating method further includes: and under the condition that the code coverage rate is smaller than or equal to the historical code coverage rate, the interface use case is not generated.
The code coverage rate refers to the proportion of the number of code lines covered by the executed test case to the total number of code lines in the software test. The method is an index for measuring the degree of coverage of the code by the test case, and can help evaluate the sufficiency and quality of the test.
If the code coverage rate is not improved, the code requested by the interface is considered to exist in the database and not belong to the new use case, so that the interface use case is not generated.
In the embodiment, under the condition that the code coverage rate is not larger than the historical code coverage rate, the interface use case is not generated, so that database redundancy is avoided, and the database coverage accuracy is improved.
In another embodiment, as shown in fig. 5, an interface use case generating method includes the following steps:
step 502, obtaining each field required for generating the interface use case, and formatting each field to make the formats of each field consistent.
Step 504, an interface request log is generated based on the fields after the formatting process.
Step 506, the target format after formatting the fields is obtained, and the history record generated by the log is obtained.
Step 508, based on the target format, collecting field data information matched with each field in the history record.
Step 510, matching each field data information with each field in the interface request log to obtain a plurality of field groups.
Step 512, import the plurality of field sets into the interface use case database.
Step 514, each field group is assembled to obtain an interface request, test execution is performed by adopting the interface request, and code coverage rate is generated.
Step 516, determine if the code coverage is greater than the historical code coverage.
Step 518, under the condition that the code coverage rate is smaller than or equal to the historical code coverage rate, the interface use case is not generated; and under the condition that the code coverage rate is larger than the historical code coverage rate, generating an interface use case based on the interface request, and storing the interface use case into an interface use case database.
In this embodiment, the fields used by the interface use case are determined first, and then the fields are formatted to make the formats of the fields consistent. And then generating an interface request log based on the formatted fields, acquiring a history record generated by the log, and acquiring field data information in the history record and matching the field data information with the field based on the field format to obtain a field group. And splicing and combining the field groups according to a preset business logic algorithm to obtain an interface request, then adopting the interface request to perform test execution, generating code coverage rate, if the newly obtained code coverage rate is improved, considering that the interface use case is absent in the current interface use case database, generating the interface use case based on the interface request to be effective, and storing the generated interface use case in the interface use case database. If the code coverage rate is not improved, the method considers that the method is repeated, and the interface use case is not generated.
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 an interface use case generating device for realizing the above related interface use case generating method. The implementation scheme of the solution provided by the device is similar to the implementation scheme described in the above method, so the specific limitation in the embodiments of the one or more interface use case generating devices provided below may refer to the limitation of the interface use case generating method hereinabove, and will not be repeated herein.
In an exemplary embodiment, as shown in fig. 6, there is provided an interface use case generating apparatus 600, including: a log generation module 602, a field data matching module 604, a code coverage generation module 606, and an interface use case generation module 608, wherein:
a log generation module 602, configured to generate an interface request log; the interface request log comprises various fields required for generating interface use cases;
the field data matching module 604 is configured to collect each field data information in the history log, and match each field data information with each field in the interface request log to obtain a plurality of field groups;
the code coverage rate generating module 606 is configured to assemble each field group to obtain an interface request, perform test execution by using the interface request, and generate code coverage rate;
the interface use case generating module 608 is configured to generate an interface use case based on the interface request when the code coverage rate is greater than the historical code coverage rate.
In one exemplary embodiment, log generation module 602 is further configured to: acquiring each field required by generating the interface use case, and formatting each field to make the formats of each field consistent; and generating an interface request log based on the fields after the formatting process.
In one exemplary embodiment, the field data matching module 604 is further configured to: acquiring a target format after formatting processing of each field, and acquiring a history record generated by a log; based on the target format, field data information matched with each field in the history record is collected.
In an exemplary embodiment, the interface use case generating apparatus 600 further includes: and the field importing module is used for importing a plurality of field groups into the interface use case database.
In an exemplary embodiment, the interface use case generating apparatus 600 further includes: and the storage module is used for storing the interface use cases into the interface use case database.
In one exemplary embodiment, the interface use case generation module 608 does not generate an interface use case if the code coverage is less than or equal to the historical code coverage.
The respective modules in the above-described interface use case generating apparatus may be implemented in whole or in part by software, hardware, or a combination 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 exemplary embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. 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 used for storing historical interface use case data. 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 is executed by a processor to implement an interface use case generation method.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, 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, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, 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 (10)
1. An interface use case generation method, which is characterized by comprising the following steps:
generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
collecting data information of each field in a history log, and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
assembling each field group to obtain an interface request, performing test execution by adopting the interface request, and generating code coverage rate;
and generating an interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
2. The method of claim 1, wherein the generating an interface request log; the interface request log includes fields required for generating an interface use case, including:
acquiring each field required by generating the interface use case, and formatting each field to make the formats of each field consistent;
and generating an interface request log based on the fields after the formatting process.
3. The method of claim 2, wherein collecting each field of data information in the history log comprises:
acquiring a target format after formatting processing of each field, and acquiring a history record generated by a log;
and acquiring field data information matched with each field in the history record based on the target format.
4. The method of claim 1, wherein prior to said assembling each of said field sets to obtain an interface request, performing test execution with said interface request, and generating code coverage, said method further comprises:
and importing a plurality of field groups into an interface use case database.
5. The method of any of claims 1-4, wherein, in the event that the code coverage is greater than historical code coverage, after generating an interface use case based on the interface request, the method further comprises:
and storing the interface use cases into the interface use case database.
6. The method according to claim 1, wherein the method further comprises:
and under the condition that the code coverage rate is smaller than or equal to the historical code coverage rate, the interface use case is not generated.
7. An interface use case generating apparatus, the apparatus comprising:
the log generation module is used for generating an interface request log; the interface request log comprises various fields required for generating interface use cases;
the field data matching module is used for collecting each field data information in the history log and matching each field data information with each field in the interface request log to obtain a plurality of field groups;
the code coverage rate generation module is used for assembling each field group to obtain an interface request, performing test execution by adopting the interface request and generating code coverage rate;
and the interface use case generating module is used for generating the interface use case based on the interface request under the condition that the code coverage rate is larger than the historical code coverage rate.
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.
10. A computer program product comprising a computer program, 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.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311729448.2A CN117785674A (en) | 2023-12-15 | 2023-12-15 | Interface use case generation method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311729448.2A CN117785674A (en) | 2023-12-15 | 2023-12-15 | Interface use case generation method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117785674A true CN117785674A (en) | 2024-03-29 |
Family
ID=90391926
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311729448.2A Pending CN117785674A (en) | 2023-12-15 | 2023-12-15 | Interface use case generation method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117785674A (en) |
-
2023
- 2023-12-15 CN CN202311729448.2A patent/CN117785674A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114238085A (en) | Interface testing method and device, computer equipment and storage medium | |
CN116644250B (en) | Page detection method, page detection device, computer equipment and storage medium | |
CN116108697B (en) | Acceleration test data processing method, device and equipment based on multiple performance degradation | |
CN116155597A (en) | Access request processing method and device and computer equipment | |
CN117785674A (en) | Interface use case generation method, device, computer equipment and storage medium | |
CN116795723B (en) | Chain unit test processing method and device and computer equipment | |
CN114416805B (en) | Data checking method and device, computer equipment and storage medium | |
CN117371417A (en) | Report generation method, apparatus, device, storage medium, and program product | |
CN118349475A (en) | Test data generation method, device, computer equipment and storage medium | |
CN116401323A (en) | Index data processing method and device and computer equipment | |
CN117453561A (en) | Test script calling method, device, computer equipment and storage medium | |
CN116451965A (en) | Service request processing method and device, computer equipment and storage medium | |
CN117331789A (en) | Log generation method, device, computer equipment and storage medium | |
CN117271445A (en) | Log data processing method, device, server, storage medium and program product | |
CN117459519A (en) | Traceable file processing method, traceable file processing device, computer equipment and storage medium | |
CN116880927A (en) | Rule management method, device, computer equipment and storage medium | |
CN117971649A (en) | Data processing method, device, computer equipment and storage medium | |
CN117395175A (en) | Network application software testing method, device, equipment, medium and program product | |
CN116361149A (en) | Batch processing automatic test method, device, computer equipment and storage medium | |
CN115456583A (en) | Questionnaire data processing method, questionnaire data processing device, computer device, and storage medium | |
CN116938681A (en) | Twin data auditing method and device of network element equipment and computer equipment | |
CN115629958A (en) | Universal field level automatic checking method and device for different service interfaces | |
CN116860603A (en) | Report test method, report test device, computer equipment and storage medium | |
CN117172720A (en) | Audit and doubt point tracking and checking method, system, computer equipment and storage medium | |
CN117435185A (en) | Code generation method, device, computer equipment and storage medium |
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 |