Interface test case detection method, device, computer equipment and storage medium
By generating and checking interface test cases, the problem of irregular configuration of interface automated test cases is solved, and automated detection and quality assurance of interface test cases are achieved.
Patent Information
- Application Number
- CN202111533189.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In the existing technology, the configuration of interface automation test cases is random and non-standard, resulting in uneven quality of interface test cases and failure to achieve actual performance in a production environment. It is necessary to provide a solution that can effectively monitor and detect the quality of interface test cases.
An interface test case detection method is provided. By generating interface test cases and triggering no-assertion case check events, assertion case check events, reverse case check events and test case quantity check events, the interface test cases are checked from multiple dimensions, including no-assertion case check, assertion case check, reverse case check and test case quantity check.
It realizes the automated inspection of interface test cases, improves the detection accuracy, reduces the probability of interface test case errors, and ensures the quality of interface test cases.
Smart Images

Figure CN114185798B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an interface test case detection method, apparatus, computer equipment, storage medium, and computer program product. Background Art
[0002] Automated testing is the process of converting human-driven testing activities into machine-driven ones. Typically, after designing and reviewing interface test cases, testers execute the tests step by step according to the procedures described in the interface test cases, comparing the actual results with the expected results.
[0003] With the promotion of automated testing technology and artificial intelligence technology, the interface automation testing platform has been favored by more and more enterprises. The platform can configure and execute interface automation use cases. However, since the automated interface test cases are automatically executed by the platform, and thousands of interface test cases are automatically executed by the system, it is easy for the use case configuration to be arbitrary and irregular, and the use case quality to be uneven. Even if all functions of the product are covered by interface test cases, problems will still occur in the subsequent production environment, and the actual performance cannot be achieved.
[0004] Thus, it is necessary to provide an interface test case detection solution that can effectively monitor and detect the quality of interface test cases to ensure the quality of interface test cases. Summary of the Invention
[0005] Based on this, it is necessary to provide an interface test case detection method, device, computer equipment, computer-readable storage medium and computer program product that can ensure the quality of interface test cases in response to the above technical problems.
[0006] In a first aspect, the present application provides an interface test case detection method. The method includes:
[0007] Get interface test case configuration data;
[0008] Generate interface test cases based on interface test case configuration data and preset interface test case template data;
[0009] When a preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event to obtain the inspection result of the interface test case;
[0010] Among them, the preset use case check events include no assertion use case check events, assertion use case check events, reverse use case check events and test case quantity check events.
[0011] In one embodiment, when a preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event, and the inspection result of the interface test case includes:
[0012] When a save instruction of a test case is received, a non-assertion case check event and an assertion case check event are triggered, and the interface test case is checked according to the non-assertion case check mechanism and the assertion case check mechanism, and the non-assertion check result and the assertion check result of the interface test case are obtained respectively;
[0013] Also, when the preset use case check cycle is reached, the reverse use case check event and the test case quantity check event are triggered, and the interface test cases are checked according to the reverse use case check mechanism and the test case quantity check mechanism, and the reverse use case check results and quantity check results of the interface test cases are obtained respectively.
[0014] In one embodiment, checking the interface test case according to the no-assertion case checking mechanism includes:
[0015] Traverse the post-verification data of the interface test cases;
[0016] If it is detected that the post-verification data does not include the Verify method data and the ForVerify method data, the interface test case is determined to be a non-assertion test case.
[0017] In one embodiment, checking the interface test case according to the assertion case checking mechanism includes:
[0018] Check the post-verification data of the current interface test case according to the preset interface post-verification rules;
[0019] If it is detected that the post-verification data is missing the corresponding parameter check item, the interface test case is determined to be an assertion case.
[0020] In one embodiment, checking the interface test case according to the reverse use case checking mechanism includes:
[0021] Get the required parameters of the interface corresponding to the interface test case;
[0022] Traverse the interface test cases corresponding to the interface;
[0023] If it is detected that the interface test case performs reverse verification on the required parameters, the interface test case is determined to be a reverse test case.
[0024] In one embodiment, checking the interface test cases according to the test case quantity checking mechanism includes:
[0025] Get the configured number of interface test cases;
[0026] Estimate the number of interface test cases using the boundary value method or the equivalence class partitioning method to obtain the estimated number of interface test cases;
[0027] Compare the configured number of interface test cases with the estimated number of interface test cases to obtain a quantity check result of the interface test cases.
[0028] In a second aspect, the present application also provides an interface test case detection device. The device comprises:
[0029] Data acquisition module, used to obtain interface test case configuration data;
[0030] A test case generation module is used to generate interface test cases based on interface test case configuration data and preset interface test case template data;
[0031] The test case checking module is used to check the interface test case according to the case checking mechanism corresponding to the preset case checking event when the preset case checking event is triggered, and obtain the inspection result of the interface test case;
[0032] Among them, the preset use case check events include no assertion use case check events, assertion use case check events, reverse use case check events and test case quantity check events.
[0033] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:
[0034] Get interface test case configuration data;
[0035] Generate interface test cases based on interface test case configuration data and preset interface test case template data;
[0036] When a preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event to obtain the inspection result of the interface test case;
[0037] Among them, the preset use case check events include no assertion use case check events, assertion use case check events, reverse use case check events and test case quantity check events.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0039] Get interface test case configuration data;
[0040] Generate interface test cases based on interface test case configuration data and preset interface test case template data;
[0041] When a preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event to obtain the inspection result of the interface test case;
[0042] Among them, the preset use case check events include no assertion use case check events, assertion use case check events, reverse use case check events and test case quantity check events.
[0043] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0044] Get interface test case configuration data;
[0045] Generate interface test cases based on interface test case configuration data and preset interface test case template data;
[0046] When a preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event to obtain the inspection result of the interface test case;
[0047] Among them, the preset use case check events include no assertion use case check events, assertion use case check events, reverse use case check events and test case quantity check events.
[0048] The above-mentioned interface test case detection method, apparatus, computer equipment, storage medium, and computer program product can quickly generate interface test cases based on interface test case configuration data and preset interface test case template data. When a non-assertion case check event, an assertion case check event, a reverse case check event, and a test case quantity check event are triggered, the automatically generated interface test cases can be checked from multiple dimensions according to the corresponding case check mechanism to obtain accurate and comprehensive interface test case inspection results. The above-mentioned scheme realizes the automated inspection of interface test cases, improves the detection accuracy of interface test cases, and can promptly detect problems with interface test cases, reduce the probability of interface test case errors, and improve the quality of interface test cases. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 An application environment diagram of an interface test case detection method in one embodiment;
[0050] Figure 2 A flowchart of an interface test case detection method according to an embodiment;
[0051] Figure 3 A schematic flow chart of a step of checking the number of interface test cases in an embodiment;
[0052] Figure 4 A structural block diagram of an interface test case detection device in one embodiment;
[0053] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0055] The interface test case detection method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown, the terminal 102 communicates with the server 104 via a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. Specifically, the tester and the terminal 102 can configure the interface test case, upload the interface test case configuration data to the server 104, and send a test case detection message to the server 104. The server 104 responds to the message, obtains the interface test case configuration data, and generates an interface test case based on the interface test case configuration data and the preset interface test case template data. Then, when the preset test case check event is triggered, the interface test case is checked according to the test case check mechanism corresponding to the preset test case check event to obtain the interface test case inspection result. The preset test case check event includes a non-assertion test case check event, an assertion test case check event, a reverse test case check event, and a test case quantity check event. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Server 104 can be an independent server, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. It is worth mentioning that in an embodiment of the present application, product information keywords and user data can be acquired and processed based on artificial intelligence technology. It is worth mentioning that in an embodiment of the present application, interface test case configuration data can be acquired and processed based on artificial intelligence technology.
[0056] In one embodiment, Figure 2 As shown, an interface test case method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the server in the example:
[0057] Step 202: Obtain interface test case configuration data.
[0058] Interface test case configuration data includes the interface test case number, interface test case preconditions, postconditions, interface output parameters, input parameter details, etc. In actual applications, when testers want to perform case tests on a product function or interface, taking the test interface as an example, when testers want to perform interface tests on a certain interface, they can configure the automated interface test case data of the relevant interface on the deployed interface automation test platform, receive the automated interface test case configuration data input by the user in real time, and obtain the interface test case configuration data.
[0059] Step 204: Generate an interface test case according to the interface test case configuration data and the preset interface test case template data.
[0060] During specific implementation, the post-conditions of the interface test case include the operation type, conditional judgment, verification method, parameter name / interface output parameter, expected result value / input parameter, etc. The generation of the interface test case can be to obtain the logical framework data of the interface test case, i.e., the template data, and based on the template data, automatically fill the configuration data of the interface test case into the corresponding fields to generate the corresponding automated interface test case. It can also be to read the preset interface test case template, which carries data such as the use case name, use case description, operation steps, expected results, and fixed fields of priority, and then write the interface test case configuration data into the preset interface test case template to generate the corresponding interface test case.
[0061] Step 206, when the preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event to obtain the inspection result of the interface test case, wherein the preset use case check event includes a non-assertion use case check event, an assertion use case check event, a reverse use case check event and a test case quantity check event.
[0062] Among them, a non-assertion use case refers to a use case that does not have any verification of the result returned by the interface, and an assertion use case refers to a use case that does not include fixed fields such as status information and data information. In actual applications, testers can preset interface test case inspection events, including non-assertion use case inspection events, assertion use case inspection events, reverse use case inspection events, and interface use case number inspection events. For each event, a corresponding test case inspection mechanism is designed, and corresponding trigger conditions are preset for each event. When the event is triggered, the interface test case is detected according to the corresponding test case inspection mechanism to obtain the corresponding inspection results. Specifically, the interface test case with problems can be marked out. Furthermore, the reasons for non-compliance are given so that testers can find problems in a timely manner.
[0063] In the above-mentioned interface test case detection method, interface test cases can be quickly generated based on interface test case configuration data and preset interface test case template data. When the no-assertion case check event, assertion case check event, reverse case check event, and test case quantity check event are triggered, the automatically generated interface test cases can be checked from multiple dimensions according to the corresponding case check mechanism to obtain accurate and comprehensive interface test case inspection results. The above-mentioned scheme realizes the automated inspection of interface test cases, improves the detection accuracy of interface test cases, and can promptly detect problems with interface test cases, reduce the probability of interface test case errors, and improve the quality of interface test cases.
[0064] In one embodiment, when a preset use case check event is triggered, the interface test case is checked according to the use case check mechanism corresponding to the preset use case check event, and the inspection result of the interface test case includes:
[0065] When a save instruction of a test case is received, a non-assertion case check event and an assertion case check event are triggered, and the interface test case is checked according to the non-assertion case check mechanism and the assertion case check mechanism, and the non-assertion check result and the assertion check result of the interface test case are obtained respectively;
[0066] Also, when the preset use case check cycle is reached, the reverse use case check event and the test case quantity check event are triggered, and the interface test cases are checked according to the reverse use case check mechanism and the test case quantity check mechanism, and the reverse use case check results and quantity check results of the interface test cases are obtained respectively.
[0067] In this embodiment, the tester configures the corresponding interface test case configuration data and interface test case template data, generates the interface test case, and pushes the interface test case to the user terminal. The user terminal displays the interface test case so that the tester can view and confirm it. After confirming that the interface test case is correct, the tester clicks the "Save" button. At this time, when the save instruction of the test case is received, the preset no-assertion case check event and the preset assertion case check event are triggered. According to the no-assertion case check mechanism and the assertion case check mechanism, the written interface test case is checked to see whether there are no-assertion cases and assertion cases. In this way, it is possible to automatically check whether the test case contains assertion cases and no-assertion cases. In addition, the tester can also set a fixed time period to perform reverse case checks and test case quantity checks. Among them, reverse cases generally refer to cases with inputs or states that are not supported by the system. Such cases can check the fault tolerance and reliability of the system. Reverse case checks refer to checking whether the interface test case has verified abnormal scenarios for each functional point. Test case quantity checks refer to whether the number of generated detection interface test cases is reasonable. In this embodiment, a reverse use case check mechanism and a test case quantity check mechanism may be set to start at 11 PM every night to perform reverse use case checks and test case quantity checks on interface test cases. In this embodiment, by presetting the interface test case check mechanism, automatic review of interface test cases can be achieved, thereby improving review efficiency.
[0068] In one embodiment, checking the interface test case according to the no-assertion use case checking mechanism includes: traversing the post-verification data of the interface test case, and if it is detected that the post-verification data does not include Verify method data and ForVerify method data, determining that the interface test case is a no-assertion use case.
[0069] The verification data returned by the interface test case to the interface is called post-verification data. In specific implementation, when performing a non-assertion use case check, if the interface test case does not have any verification on the result returned by the interface, it will result in the use case not being checked even if the interface returns a failure, which is basically a meaningless use case. At this time, the corresponding interface is marked. The configuration of the automated interface test case itself sets certain rules, and only the two methods Verify and ForVerify are used for data verification. When performing a non-assertion use case check, it is only necessary to scan whether the post-verification data contains the Verify method data and the ForVerify method data. If the post-verification data does not contain the two methods Verify and ForVerify, it is determined to be a non-assertion use case. In this embodiment, by directly scanning whether Verify and ForVerify exist in the post-verification data, it is possible to quickly determine whether the interface test case is a non-assertion use case.
[0070] In one embodiment, checking the interface test case according to the assertion case checking mechanism includes: checking the post-verification data of the current interface test case according to the preset interface post-verification rules, and if it is detected that the post-verification data is missing the corresponding parameter check item, then the interface test case is determined to be an assertion case.
[0071] In actual applications, post-verification data is divided into two categories, including status information and data information. The status has fixed fields, and the data information has special keyword checks. If the post-verification data does not contain these check items, it is assumed that such a use case belongs to an assertion use case. Specifically, the return of the interface also has certain rules, and the rules are agreed in advance. For example, the two parameters MSG_CODE and MSG_TEXT represent the status, and the data is in the data.xxx format. In this embodiment, the post-verification data of the interface test case can be scanned according to the above rules. If the post-verification data does not contain the check items of the above parameters, the interface test case is determined to be an assertion use case. In this embodiment, by scanning whether there are corresponding parameter check items in the post-verification data, it is possible to quickly and efficiently determine whether the use case is an assertion use case.
[0072] In one embodiment, checking the interface test case according to the reverse use case checking mechanism includes: obtaining the mandatory parameters of the interface corresponding to the interface test case, traversing the interface test cases corresponding to the interface, and if it is detected that the interface test case performs a reverse check on the mandatory parameters, then determining that the interface test case is a reverse use case.
[0073] From the perspective of testing theory, in addition to forward testing and verification, each functional point also needs to be verified for some abnormal scenarios, which is called reverse verification. In actual applications, when testers configure the interface, they will indicate which parameters must be passed (mandatory items). For the mandatory parameters, reverse verification must be performed, that is, to verify whether the interface will be abnormal if it is not passed or abnormal data is passed. For mandatory items, at least there needs to be a use case to verify the situation when the parameter is not passed. When conducting a use case review, first scan the parameter configuration of the interface to obtain the mandatory items of the interface, that is, the parameters that the interface must pass. Then scan the interface test cases under the interface to see if there are any cases where the mandatory parameters of the interface are not passed. If there is no verification, the reverse use case check is judged to be unqualified and the interface verification is marked as incomplete. Conversely, if the interface test case performs a reverse verification on the mandatory parameters, the interface test case is judged to be a reverse use case. Similarly, by scanning the mandatory parameters of the interface to detect whether there are any cases where the mandatory items of the interface are not verified, a reverse use case check can be made quickly and accurately.
[0074] like Figure 3 As shown, in one embodiment, checking the interface test cases according to the test case quantity checking mechanism includes:
[0075] Step 226, obtaining the configured number of interface test cases;
[0076] Step 246 , estimating the number of interface test cases based on the boundary value method or the equivalence class partitioning method to obtain an estimated number of interface test cases;
[0077] Step 266 , comparing the configured number of interface test cases with the estimated number of interface test cases to obtain a result of checking the number of interface test cases.
[0078] The quantity check of interface test case can be according to the input parameter amount of interface, according to the design method of test case, such as: equivalence class partition method or boundary value etc. estimate the quantity of interface test case, then compare configured interface test case and estimated interface test case quantity, if the interface test case quantity of configuration is larger than the interface test case quantity gap of estimation, then to this interface mark reminder.Specifically, estimation use case data can be realized by boundary value method: such as when interface is configured, input parameter type selects int type, so about the interface test case quantity of this field is at least 3 (maximum value, minimum value, median value). According to equivalence class partition method, estimating interface test case quantity can be: all can configure must fill in parameter when interface is configured, and all configure valid input and invalid input, can combine equivalence class partition and must fill in parameter, estimate the quantity of test case.In the present embodiment, by interface test case quantity inspection mechanism, can quickly make reasonable judgment to the configuration quantity of test case.
[0079] In order to illustrate the interface test case detection method provided by this application, the following is a specific example:
[0080] When the tester wants to perform interface testing on a certain interface, he configures the automated interface test case data of the relevant interface on the deployed interface automated testing platform and sends an interface test case detection message to the server. The server responds to the message, obtains the interface test case configuration data, and reads the preset logical framework data of the interface test case, i.e., the template data. Based on the template data, the configuration data of the interface test case is automatically filled into the corresponding fields to generate the corresponding automated interface test case. When the save instruction of the test case is received, the preset no-assertion case check event and the preset assertion case check event are triggered. According to the no-assertion case check mechanism and the assertion case check mechanism, the interface test case is checked for no-assertion cases and assertion cases, and the no-assertion check result and the assertion check result of the interface test case are obtained. Also, when the preset case check cycle is reached, such as 8 o'clock every night, the reverse case check event and the test case quantity check event are triggered. According to the reverse case check mechanism and the test case quantity check mechanism, the interface test case is reversed and the test case quantity is checked, and the reverse case check result and the quantity check result of the interface test case are obtained.
[0081] Specifically, when performing a non-assertion use case check, it can be to scan whether the post-verification data contains the two methods Verify and ForVerify. If the post-verification data does not contain the two methods Verify and ForVerify, it is determined that there is no assertion use case. The assertion use case check can be based on the preset interface post-verification rules to check the post-verification data of the current interface test case. If it is detected that the post-verification data is missing the corresponding parameter check item, the interface test case is determined to be an assertion use case. When performing a reverse use case check, it can be to first scan the parameter configuration of the interface to obtain the interface mandatory items, that is, the interface must pass parameters, and then scan the interface test cases under the interface to see if there is a situation where the mandatory parameters of the interface are not passed. If there is no verification, the reverse use case check is determined to be unqualified, and the interface verification is marked as incomplete. On the contrary, if the interface test case performs a reverse check on the mandatory parameters, the interface test case is determined to be a reverse use case. The number of interface test cases can be checked based on the number of input parameters of the interface and the design method of the test case, such as the equivalence class partitioning method or boundary value, to estimate the number of interface test cases, and then compare the configured interface test cases with the estimated number of interface test cases. If the difference between the number of configured interface test cases and the estimated number of interface test cases is large, the interface will be marked as a reminder.
[0082] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0083] Based on the same inventive concept, the present application also provides an interface test case detection device for implementing the interface test case detection method involved above. The implementation solution provided by the device is similar to the implementation solution described in the above method. Therefore, the specific limitations in the one or more interface test case detection device embodiments provided below can be found in the above-mentioned limitations on the interface test case detection method, and will not be repeated here.
[0084] In one embodiment, Figure 4 As shown, an interface test case detection device is provided, including: a data acquisition module 510, a test case generation module 520 and a test case checking module 530, wherein:
[0085] The data acquisition module 510 is used to acquire interface test case configuration data.
[0086] The test case generation module 520 is used to generate an interface test case according to the interface test case configuration data and the preset interface test case template data.
[0087] The test case checking module 530 is used to check the interface test case according to the use case checking mechanism corresponding to the preset use case checking event when the preset use case checking event is triggered, and obtain the inspection result of the interface test case, wherein the preset use case checking event includes a non-assertion use case checking event, an assertion use case checking event, a reverse use case checking event and a test case quantity checking event.
[0088] The interface test case detection device described above can quickly generate interface test cases based on interface test case configuration data and preset interface test case template data. When a non-assertion case check event, an assertion case check event, a reverse case check event, and a test case quantity check event are triggered, the automatically generated interface test cases can be checked from multiple dimensions according to the corresponding case check mechanism to obtain accurate and comprehensive interface test case inspection results. The above scheme realizes the automated inspection of interface test cases, improves the detection accuracy of interface test cases, and can promptly detect problems with interface test cases, reducing the probability of interface test case errors and improving the quality of interface test cases.
[0089] In one embodiment, the test case checking module 530 is also used to trigger a non-assertion case checking event and an assertion case checking event when a save instruction of a test case is received, and check the interface test case according to the non-assertion case checking mechanism and the assertion case checking mechanism, to obtain the non-assertion checking result and the assertion checking result of the interface test case respectively; and, when a preset case checking cycle is reached, trigger a reverse case checking event and a test case quantity checking event, and check the interface test case according to the reverse case checking mechanism and the test case quantity checking mechanism, to obtain the reverse case checking result and the quantity checking result of the interface test case respectively.
[0090] In one embodiment, the test case checking module 530 is further configured to traverse the post-verification data of the interface test case. If it is detected that the post-verification data does not include the Verify method data and the ForVerify method data, the interface test case is determined to be a non-assertion test case.
[0091] In one embodiment, the test case checking module 530 is also used to check the post-verification data of the current interface test case according to the preset interface post-verification rules. If it is detected that the post-verification data lacks the corresponding parameter check items, the interface test case is determined to be an assertion case.
[0092] In one embodiment, the test case checking module 530 is also used to obtain the mandatory parameters of the interface corresponding to the interface test case, traverse the interface test cases corresponding to the interface, and if it is detected that the interface test case performs a reverse check on the mandatory parameters, the interface test case is determined to be a reverse test case.
[0093] In one embodiment, the test case checking module 530 is also used to obtain the configured number of interface test cases, estimate the number of interface test cases based on the boundary value method or the equivalence class partitioning method, obtain the estimated number of interface test cases, compare the configured number of interface test cases and the estimated number of interface test cases, and obtain the number check result of the interface test cases.
[0094] Each module in the above-mentioned interface test case detection device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor of the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0095] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory and a network interface connected via a system bus. The processor of the computer device is used 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store interface test case configuration data and interface test case template data, etc. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an interface test case detection method is implemented.
[0096] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0097] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned interface test case detection method when executing the computer program.
[0098] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned interface test case detection method are implemented.
[0099] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above-mentioned interface test case detection method when executed by a processor.
[0100] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0101] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0102] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. An interface test case detection method, characterized in that: The method comprises: Get interface test case configuration data; Generate an interface test case according to the interface test case configuration data and the preset interface test case template data; When a save instruction of the test case is received, a no-assertion case check event and an assertion case check event are triggered, and post-verification data in the interface test case is detected according to the no-assertion case check mechanism and the assertion case check mechanism, and it is checked whether there are assertion cases and no-assertion cases in the interface test case, and a no-assertion check result and an assertion check result of the interface test case are obtained respectively, wherein the post-verification data is verification data returned by the interface test case to the interface; In addition, when the preset use case check cycle is reached, the reverse use case check event and the test case quantity check event are triggered. According to the reverse use case check mechanism, it is checked whether the interface test case has verified the abnormal scenario for each functional point. According to the test case quantity check mechanism, it is checked whether the number of the interface test cases is reasonable, and the reverse use case check results and quantity check results of the interface test case are obtained respectively.
2. The interface test case detection method according to claim 1, characterized in that: Checking the post-verification data in the interface test case according to the non-assertion case checking mechanism includes: Traversing the post-verification data of the interface test case; If it is detected that the post-verification data does not include Verify method data and ForVerify method data, the interface test case is determined to be a non-assertion test case.
3. The interface test case detection method according to claim 1, characterized in that: Checking the post-verification data in the interface test case according to the assertion case checking mechanism includes: Check the post-verification data of the current interface test case according to the preset interface post-verification rules; If it is detected that the post-verification data lacks the corresponding parameter check item, the interface test case is determined to be an assertion case.
4. The interface test case detection method according to any one of claims 1 to 3, characterized in that: Checking whether the interface test case has verified the abnormal scenario for each functional point according to the reverse use case checking mechanism includes: Get the required parameters of the interface corresponding to the interface test case; Traverse the interface test cases corresponding to the interface; If it is detected that the interface test case performs a reverse check on the mandatory parameter, the interface test case is determined to be a reverse test case.
5. The interface test case detection method according to any one of claims 1 to 3, characterized in that: Checking whether the number of interface test cases is reasonable according to the test case number checking mechanism includes: Get the configured number of interface test cases; Estimate the number of interface test cases using the boundary value method or the equivalence class partitioning method to obtain the estimated number of interface test cases; Compare the configured number of the interface test cases with the estimated number of interface test cases to obtain a quantity check result of the interface test cases.
6. An interface test case detection device, characterized in that: The device comprises: Data acquisition module, used to obtain interface test case configuration data; A test case generation module, configured to generate an interface test case based on the interface test case configuration data and preset interface test case template data; A test case checking module is configured to trigger a no-assertion case checking event and an assertion case checking event upon receiving a save instruction for the test case, detect post-verification data in the interface test case according to a no-assertion case checking mechanism and an assertion case checking mechanism, check whether there is an assertion case and a no-assertion case in the interface test case, and obtain a no-assertion check result and an assertion check result of the interface test case, respectively, wherein the post-verification data is verification data returned by the interface test case to the interface; In addition, when the preset use case check cycle is reached, the reverse use case check event and the test case quantity check event are triggered. According to the reverse use case check mechanism, it is checked whether the interface test case has verified the abnormal scenario for each functional point. According to the test case quantity check mechanism, it is checked whether the number of the interface test cases is reasonable, and the reverse use case check results and quantity check results of the interface test case are obtained respectively.
7. The device according to claim 6, characterized in that The test case checking module is further used to traverse the post-verification data of the interface test case, and if it is detected that the post-verification data does not include Verify method data and ForVerify method data, the interface test case is determined to be a non-assertion test case.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Interface testing method and device, equipment, storage medium and program product
CN113434396A