Test case generation method and device and storage medium
By recording and converting debugging records into test cases during the interface debugging process, the problems of resource waste and low efficiency in interface testing are solved, the automatic generation and sharing of test cases are realized, and the efficiency of interface testing is improved.
Patent Information
- Application Number
- CN202510639303.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-09-16
AI Technical Summary
In the existing technology, the initial stage of interface testing requires the construction of automated test cases after the debugging phase, which leads to resource waste and low efficiency.
During the interface debugging process, debug records are recorded, including input message and return message information, and target debug records are filtered in the debug record collection, converted into test cases and uploaded to the test case platform for maintenance and sharing.
Make full use of the data from the interface debugging process to automatically generate test cases, improve production efficiency, reduce costs, avoid waste of resources, realize the reuse and sharing of test cases, and improve interface testing efficiency.
Smart Images

Figure CN120653547A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a test case generation method, device, and storage medium. Background Art
[0002] As software technology continues to develop and system construction gradually achieves separation of front-end and back-end, interface testing is becoming increasingly important in the software testing process. Interface testing is low-cost and highly effective, and is very suitable for automated testing.
[0003] In the prior art, a debugging phase is usually required at the initial stage of interface testing, which usually relies on some interface debugging tools. After the debugging process is completed, automated test cases are constructed to perform automated testing on the interface.
[0004] Automated test cases need to be built separately after the debugging process is completed, which wastes resources and is inefficient. Summary of the Invention
[0005] The embodiments of the present application provide a test case generation method, device, and storage medium for implementing test case conversion during interface debugging to avoid resource waste.
[0006] In a first aspect, an embodiment of the present application provides a test case generation method, comprising:
[0007] During the interface debugging process, the debugging record is obtained and saved in the debugging record set; any debugging record includes the message information of the input message of the interface and the corresponding return message;
[0008] In response to a filtering instruction, filtering target debugging records from the debugging record set;
[0009] The target debugging record is converted into a test case, and the test case is uploaded to a test case platform for maintenance and / or sharing.
[0010] In a second aspect, an embodiment of the present application provides a test case generation device, comprising:
[0011] The recording module is used to obtain the debugging record during the interface debugging process and save it to the debugging record set; any debugging record includes the message information of the interface input message and the corresponding return message;
[0012] a screening module, configured to screen target debugging records from the debugging record set in response to a screening instruction;
[0013] The case processing module is used to convert the target debugging record into a test case, and upload the test case to a test case platform for maintenance and / or sharing.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor;
[0015] The memory stores computer-executable instructions;
[0016] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementation methods of the first aspect.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0019] The test case generation method, device and storage medium provided in the embodiment of the present application obtain debug records during the interface debugging process and save them in a debug record collection; any debug record includes the input message of the interface and the message information of the corresponding return message; in response to the filtering instruction, the target debug record is filtered from the debug record collection; the target debug record is converted into a test case, and the test case is uploaded to the test case platform for maintenance and / or sharing. This embodiment can record debug records during the interface debugging process and automatically generate test cases based on the debug records, thereby making full use of the data of the interface debugging process without having to write test cases separately, improving the production efficiency of test cases, reducing costs, avoiding waste of resources, and accumulating and sharing test cases through the test case platform to achieve test case reuse, which also improves the efficiency of interface testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0021] Figure 1 A schematic diagram of a scenario of a test case generation method provided in an embodiment of the present application;
[0022] Figure 2 A flow chart of a test case generation method provided in one embodiment of the present application;
[0023] Figure 3 A flow chart of a test case generation method provided in one embodiment of the present application;
[0024] Figure 4 A schematic diagram of the structure of a test case generation device provided in one embodiment of the present application;
[0025] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application.
[0026] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0027] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0028] First, let’s explain the terms involved in this application:
[0029] Interface testing: Interface testing is the testing of interfaces between system components. Interface testing primarily monitors the interaction points between external systems and between internal subsystems. Testing focuses on verifying data exchange, transmission, and control management processes, as well as the logical dependencies between systems.
[0030] Automated testing: This article refers to the automation of software testing, which is a process of converting human-driven testing behavior into machine execution.
[0031] In the prior art, a debugging phase is usually required at the initial stage of interface testing, which usually relies on some interface debugging tools. After the debugging process is completed, automated test cases are constructed to perform automated testing on the interface.
[0032] Automated test cases need to be built separately after the debugging process is completed. Automated case tools generally require standardization and are not suitable for debugging when the interface is not stable. Therefore, it is necessary to use automated case tools to create automated test cases after the interface debugging phase is completed. In fact, a large number of input messages are sent to the interface during the interface debugging phase, and corresponding return messages are received. These input messages and corresponding return messages are not reused during the creation of automated test cases. Instead, they are regenerated using automated case tools, which wastes resources and is inefficient.
[0033] In order to solve the above technical problems, the test case generation method provided in the embodiment of the present application can record debugging records during the interface debugging process and automatically generate test cases based on the debugging records, thereby making full use of the data of the interface debugging process, including the input messages and corresponding return messages in the interface debugging process, without the need to write test cases separately, thereby improving the production efficiency of test cases, reducing costs, avoiding waste of resources, and accumulating and sharing test cases through the test case platform to achieve reuse of test cases, which also improves the efficiency of interface testing.
[0034] Figure 1 A schematic diagram of the scenario of the test case generation method provided in this application, such as Figure 1 As shown, during the interface debugging process, debugging records are obtained and saved in a debugging record set, wherein any debugging record includes message information of the interface input message and the corresponding return message; further, the debugging record can be converted into a test case of the interface. Specifically, the debugging record can be screened first, and then the test case can be converted. In response to the screening instruction, the target debugging record can be screened from the debugging record set; the target debugging record is converted into a test case, and the test case is uploaded to the test case platform for maintenance and / or sharing.
[0035] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0036] Figure 2 A flow chart of a test case generation method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method includes:
[0037] S201. During interface debugging, obtain debugging records and save them in a debugging record set; any debugging record includes message information of an input message of the interface and a corresponding return message.
[0038] In this embodiment, during the interface debugging process, the interface call address (URL), message content, interface field value, etc. can be input according to the interface information to call the interface, and the interface can be debugged according to the return message of the interface, such as verifying whether the interface function is normal, whether the format, field, and field value of the return message are correct, etc. If the interface function is abnormal, and / or there are errors in the format, field, and field value of the return message, the interface function can be repaired through the debugging process, and the errors in the format, field, and field value of the return message can be repaired.
[0039] While debugging the interface, record the debugging records of each debugging process, including but not limited to recording the message information of the input message and the corresponding return message, wherein the message information of the input message includes but is not limited to the input message format, input message fields, input message field values, etc., and the message information of the return message includes but is not limited to the return message format, return message fields, return message field values, etc. In addition, the debugging record may also include the interface call address (URL), interface call time, etc.
[0040] Furthermore, the interface call records can be saved in a debug record collection for subsequent batch generation of test cases.
[0041] S202: In response to a filtering instruction, filter target debugging records from the debugging record set.
[0042] In this embodiment, a tester can select target debug records from a call record set based on their needs. The target debug records are debug records for which test cases need to be generated. Alternatively, the target debug records can be filtered from the debug record set based on one or more filter criteria specified by the tester, such as interface call time, input message information, or output message information. This allows for batch selection of target call records.
[0043] Optionally, when screening target debug records from the debug record set, the coverage of the interface functions, codes, requirements, etc. by the target debug records may also be considered, that is, the coverage rate, to ensure that the selected target debug records cover as many functions, codes, requirements, etc. of the interface as possible, thereby ensuring that the coverage rate of the generated test cases is high enough, ensuring the comprehensiveness of the interface test, and avoiding redundant test cases and waste of resources.
[0044] Optionally, during the debugging process, the interface may return a correct return message or an incorrect return message. Therefore, when selecting the target debugging record, you can choose to return the debugging record of the correct return message so that you can generate a forward test case later; you can also choose to return the debugging record of the incorrect return message so that you can generate a reverse test case later. This can be used to verify the behavior of the interface under abnormal, invalid or unexpected input and discover potential defects.
[0045] S203: Convert the target debugging record into a test case, and upload the test case to a test case platform for maintenance and / or sharing.
[0046] In this embodiment, the target debugging records recorded during the debugging process can be converted into test cases used in the testing process. In this way, test cases can be obtained while debugging. Only a simple conversion of the target debugging records is required, and there is no need to write test cases after the interface is debugged, and there is no need to write test cases separately for the testing process.
[0047] Specifically, the test case of the interface usually includes input data and expected response, and the target debugging record includes the input message and corresponding return message of the interface during the debugging process. Therefore, the input message and return message in the target debugging record can be used as the input data and expected response of the test case respectively. In order to facilitate the maintenance and sharing of the test case on the test case platform, the case information of the test case can also be generated according to the target debugging record, including but not limited to one or more of the case identification, case attributes, information of the called target interface, input message field information, and output message field information. The case information of the test case is the case information that can be recognized by the test case platform and can be displayed on the interface of the test case platform. Testers can quickly understand the test case based on the case information, and then maintain and share the test case. Maintenance includes but is not limited to the accumulation, modification, deletion, etc. of the test case, and sharing can share the test case with other testers who need to test the same interface. Furthermore, the case information of the test case can be associated with the input message and output message of the target debugging record to obtain a complete test case, where an automated test script can be generated based on the input message and output message. Accordingly, the case information of the test case can be associated with the automated test script.
[0048] Optionally, when generating case information for a test case based on the target debugging record, one or more of the following may be performed:
[0049] 1) Generate a case identifier. The case identifier can be a case number. In the test case platform, the test case number serves as the primary key of the test case. Each test case number is required to be unique and cannot be repeated with other test cases. To avoid duplicate test case numbers, during the test case conversion process, the newly generated test case number can be the interface identifier + serial number, such as "interface number-000N", where N is the maximum serial number for identifying existing test cases plus one. For example, if the case number of the existing test case is "AAA-0005", the new test case number under the AAA interface is "AAA-0006" to ensure the uniqueness of the case number. In addition, the case identifier can also be the test case name, where the test case name can be generated according to any rules, or the case number can be directly used as the test case name.
[0050] 2) Determine the test case attribute. If the target debug record is a debug record that returns a correct return message, the test case attribute is forward; if the target debug record is a debug record that returns an incorrect return message, the test case attribute is reverse.
[0051] 3) Determine the information of the target interface to be called. The information of the target interface can be an interface name, which is used to determine the interface tested by the test case. The interface number can be selected, or the content other than the common part that matches the call address (URL) in the target debugging record and the interface address stored in the test case platform can be selected as the interface name, or the interface name can be determined according to other rules; in addition, the information of the target interface can also include an interface description, which can be a description of information such as the interface function. Optionally, the interface name can also be used as the interface description.
[0052] 4) Determine the test case input message format, and automatically convert the input message format of the target debugging record into a test case interface format that can be recognized and recorded by the test case platform.
[0053] 5) Determine the input message field of the test case, identify the input message field of the target debugging record, and use it as the input message field of the test case.
[0054] 6) Determine the test case input message field value, identify the target debug record input message field value, and automatically fill it as the input value of the test case input message field.
[0055] 7) Determine the test case return message format, identify the target debug record return message format and automatically convert it into the interface return message format that can be identified and recorded by the test case platform.
[0056] 8) Determine the return message field of the test case, identify the return message field of the target debugging record, and use it as the return message field of the test case.
[0057] 9) Determine the return message field value of the test case. The value is set to empty by default. After the test case platform calls the test case and there is a return message, it is assigned a value. It can be used to compare with the return message field value of the target debugging record.
[0058] The test case generation method provided in this embodiment obtains debug records during the interface debugging process and saves them in a debug record collection; any debug record includes the interface input message and the corresponding return message message information; in response to a screening instruction, a target debug record is screened from the debug record collection; the target debug record is converted into a test case, and the test case is uploaded to a test case platform for maintenance and / or sharing. This embodiment can record debug records during the interface debugging process and automatically generate test cases based on the debug records, thereby fully utilizing the data of the interface debugging process without having to write test cases separately, improving the production efficiency of test cases, reducing costs, avoiding resource waste, and accumulating and sharing test cases through the test case platform to achieve test case reuse, thereby improving interface testing efficiency.
[0059] Based on any of the above embodiments, before converting the target debugging record into a test case, the target debugging record can also be verified based on the test case platform to determine whether the called interface is maintained by the test case platform. The specific verification process can be as follows: Figure 3 Shown, including:
[0060] S301: Determine whether the test case platform maintains system information of the system to which the target interface called in the target debugging record belongs.
[0061] In this embodiment, the test case platform can first verify whether it maintains the system information of the target interface called in the target debugging record. The system information of the target interface is mainly used to distinguish interfaces with the same name under different systems. If the test case platform maintains the system information of the target interface called in the target debugging record, it means that the test case platform has maintained the test case of at least one interface of the system to which the target interface belongs. On this basis, the test case of the target interface can continue to be maintained so that the test case of the target interface is maintained under this system. If the test case platform does not maintain the test case of at least one interface of the system to which the target interface belongs, it means that the test case platform does not maintain the test case of any interface of the system to which the target interface belongs. It is necessary to maintain the system information of the system to which the target interface belongs before maintaining the test case of the target interface. Specifically, if it has not been maintained, execute S302; if it has been maintained, execute S303.
[0062] S302: If it is determined that the test case platform does not maintain the system information of the system to which the target interface belongs, create the system information of the system to which the target interface belongs on the test case platform.
[0063] In this embodiment, if the test case platform does not maintain system information for the target interface's system, system information for the target interface's system is created. This allows the test case platform to maintain the target interface's system information, thereby ensuring that test cases for the target interface are maintained within that system. In specific implementations, a debug record collection for the target interface's system can be created, and target debug records corresponding to the target interface can be stored within this debug record collection. Furthermore, a test case collection for the target interface's system can be created, and test cases for the target interface can subsequently be stored within this test case collection.
[0064] S303: If it is determined that the test case platform maintains the system information of the system to which the target interface belongs, determine whether the test case platform maintains the information of the target interface.
[0065] In this embodiment, if the test case platform has maintained the system information of the system to which the target interface belongs, it is possible to further verify whether the test case platform has maintained the information of the target interface. The test case platform maintains the information of the target interface in order to distinguish different interfaces under the same system, and then maintain their respective test cases according to the interfaces. If the test case platform has maintained the information of the target interface, it means that the test case platform has already maintained the test case of the target interface and can continue to maintain the test case of the newly generated target interface. If the test case platform has not maintained the information of the target interface, it means that the test case platform has not maintained the test case of the target interface and can create the information of the target interface before maintaining the test case of the target interface. Specifically, if it has been maintained, execute S304; if it has not been maintained, execute S305.
[0066] S304: If it is determined that the test case platform maintains information of the target interface, cache the target debugging record to a debugging record set corresponding to the target interface.
[0067] In this embodiment, if the test case platform maintains the information of the target interface, the test case platform can directly continue to maintain the newly generated test case for the target interface. More specifically, a debug record set corresponding to the target interface has been created in the debug record set of the system to which the target interface belongs. The target debug records corresponding to the target interface can be stored in the debug record set corresponding to the target interface, thereby grouping the target debug records according to the interface, so that the target debug records can be read from the debug record set corresponding to the target interface and converted into test cases corresponding to the target interface in batches. In addition, a test case set corresponding to the target interface has been created in the test case set of the system to which the target interface belongs. The test cases of the target interface can be stored in the test case set corresponding to the target interface, thereby grouping the test cases according to the interface.
[0068] S305: If it is determined that the test case platform does not maintain the target interface information, create the target interface information on the test case platform, and cache the target debugging record to a debugging record set corresponding to the target interface.
[0069] In this embodiment, if the test case platform does not maintain the target interface information, it is necessary to create the target interface information on the test case platform so that the test case platform maintains the target interface information, and furthermore, the test cases of the target interface are maintained under the target interface. In specific implementation, a debug record set corresponding to the target interface can be created in the total debug record set of the system to which the target interface belongs, and the target debug records corresponding to the target interface can be stored in the debug record set corresponding to the target interface, so that the target debug records can be read from the debug record set corresponding to the target interface and converted into batches to obtain test cases corresponding to the target interface; in addition, a test case set corresponding to the target interface can be created in the total test case set of the system to which the target interface belongs, and the test cases of the target interface can be stored in the test case set corresponding to the target interface.
[0070] On the basis of the above embodiment, if it is determined that the test case platform maintains information of the target interface, caching the target debug record to a debug record set corresponding to the target interface includes:
[0071] If it is determined that the test case platform maintains the target interface information, verifying whether the target debugging record is consistent with the message format in the target interface information maintained by the test case platform;
[0072] If it is determined that the message formats are consistent, caching the target debug record to the debug record set corresponding to the target interface;
[0073] If it is determined that the message formats are inconsistent, an error message will be prompted.
[0074] In this embodiment, considering that the interface code, input message fields, return message fields, etc. may change during the interface debugging process, while the input message and return message formats generally do not change, when verifying the information of the target interface maintained by the test case platform, if it is determined that the test case platform maintains the information of the target interface, it is possible to further verify whether the input message and return message formats in the target debugging record are consistent with the input message and return message formats in the information of the target interface maintained by the test case platform, thereby verifying the accuracy of the target debugging record. In particular, if it is determined that the message formats are inconsistent, it means that the target debugging record may not be a debugging record belonging to the interface, or an error may occur in the interface, or the information of the target interface maintained by the test case platform is wrong. At this time, an error message can be triggered for the tester to investigate; if it is determined that the message formats are consistent, the target debugging record can be further cached to the debugging record set corresponding to the target interface.
[0075] Based on the above embodiment, if it is determined that the message formats are consistent, caching the target debug record to the debug record set corresponding to the target interface may further specifically include:
[0076] If it is determined that the message formats are consistent, comparing the fields of the input message and the return message in the target debugging record and the information of the target interface maintained by the test case platform;
[0077] If at least one of the input message and return message fields of the target debugging record is not included in the input message and return message fields of the target interface information maintained by the test case platform, the target interface information maintained by the test case platform is updated.
[0078] In this embodiment, if it is determined that the target debugging record is consistent with the message format in the target interface information maintained by the test case platform, the input message field and the return message field in the target debugging record can be further compared with the input message field and the return message field in the target interface information maintained by the test case platform. If there is at least one field in the input message and return message fields of the target debugging record that is not included in the input message and return message fields in the target interface information maintained by the test case platform, it means that the interface may have been updated, and therefore it is also necessary to update the target interface information maintained by the test case platform, especially to add the excluded fields to the target interface information maintained by the test case platform, so as to ensure the accuracy of the target interface information maintained by the test case platform; if the input message and return message fields of the target debugging record are both included in the input message and return message fields in the target interface information maintained by the test case platform (which may be less than the input message and return message fields in the target interface information maintained by the test case platform), then there is no need to update the target interface information maintained by the test case platform.
[0079] Based on any of the above embodiments, after uploading the test case to the test case platform, the method further includes:
[0080] In response to a call request for the test case, performing call permission verification according to the call request;
[0081] After the call permission verification is passed, the test case is obtained from the test case platform and run to send the input message in the test case to the target interface corresponding to the test case, and receive the actual return message of the target interface and compare it with the return message in the test case.
[0082] In this embodiment, the test case can be shared through the test case platform, and any tester with calling authority can call the test case, send a call request for the test case to the test case platform, and then verify the calling authority based on the call request. The specific verification process is not limited in this embodiment. After the calling authority verification is passed, the tester can obtain the test case from the test case platform and run it. When running the test case, the input message in the test case can be sent to the target interface corresponding to the test case, and the actual return message of the target interface can be received and compared with the return message in the test case, thereby realizing the test of the target interface. Optionally, the test case can include an automation script that can automatically realize operations such as sending input messages, receiving actual return messages, and comparing return messages, thereby realizing automated testing.
[0083] Based on any of the above embodiments, after uploading the test case to the test case platform, the method further includes:
[0084] In response to a modification request for the test case, the test case in the test case platform is updated.
[0085] In this embodiment, the tester can also modify the test cases in the test case platform, and can send a modification request for the test case to the test case platform, such as modifying the input message field value, etc., and then make corresponding modifications to the test cases in the test case platform to achieve the update of the test cases and ensure the validity of the test cases.
[0086] Figure 4 A schematic diagram of the structure of the test case generation device provided in this application, such as Figure 4 As shown, the test case generating device 400 provided in this embodiment includes:
[0087] Recording module 401 is used to obtain debugging records during interface debugging and save them into a debugging record set; any debugging record includes message information of the interface input message and the corresponding return message;
[0088] A screening module 402 is configured to screen target debugging records from the debugging record set in response to a screening instruction;
[0089] The case processing module 403 is configured to convert the target debugging record into a test case, and upload the test case to a test case platform for maintenance and / or sharing.
[0090] In a possible implementation, when converting the target debugging record into a test case, the case processing module is configured to:
[0091] Generate case information of the test case according to the target debugging record, wherein the case information includes at least one of the following: case identification, case attributes, information of the called target interface, input message field information, and output message field information;
[0092] The case information is associated with the input message and the output message of the target debugging record to obtain the test case.
[0093] In a possible implementation, before converting the target debugging record into a test case, the case processing module is further configured to:
[0094] Determining whether the test case platform maintains system information of a system to which the target interface called in the target debugging record belongs;
[0095] If it is determined that the test case platform does not maintain the system information of the system to which the target interface belongs, creating the system information of the system to which the target interface belongs on the test case platform;
[0096] If it is determined that the test case platform maintains the system information of the system to which the target interface belongs, determining whether the test case platform maintains the information of the target interface;
[0097] If it is determined that the test case platform maintains information of the target interface, caching the target debug record to a debug record set corresponding to the target interface;
[0098] If it is determined that the test case platform does not maintain the target interface information, the target interface information is created on the test case platform, and the target debugging record is cached in a debugging record set corresponding to the target interface.
[0099] In a possible implementation, if the case processing module determines that the test case platform maintains information of the target interface, then when caching the target debug record into a debug record set corresponding to the target interface, the module is configured to:
[0100] If it is determined that the test case platform maintains the target interface information, verifying whether the target debugging record is consistent with the message format in the target interface information maintained by the test case platform;
[0101] If it is determined that the message formats are consistent, caching the target debug record to the debug record set corresponding to the target interface;
[0102] If it is determined that the message formats are inconsistent, an error message will be prompted.
[0103] In a possible implementation, if the case processing module determines that the message formats are consistent, then when caching the target debug record in a debug record set corresponding to the target interface, it is configured to:
[0104] If it is determined that the message formats are consistent, comparing the fields of the input message and the return message in the target debugging record and the information of the target interface maintained by the test case platform;
[0105] If at least one of the input message and return message fields of the target debugging record is not included in the input message and return message fields of the target interface information maintained by the test case platform, the target interface information maintained by the test case platform is updated.
[0106] In a possible implementation, after uploading the test case to the test case platform, the case processing module is further configured to:
[0107] In response to a call request for the test case, performing call permission verification according to the call request;
[0108] After the call permission verification is passed, the test case is obtained from the test case platform and run to send the input message in the test case to the target interface corresponding to the test case, and receive the actual return message of the target interface and compare it with the return message in the test case.
[0109] In a possible implementation, after uploading the test case to the test case platform, the case processing module is further configured to:
[0110] In response to a modification request for the test case, the test case in the test case platform is updated.
[0111] The test case generation device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0112] Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 further includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.
[0113] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that the at least one processor 501 performs the above method.
[0114] The specific implementation process of the processor 501 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0115] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0116] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory.
[0117] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0118] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0119] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0120] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0121] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0122] The division of units is merely a logical functional division; actual implementations may employ alternative divisions, such as combining or integrating multiple units or components into another system, or omitting or disabling certain features. Furthermore, any direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units, either through an interface, electrical, mechanical, or other means.
[0123] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0124] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0125] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0126] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0127] Finally, it should be noted that those skilled in the art will readily identify other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The present invention is not limited to the precise structure described above and illustrated in the accompanying drawings, and various modifications and variations may be made without departing from the scope thereof. The scope of the present invention is limited solely by the appended claims.
Claims
1. A test case generation method, characterized in that: include: During interface debugging, obtain debugging records and save them to the debugging record collection; Any debugging record includes the message information of the interface input message and the corresponding return message; In response to a filtering instruction, filtering target debugging records from the debugging record set; The target debugging record is converted into a test case, and the test case is uploaded to a test case platform for maintenance and / or sharing.
2. The method according to claim 1, characterized in that Converting the target debugging record into a test case includes: Generate case information of the test case according to the target debugging record, wherein the case information includes at least one of the following: case identification, case attributes, information of the called target interface, input message field information, and output message field information; The case information is associated with the input message and the output message of the target debugging record to obtain the test case.
3. The method according to claim 1, characterized in that Before converting the target debugging record into a test case, the method further includes: Determining whether the test case platform maintains system information of a system to which the target interface called in the target debugging record belongs; If it is determined that the test case platform does not maintain the system information of the system to which the target interface belongs, creating the system information of the system to which the target interface belongs on the test case platform; If it is determined that the test case platform maintains the system information of the system to which the target interface belongs, determining whether the test case platform maintains the information of the target interface; If it is determined that the test case platform maintains information of the target interface, caching the target debug record to a debug record set corresponding to the target interface; If it is determined that the test case platform does not maintain the target interface information, the target interface information is created on the test case platform, and the target debugging record is cached in a debugging record set corresponding to the target interface.
4. The method according to claim 1, wherein If it is determined that the test case platform maintains information of the target interface, caching the target debug record to a debug record set corresponding to the target interface includes: If it is determined that the test case platform maintains the target interface information, verifying whether the target debugging record is consistent with the message format in the target interface information maintained by the test case platform; If it is determined that the message formats are consistent, caching the target debug record to the debug record set corresponding to the target interface; If it is determined that the message formats are inconsistent, an error message will be prompted.
5. The method according to claim 4, characterized in that If it is determined that the message formats are consistent, caching the target debug record to a debug record set corresponding to the target interface further includes: If it is determined that the message formats are consistent, comparing the fields of the input message and the return message in the target debugging record and the information of the target interface maintained by the test case platform; If at least one of the input message and return message fields of the target debugging record is not included in the input message and return message fields of the target interface information maintained by the test case platform, the target interface information maintained by the test case platform is updated.
6. The method according to any one of claims 1 to 5, characterized in that After uploading the test case to the test case platform, the method further includes: In response to a call request for the test case, performing call permission verification according to the call request; After the call permission verification is passed, the test case is obtained from the test case platform and run to send the input message in the test case to the target interface corresponding to the test case, and receive the actual return message of the target interface and compare it with the return message in the test case.
7. The method according to any one of claims 1 to 5, characterized in that After uploading the test case to the test case platform, the method further includes: In response to a modification request for the test case, the test case in the test case platform is updated.
8. A test case generating device, characterized in that: include: The recording module is used to obtain the debugging records during the interface debugging process and save them into the debugging record collection; Any debugging record includes the message information of the interface input message and the corresponding return message; a screening module, configured to screen target debugging records from the debugging record set in response to a screening instruction; The case processing module is used to convert the target debugging record into a test case, and upload the test case to a test case platform for maintenance and / or sharing.
9. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.