Test case generation method, system, device and medium based on full-link tagging

Compare test case paths and generate new test cases through full-link marking technology, which solves the problems of low test case coverage and difficulty in automatic supplementation in the test framework, and achieves efficient test case generation and coverage.

CN112559363BActive Publication Date: 2024-08-27PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011537441.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-23
Publication Date
2024-08-27
Estimated Expiration
2040-12-23

AI Technical Summary

Technical Problem

The test case coverage rate in the existing testing framework is low, and it is difficult to automatically supplement test cases with different execution paths.

Method used

A test case generation method based on full-link tagging is used to obtain test cases and test request paths in the use case library, compare and generate new test cases to cover uncovered scenarios, and automatically supplement test cases for different execution paths.

Benefits of technology

It achieves quick and effective streamlining of test cases, improves test coverage, ensures automatic supplementation of test cases for different execution paths, and improves the completeness and effectiveness of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112559363B
    Figure CN112559363B
Patent Text Reader

Abstract

The embodiment of the present invention provides a test case generation method, system, device and computer medium based on full-link marking, the method comprising: obtaining a first test case of a target test object in a use case library layer, the first test case being any test case of the target test object in the use case library layer; recording the request path corresponding to the first test case as a first full-link request path; receiving a test request for the target test object, obtaining a request path corresponding to the test request and recording it as a second full-link request path; when the first full-link request path is different from the second full-link request path, generating a second test case according to the test request. The present invention can automatically supplement test cases of different execution paths.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of testing technology, and in particular to a test case generation method, system, device and medium based on full-link marking. Background Art

[0002] In software testing, test cases consist of test input data, execution conditions, and corresponding output results. The design of test cases is very important and is the basis for the correctness and effectiveness of test execution. How to effectively design test cases has always been a concern for testers. However, the current test framework has the problem of low test case coverage and multiple test cases corresponding to the same execution path, which cannot quickly and effectively streamline test cases; secondly, test cases for different execution paths are difficult to automatically supplement. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a test case generation method, system, computer device and computer-readable storage medium based on full-link marking, which are used to solve the problem that test cases for different execution paths are difficult to automatically supplement.

[0004] The embodiment of the present invention solves the above technical problems through the following technical solutions:

[0005] A test case generation method based on full-link marking, comprising:

[0006] Obtain a first test case of a target test object in a use case library layer, where the first test case is any test case of the target test object in the use case library layer;

[0007] Recording the request path corresponding to the first test case as a first full-link request path;

[0008] Receiving a test request for the target test object, and obtaining a request path record corresponding to the test request as a second full-link request path;

[0009] When the first full-link request path is different from the second full-link request path, a second test case is generated according to the test request.

[0010] Further, recording the request path corresponding to the first test case as a first full-link request path includes:

[0011] Acquire a first parameter of the first test case from the use case library layer;

[0012] Generate a first full-link request corresponding to the test case according to the first parameter;

[0013] Execute the test task corresponding to the first full-link request and obtain the path corresponding to the first full-link request.

[0014] Further, executing the test task corresponding to the first full-link request and obtaining the path corresponding to the first full-link request includes:

[0015] When executing the test task corresponding to the first full-link request, marking the code corresponding to the first full-link request with a first preset identifier, where the first preset identifier is a unique identifier;

[0016] The codes marked by the first preset identifier are collected as the first full-link request path.

[0017] Further, the receiving a test request for the target test object and obtaining a request path record corresponding to the test request as a second full-link request path includes:

[0018] Receive and execute the test task corresponding to the test request;

[0019] When executing the test task corresponding to the test request, marking the code corresponding to the test request with a second preset identifier, where the second preset identifier is a unique identifier;

[0020] The codes marked by the second preset identifier are collected as the second full-link request path.

[0021] Further, when the first full-link request path is different from the second full-link request path, generating a second test case according to the test request includes:

[0022] Generate a first request broken line path according to the path corresponding to the first full-link request; and generate a second request broken line path according to the path corresponding to the second full-link request;

[0023] When the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path;

[0024] When the second full-link request path is different from the first full-link request path, obtaining a second parameter of the test request;

[0025] Generate a second test case corresponding to the second full-link request according to the second parameter.

[0026] Further, when the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path includes:

[0027] Use a preset broken line path recognition program to compare and analyze the first request broken line path and the second request broken line path to obtain a broken line path similarity value;

[0028] When the similarity value of the broken line path exceeds a preset similarity threshold, it is determined that the path corresponding to the second request is the same as the path corresponding to the first request.

[0029] Further, when the first full-link request path is different from the second full-link request path, after generating a second test case according to the test request, the method further includes:

[0030] The second test case is written into the test case library layer.

[0031] In order to achieve the above object, an embodiment of the present invention further provides a test case generation system based on full-link marking, comprising:

[0032] A test case acquisition module, used to acquire a first test case of a target test object in a use case library layer, wherein the first test case is any test case of the target test object in the use case library layer;

[0033] A request path recording module, used to record the request path corresponding to the first test case as a first full-link request path;

[0034] The request path recording module is further used to receive a test request for the target test object, and obtain a request path record corresponding to the test request as a second full-link request path;

[0035] The test case generation module is also used to generate a second test case according to the test request when the first full-link request path is different from the second full-link request path.

[0036] In order to achieve the above-mentioned purpose, an embodiment of the present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the test case generation method based on full-link marking as described above are implemented.

[0037] In order to achieve the above-mentioned purpose, an embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the test case generation method based on full-link marking as described above.

[0038] The test case generation method, system, computer device and computer-readable storage medium based on full-link marking provided by the embodiment of the present invention obtain the first test case of the target test object in the use case library layer, and the first test case is any test case of the target test object in the use case library layer; the request path corresponding to the first test case is recorded as the first full-link request path; a test request for the target test object is received, and the request path corresponding to the test request is obtained and recorded as the second full-link request path; when the first full-link request path is different from the second full-link request path, a second test case is generated according to the test request. It can automatically collect scenarios not covered by test cases and automatically supplement test cases with different execution paths.

[0039] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments, but is not intended to limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 This is a flowchart of the steps of the test case generation method based on full-link marking according to the first embodiment of the present invention;

[0041] Figure 2 A flowchart of the steps of a method for recording the request path corresponding to the first test case as a first full-link request path according to Embodiment 1 of the present invention;

[0042] Figure 3 A flowchart of a method for executing a test task corresponding to the first full-link request and obtaining a path corresponding to the first full-link request according to the first embodiment of the present invention;

[0043] Figure 4 A flowchart of a method for receiving a test request for the target test object and obtaining a request path record corresponding to the test request as a second full-link request path according to a first embodiment of the present invention;

[0044] Figure 5 A flowchart of the steps of a method for generating a second test case according to the test request when the first full-link request path and the second full-link request path are different according to the first embodiment of the present invention;

[0045] Figure 6 A flowchart of the steps of a method for determining whether a first requested broken line path and a second requested broken line path are the same according to a first embodiment of the present invention;

[0046] Figure 7 This is a schematic diagram of program modules of a test case generation system based on full-link marking according to Embodiment 2 of the present invention;

[0047] Figure 8 Schematic diagram of the hardware structure of the computer device according to the third embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0049] The technical solutions between the various embodiments can be combined with each other, but they must be based on the fact that they can be implemented by ordinary technicians in the field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0050] Embodiment 1

[0051] See also Figure 1 , shows a flowchart of the steps of the test case generation method based on full-link tagging in an embodiment of the present invention. It can be understood that the flowchart in the embodiment of this method is not used to limit the order of executing steps. The following is an exemplary description using a computer device as the execution subject, as follows:

[0052] like Figure 1 As shown, the test case generation method based on full-link marking may include steps S100 to S400, wherein:

[0053] Step S100: obtaining a first test case of a target test object in a use case library layer, wherein the first test case is any test case of the target test object in the use case library layer.

[0054] In this embodiment, the use case library layer stores multiple test cases for multiple test objects, wherein each test object corresponds to multiple test cases, and the coverage of each test case is different. The first test case refers to a test case of a target test object that has been stored in the use case library layer.

[0055] Step S200: record the request path corresponding to the first test case as a first full-link request path.

[0056] Specifically, by parsing the test case, a first full-link request of the test case is generated, and by executing the test task corresponding to the first full-link request, the first full-link request path is obtained.

[0057] In a specific embodiment, if Figure 2 As shown, step S200 may further include:

[0058] Step S201, obtaining the first parameter of the first test case from the use case library layer.

[0059] In some embodiments, the first parameter of the test case is stored in text form in the use case library layer, and the first parameter is used to generate a first full-link request, wherein the first parameter includes request parameters corresponding to the request of the first test case, such as URL and other related parameters.

[0060] Step S202: Generate a first full-link request corresponding to the test case according to the first parameter.

[0061] Specifically, the full link refers to a link through which a complete data flow passes. For example, when shopping online, from the buyer placing an order to the final receipt of the goods, the data flow of a complete transaction must pass through many systems, such as the ERP system, warehouse system, distribution system, terminal system, etc. These systems are linked together through calls, and transaction data flows on the links. The link through which a complete data flow process passes is the full link. A full-link request refers to a request that can initiate a complete data flow.

[0062] Step S203: execute the test task corresponding to the first full-link request, and obtain the path corresponding to the first full-link request.

[0063] Specifically, the path corresponding to the request refers to the code covered when executing the request, and the path corresponding to the first full-link request refers to the code covered when executing the first full-link request.

[0064] In an exemplary embodiment, Figure 3 As shown, step S203 may further include:

[0065] Step S2031: When executing the test task corresponding to the first full-link request, the code corresponding to the first full-link request is marked with a first preset identifier, and the first preset identifier is a unique identifier.

[0066] For example, when executing the test task corresponding to the first full-link request A, the first preset identifier "A" is used to mark the code covered by the first full-link request A when executing the first full-link request A. For the request path, assuming that there are 5 lines of code in total, the execution path may be to execute the first line of code, the second line of code, the third line of code, the fifth line of code, etc. For example, when executing the A test task corresponding to the first full-link request A, the first line of code, the third line of code, and the fifth line of code are executed, then the first preset identifier "A" is used to mark the first line of code, the third line of code, and the fifth line of code. When executing the B test task corresponding to the first full-link request B, the first line of code, the second line of code, and the fourth line of code are executed, then the first preset identifier "B" is used to mark the first line of code, the second line of code, and the fourth line of code.

[0067] Step S2032: collect the codes marked by the first preset identifier as the first full-link request path.

[0068] For example, for the first full-link request A, the execution path marked with the first preset identifier "A" is obtained, that is, the path corresponding to the first full-link request A is the first line of code, the third line of code, and the fifth line of code, and the path corresponding to the first full-link request B is the first line of code, the second line of code, and the fourth line of code.

[0069] Step S300: receive a test request for the target test object, and obtain a request path record corresponding to the test request as a second full-link request path.

[0070] In an exemplary embodiment, if Figure 4 As shown, step S300 may further include:

[0071] Step S301, receiving and executing the test task corresponding to the test request.

[0072] Step S302: When executing the test task corresponding to the test request, mark the code corresponding to the test request with a second preset identifier, where the second preset identifier is a unique identifier.

[0073] Specifically, when a test request C is received, a second preset identifier "C" is used to mark the path corresponding to the second full-link request C when executing the test task corresponding to the test request C. Similarly, for the request path, there are a total of 5 lines of code, and the request path executes the first line of code, the second line of code, the third line of code, the fifth line of code, and so on. For example, when executing test request C, the first line of code, the third line of code, and the fifth line of code are executed, then the first preset identifier "C" is used to mark the first line of code, the third line of code, and the fifth line of code. When executing test request D, the second line of code, the third line of code, and the fourth line of code are executed, then the first preset identifier "D" is used to mark the first line of code, the second line of code, and the fourth line of code.

[0074] Step S303: collect the codes marked by the second preset identifier as the second full-link request path.

[0075] Specifically, the path corresponding to the test request C is the first line of code, the third line of code, and the fifth line of code, and the path corresponding to the test request D is the first line of code, the second line of code, and the fourth line of code.

[0076] Step S400: When the first full-link request path is different from the second full-link request path, generate a second test case according to the test request.

[0077] In an exemplary embodiment, if Figure 5 As shown, step S400 may further include:

[0078] Step S401: Generate a first request broken line path according to the path corresponding to the first full-link request; and generate a second request broken line path according to the path corresponding to the second full-link request.

[0079] Specifically, the broken line path refers to a virtual broken line graph generated according to the path corresponding to the request, for example, a virtual broken line graph A is generated according to the first full-link sub-request A, and a virtual broken line graph C is generated according to the second full-link request C.

[0080] Step S402: When the first request broken line path and the second request broken line path are different, it is determined that the second full-link request path is different from the first full-link request path.

[0081] In an exemplary embodiment, if Figure 6 As shown, step S402 may further include:

[0082] Step S4021: Use a preset broken line path recognition program to compare and analyze the first requested broken line path and the second requested broken line path to obtain a broken line path similarity value.

[0083] Step S4022: When the similarity value of the broken line path exceeds a preset similarity threshold, it is determined that the path corresponding to the second request is the same as the path corresponding to the first request.

[0084] Specifically, a preset broken line path recognition program is used to compare and analyze the first request broken line path and the second request broken line path to obtain a broken line path similarity value. When the similarity value exceeds the preset similarity threshold, it is determined that the path corresponding to the second request is the same as the path corresponding to the first request, otherwise it is not the same. In an exemplary embodiment, the preset similarity threshold is 90%. If there is a path corresponding to the test request that is the same as the path corresponding to the first full link, it means that the test request has been covered by the first full link request, that is, the test request has the same coverage as the first full link request. Coverage is a means of measuring test integrity and a measure of test effectiveness. Coverage is represented by executed code. When the executed code is the same when the request is executed, the corresponding broken line path is also the same, and the coverage is the same. Since the full link refers to the link through which a complete data flow process passes, and the longer the data flow process, the more code is executed, therefore, the full link request can improve the coverage as much as possible, and the first full link request is generated by setting a test case, and when the test request is not the same as the first full link request coverage, the test case is generated again, which can ensure the test integrity of the generated test case.

[0085] In addition, since there are multiple full-link test cases stored in the use case library layer, there are multiple corresponding first full-link requests. When calculating the similarity value of the broken line path, it is necessary to calculate the similarity value of the broken line path of the test request with the broken line path corresponding to the first full-link request corresponding to all test cases in the use case library layer. For example, there are test cases A and test cases B in the use case library layer, corresponding to the first full-link request A and the first full-link request B, and test request C needs to calculate the similarity value with the broken line path of the first full-link request A, and also with the broken line path of the first full-link request B. Similarly, test request D also needs to calculate the similarity value with the broken line path of the first full-link request A and the first full-link request B.

[0086] Step S403: When the second full-link request path is different from the first full-link request path, obtain a second parameter of the test request.

[0087] Step S404: Generate a second test case corresponding to the second full-link request according to the second parameters.

[0088] Specifically, when the second full-link request path is different from the first full-link request path, a second parameter of the test request is obtained, the second parameter includes a request parameter and a return parameter, and a second test case is generated according to the request parameter and the return parameter. And a second test case is generated according to the request parameter and the return parameter of the test request.

[0089] In some embodiments, when the first full-link request path is different from the second full-link request path, after generating a second test case according to the test request, the method further includes:

[0090] The second test case is written into the test case library layer.

[0091] For example, when the paths corresponding to the test request D and the first full-link request A and the first full-link request B are all different, the second test case generated by the test request D is written into the case library layer.

[0092] In another embodiment, if there is a second full-link request path that is the same as the first full-link path, it means that the test request has been covered by the first full-link request, that is, the test request has been covered by the first test case in the use case library layer, then the test request and the first full-link test request are merged and classified into the corresponding first full-link request.

[0093] This implementation is to generate a second test case that is different from the first test case in the test case library layer according to the test request corresponding to the target object. Therefore, it is necessary to obtain the first test case of the target test object, and compare the coverage of executing the first test case with the coverage of executing the test request. When the coverage of executing the first test case is different from the coverage when executing the test request, a second test case is generated according to the test request.

[0094] The embodiment of the present invention obtains a first test case of a target test object in a use case library layer, wherein the first test case is any test case of the target test object in the use case library layer; records the request path corresponding to the first test case as a first full-link request path; receives a test request for the target test object, obtains the request path corresponding to the test request and records it as a second full-link request path; when the first full-link request path is different from the second full-link request path, generates a second test case according to the test request. By automatically screening and classifying test cases with identical or similar execution paths to avoid duplicate cases, test cases can be streamlined quickly and effectively; full-link marking combined with coverage can automatically collect scenarios not covered by test cases and automatically supplement test cases with different execution paths.

[0095] Embodiment 2

[0096] Please continue reading Figure 7 , showing a schematic diagram of the program modules of the test case generation system based on full-link marking of the present invention. In the present embodiment, the test case generation system 20 based on full-link marking may include or be divided into one or more program modules, one or more program modules are stored in a storage medium, and executed by one or more processors to complete the present invention, and can implement the above-mentioned test case generation method based on full-link marking. The program module referred to in the embodiment of the present invention refers to a series of computer program instruction segments that can perform specific functions, which is more suitable for describing the execution process of the test case generation system 20 based on full-link marking in a storage medium than the program itself. The following description will specifically introduce the functions of each program module of this embodiment:

[0097] A test case acquisition module 200 is used to acquire a first test case of a target test object in a use case library layer, wherein the first test case is any test case of the target test object in the use case library layer;

[0098] A request path recording module 202, configured to record the request path corresponding to the first test case as a first full-link request path;

[0099] Furthermore, the request path recording module 202 is also used for:

[0100] Acquire a first parameter of the first test case from the use case library layer;

[0101] Generate a first full-link request corresponding to the test case according to the first parameter;

[0102] Execute the test task corresponding to the first full-link request and obtain the path corresponding to the first full-link request.

[0103] Furthermore, the request path recording module 202 is also used for:

[0104] When executing the test task corresponding to the first full-link request, marking the code corresponding to the first full-link request with a first preset identifier, where the first preset identifier is a unique identifier;

[0105] The codes marked by the first preset identifier are collected as the first full-link request path.

[0106] The request path recording module 202 is further configured to receive a test request for the target test object, and obtain a request path record corresponding to the test request as a second full-link request path;

[0107] Furthermore, the request path recording module 202 is also used for:

[0108] Receive and execute the test task corresponding to the test request;

[0109] When executing the test task corresponding to the test request, marking the code corresponding to the test request with a second preset identifier, where the second preset identifier is a unique identifier;

[0110] The codes marked by the second preset identifier are collected as the second full-link request path.

[0111] The test case generation module 204 is also used to generate a second test case according to the test request when the first full-link request path is different from the second full-link request path.

[0112] Furthermore, the test case generation module 204 is also used for:

[0113] Generate a first request broken line path according to the path corresponding to the first full-link request; and generate a second request broken line path according to the path corresponding to the second full-link request;

[0114] When the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path;

[0115] When the second full-link request path is different from the first full-link request path, obtaining a second parameter of the test request;

[0116] Generate a second test case corresponding to the second full-link request according to the second parameter.

[0117] Furthermore, the test case generation module 204 is also used for:

[0118] Use a preset broken line path recognition program to compare and analyze the first request broken line path and the second request broken line path to obtain a broken line path similarity value;

[0119] When the similarity value of the broken line path exceeds a preset similarity threshold, it is determined that the path corresponding to the second request is the same as the path corresponding to the first request.

[0120] Furthermore, the test case generation module 204 is also used for:

[0121] When the first full-link request path is different from the second full-link request path, after generating a second test case according to the test request, the second test case is written into the case library layer.

[0122] Embodiment 3

[0123] See also Figure 8 , is a schematic diagram of the hardware architecture of the computer device of the third embodiment of the present invention. In this embodiment, the computer device 2 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The computer device 2 can be a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Figure 8 As shown, the computer device 2 at least includes, but is not limited to, a memory 21, a processor 22, a network interface 23, and a test case generation system 20 based on full-link marking, which can be interconnected and communicated via a system bus. Among them:

[0124] In this embodiment, the memory 21 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 21 can be an internal storage unit of the computer device 2, such as a hard disk or memory of the computer device 2. In other embodiments, the memory 21 can also be an external storage device of the computer device 2, such as a plug-in hard disk equipped on the computer device 2, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 21 can also include both the internal storage unit of the computer device 2 and its external storage device. In this embodiment, the memory 21 is generally used to store the operating system and various application software installed on the computer device 2, such as the program code of the test case generation system 20 based on the full link tag in the above embodiment. In addition, the memory 21 can also be used to temporarily store various types of data that have been output or are to be output.

[0125] The processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 22 is generally used to control the overall operation of the computer device 2. In this embodiment, the processor 22 is used to run the program code stored in the memory 21 or process data, such as running the test case generation system 20 based on the full link mark to implement the test case generation method based on the full link mark of the above embodiment.

[0126] The network interface 23 may include a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the computer device 2 and other electronic devices. For example, the network interface 23 is used to connect the computer device 2 to an external terminal through a network, and to establish a data transmission channel and a communication connection between the computer device 2 and the external terminal. The network may be a wireless or wired network such as an Intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.

[0127] It should be pointed out that Figure 8 Computer device 2 is shown only with components 20 - 23 , but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0128] In this embodiment, the full-link marking-based test case generation system 20 stored in the memory 21 can also be divided into one or more program modules, and the one or more program modules are stored in the memory 21 and executed by one or more processors (processor 22 in this embodiment) to complete the present invention.

[0129] For example, Figure 7 A schematic diagram of a program module of the second embodiment of the test case generation system 20 based on full-link marking is shown. In this embodiment, the test case generation system 20 based on full-link marking can be divided into a test case acquisition module 200, a request path recording module 202 and a test case generation module 204. Among them, the program module referred to in the present invention refers to a series of computer program instruction segments that can complete specific functions, which is more suitable for describing the execution process of the test case generation system 20 based on full-link marking in the computer device 2 than the program. The specific functions of the program modules 200-204 have been described in detail in the second embodiment and will not be repeated here.

[0130] Embodiment 4

[0131] The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program realizes the corresponding function when executed by the processor. The computer-readable storage medium of the present embodiment is used to store a test case generation system 20 based on full-link marking, and when executed by the processor, the test case generation method based on full-link marking of the above embodiment is realized.

[0132] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0134] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A test case generation method based on full-link marking, characterized in that: include: Obtain a first test case of a target test object in a use case library layer, where the first test case is any test case of the target test object in the use case library layer; Recording the request path corresponding to the first test case as a first full-link request path, where the full-link request refers to a request that can initiate a complete data flow; Receiving a test request for the target test object, and obtaining a request path record corresponding to the test request as a second full-link request path; When the first full-link request path is different from the second full-link request path, generating a second test case according to the test request; The step of recording the request path corresponding to the first test case as a first full-link request path includes: Acquire a first parameter of the first test case from the use case library layer; Used to generate a first full-link request; Generate a first full-link request corresponding to the test case according to the first parameter; Execute the test task corresponding to the first full-link request to obtain the path corresponding to the first full-link request; Among them, the path corresponding to the request refers to the code covered when executing the request, and the path corresponding to the first full-link request refers to the code covered when executing the first full-link request; The receiving a test request for the target test object and obtaining a request path record corresponding to the test request as a second full-link request path includes: Receive and execute the test task corresponding to the test request; When executing the test task corresponding to the test request, marking the code corresponding to the test request with a second preset identifier, where the second preset identifier is a unique identifier; Collecting the code marked by the second preset identifier as a second full-link request path; When the first full-link request path is different from the second full-link request path, generating a second test case according to the test request includes: Generate a first request broken line path according to the path corresponding to the first full-link request; and generate a second request broken line path according to the path corresponding to the second full-link request; When the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path; When the second full-link request path is different from the first full-link request path, obtaining a second parameter of the test request; Generate a second test case corresponding to the second full-link request according to the second parameter; When the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path includes: Use a preset broken line path recognition program to compare and analyze the first request broken line path and the second request broken line path to obtain a broken line path similarity value; When the similarity value of the broken line path exceeds a preset similarity threshold, it is determined that the path corresponding to the second request is the same as the path corresponding to the first request.

2. The test case generation method based on full-link marking according to claim 1 is characterized in that: The executing the test task corresponding to the first full-link request to obtain the path corresponding to the first full-link request includes: When executing the test task corresponding to the first full-link request, marking the code corresponding to the first full-link request with a first preset identifier, where the first preset identifier is a unique identifier; The codes marked by the first preset identifier are collected as the first full-link request path.

3. The test case generation method based on full-link marking according to any one of claims 1 to 2, characterized in that: When the first full-link request path is different from the second full-link request path, after generating a second test case according to the test request, the method further includes: The second test case is written into the test case library layer.

4. A test case generation system based on full-link marking, characterized in that: include: A test case acquisition module, used to acquire a first test case of a target test object in a use case library layer, wherein the first test case is any test case of the target test object in the use case library layer; A request path recording module, used to record the request path corresponding to the first test case as a first full-link request path, wherein the full-link request refers to a request that can initiate a complete data flow; The request path recording module is further used to receive a test request for the target test object, and obtain a request path record corresponding to the test request as a second full-link request path; The test case generation module is further used to generate a second test case according to the test request when the first full-link request path is different from the second full-link request path; Wherein, the request path recording module is also used for: Acquire a first parameter of the first test case from the use case library layer; Generate a first full-link request corresponding to the test case according to the first parameter; Execute the test task corresponding to the first full-link request to obtain the path corresponding to the first full-link request; Among them, the path corresponding to the request refers to the code covered when executing the request, and the path corresponding to the first full-link request refers to the code covered when executing the first full-link request; The receiving a test request for the target test object and obtaining a request path record corresponding to the test request as a second full-link request path includes: Receive and execute the test task corresponding to the test request; When executing the test task corresponding to the test request, marking the code corresponding to the test request with a second preset identifier, where the second preset identifier is a unique identifier; Collecting the code marked by the second preset identifier as a second full-link request path; When the first full-link request path is different from the second full-link request path, generating a second test case according to the test request includes: Generate a first request broken line path according to the path corresponding to the first full-link request; and generate a second request broken line path according to the path corresponding to the second full-link request; When the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path; When the second full-link request path is different from the first full-link request path, obtaining a second parameter of the test request; Generate a second test case corresponding to the second full-link request according to the second parameter; When the first request broken line path and the second request broken line path are different, determining that the second full-link request path is different from the first full-link request path includes: Use a preset broken line path recognition program to compare and analyze the first request broken line path and the second request broken line path to obtain a broken line path similarity value; When the similarity value of the broken line path exceeds a preset similarity threshold, it is determined that the path corresponding to the second request is the same as the path corresponding to the first request.

5. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the test case generation method based on full-link marking as described in any one of claims 1 to 3 are implemented.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by at least one processor so that the at least one processor performs the steps of the test case generation method based on full-link marking as described in any one of claims 1 to 3.