CN112631929A - Test case generation method and device, storage medium and electronic equipment - Google Patents

Test case generation method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112631929A
CN112631929A CN202011610774.8A CN202011610774A CN112631929A CN 112631929 A CN112631929 A CN 112631929A CN 202011610774 A CN202011610774 A CN 202011610774A CN 112631929 A CN112631929 A CN 112631929A
Authority
CN
China
Prior art keywords
interface
information
added
test case
log
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011610774.8A
Other languages
Chinese (zh)
Inventor
谭林斯
李野
甄坡
袁友高
覃海鸥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Securities Co Ltd
Original Assignee
Ping An Securities Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Securities Co Ltd filed Critical Ping An Securities Co Ltd
Priority to CN202011610774.8A priority Critical patent/CN112631929A/en
Publication of CN112631929A publication Critical patent/CN112631929A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention provides a test case generation method, a test case generation device, a storage medium and electronic equipment, which belong to the technical field of automatic test tools, and the method comprises the following steps: the method comprises the steps of obtaining a log to be processed, analyzing the log to be processed, obtaining calling interface information contained in the log to be processed, comparing the calling interface information with an existing test case, determining interface information to be added, and generating a corresponding target test case according to the interface information to be added. The method improves the coverage rate of the test case to the actual test requirement, and further ensures the test effect.

Description

Test case generation method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the technical field of automated test tools, and in particular, to a test case generation method, a test case generation apparatus, a computer-readable storage medium, and an electronic device.
Background
The automated testing generally refers to the automation of software testing, which is to run a system or an application under a preset condition and evaluate a running result. In the current technical scheme, a test case is generally used to automatically detect a system or an application program, however, the test case is easy to have incomplete coverage of test requirements, and further the test result is affected, so how to improve the coverage of the test case and ensure the accuracy of the test result becomes a technical problem to be solved urgently.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
Embodiments of the present disclosure provide a test case generation method, a log-based test case generation apparatus, a computer-readable storage medium, and an electronic device.
According to a first aspect of the present disclosure, a test case generation method is provided, including:
acquiring a log to be processed;
analyzing the log to be processed to obtain calling interface information contained in the log to be processed;
comparing the calling interface information with the existing test case to determine the information of the interface to be added;
and generating a corresponding target test case according to the information of the interface to be added.
In an exemplary embodiment of the present disclosure, generating a corresponding target test case according to the information of the interface to be added includes:
generating a single interface case corresponding to the interface information to be added according to the interface information to be added;
and generating the target test case according to each single-interface case.
In an exemplary embodiment of the present disclosure, generating a single interface use case corresponding to the to-be-added interface information according to the to-be-added interface information includes:
monitoring an interface corresponding to the interface information to be added according to the interface information to be added;
if the interface is detected to be called, acquiring request information for calling the interface and a calling state of the interface, wherein the calling state is used for describing a calling result of the interface;
if the calling state is calling successfully, acquiring an interface request path and interface input parameters according to the request information for calling the interface;
and generating the single interface case corresponding to the interface information to be added according to the interface request path and the interface input parameters.
In an exemplary embodiment of the present disclosure, generating the target test case according to each of the single-interface use cases includes:
acquiring timestamp information of the log to be processed;
and generating the target test case based on the timestamp information of the log to be processed corresponding to each piece of interface information to be added and the single interface case corresponding to each piece of interface information to be added.
In an exemplary embodiment of the present disclosure, generating the target test case based on timestamp information of a log to be processed corresponding to each piece of interface information to be added and the single interface case corresponding to each piece of interface information to be added includes:
and selecting a preset number of single interface cases to generate the target test case based on the timestamp information of the log to be processed corresponding to each interface information to be added and the single interface cases corresponding to each interface information to be added.
In an exemplary embodiment of the present disclosure, comparing the calling interface information with an existing test case, and determining interface information to be added includes:
determining an existing interface corresponding to the existing test case according to the existing test case;
and comparing the calling interface information with the existing interface, determining an interface to be added which is not contained in the existing interface, and determining interface information to be added corresponding to the interface to be added.
In an exemplary embodiment of the present disclosure, the method further includes:
acquiring an input parameter type corresponding to the interface information to be added based on the interface information to be added, wherein the input parameter type comprises necessary and unnecessary types;
and generating a reverse single-interface use case corresponding to the information of the interface to be added according to the input parameter type.
According to a second aspect of the present disclosure, there is provided a test case generation apparatus, including:
the first acquisition module is used for acquiring the log to be processed;
the second acquisition module is used for analyzing the log to be processed and acquiring calling interface information contained in the log to be processed;
the determining module is used for comparing the calling interface information with the existing test case and determining the interface information to be added;
and the processing module is used for generating a corresponding target test case according to the information of the interface to be added.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a test case generation method as recited in any one of the above.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising:
a processor; and
a memory having a computer program stored thereon;
wherein the processor is configured to implement the test case generation method according to any one of the above via execution of the computer program.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
based on the embodiments of the present disclosure, the log to be processed is obtained, the log to be processed is analyzed, the call interface information included in the log to be processed is obtained, the call interface information is compared with the existing test case, the interface information to be added is determined, and the corresponding target test case is generated according to the interface information to be added.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
Fig. 2 is a flowchart illustrating a test case generation method according to an embodiment of the present application.
Fig. 3 illustrates a flowchart of step S240 in the test case generation method of fig. 2 according to an embodiment of the present application.
Fig. 4 illustrates a flowchart of step S310 in the test case generation method of fig. 3 according to an embodiment of the present application.
Fig. 5 illustrates a flowchart of step S320 in the test case generation method of fig. 3 according to an embodiment of the present application.
Fig. 6 illustrates a flowchart of step S230 in the test case generation method of fig. 2 according to an embodiment of the present application.
Fig. 7 shows a flowchart illustrating that the test case generation method further includes generating a reverse single-interface use case according to an embodiment of the present application.
Fig. 8 shows a schematic block diagram of a test case generation apparatus according to an embodiment of the present application.
FIG. 9 shows a schematic block diagram of an electronic device according to one embodiment of the present application.
FIG. 10 shows a schematic diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
As shown in fig. 1, the system architecture may include a terminal device (e.g., one or more of a smartphone 101, a tablet computer 102, and a portable computer 103 shown in fig. 1, but may also be a desktop computer, etc.), a network 104, and a server 105. The network 104 serves as a medium for providing communication links between terminal devices and the server 105. Network 104 may include various connection types, such as wired communication links, wireless communication links, and so forth.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
A user may use a terminal device to interact with a server 105, which may be a server providing various services, through a network 104 to receive or transmit information and the like. A user may obtain a to-be-processed log stored in the server 105 by using the terminal device 103 (or the terminal device 101 or 102), analyze the to-be-processed log, obtain calling interface information included in the to-be-processed log, compare the calling interface information with an existing test case, determine interface information to be added, and generate a corresponding target test case according to the interface information to be added.
It should be noted that the test case generation method provided in the embodiment of the present application is generally executed by a terminal device, and accordingly, the test case generation apparatus is generally disposed in the terminal device. However, in other embodiments of the present application, the server 105 may also have a similar function as the terminal device, so as to execute the scheme of the test case generation method provided in the embodiments of the present application.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 2 is a flowchart illustrating a test case generation method according to an embodiment of the present application. Referring to fig. 2, the test case generation method at least includes steps S210 to S240, which are described in detail as follows:
in step S210, a log to be processed is acquired.
The log to be processed may be an operation log generated according to a user operation during the use of the system or the application program, and may include interface information (for example, an interface name, an input parameter, and the like) called by the user during the use, parameter information returned by the calling interface, and the like.
In an example, the pending log may be stored in a database of the terminal device for retrieval. When the terminal device executes the test case generation method, the log to be processed can be acquired from a local storage location (namely, a database), so that the acquisition efficiency of the log to be processed is improved.
In another example, the pending logs may also be stored in a server, and the operation logs generated by different terminal devices may be stored in the same server. Therefore, when the terminal equipment acquires the log to be processed, the operation logs generated by other terminal equipment can be acquired. It should be understood that the coverage rate of the operation logs generated by the plurality of terminal devices to the interface is higher, and the coverage rate of the subsequently generated test cases to the actual test requirements can be further ensured.
In step S220, the log to be processed is analyzed, and the call interface information included in the log to be processed is obtained.
The calling interface may be an interface called by a user in an actual use process, and the calling interface information may be information related to the interface called by the user. For example, the calling interface information may include, but is not limited to, an interface name of the called interface, identification information, time information of the calling interface, and the like.
In this embodiment, the terminal device may analyze the acquired to-be-processed log, and acquire the call interface information of the user from the to-be-processed log, so as to know an interface that the user will call in the actual use process.
In step S230, the calling interface information is compared with an existing test case, and interface information to be added is determined.
The existing test case may be a written test case.
The interface to be added may be an interface that is not involved in the existing test case, and the information of the interface to be added is information related to the interface that is not involved in the existing test case, and may include an interface name and input parameters of the interface to be added.
In this embodiment, the terminal device may compare the call interface information of the user in the actual use process with existing test cases, and it should be understood that the existing test cases are written for interfaces, and each test case may relate to at least one interface. Therefore, the calling interface information can be compared with the interfaces related to the existing test cases, the interfaces which are not related to the existing test cases, namely the interfaces to be added, are determined, and the information of the interfaces to be added, such as the interface names and the like, is determined.
In step S240, a corresponding target test case is generated according to the information of the interface to be added.
In the embodiment, according to the determined interface information to be added, a target test case corresponding to the interface information to be added is generated. Therefore, the test case can be matched with the actual operation of a user, the coverage rate of the test case on the actual test requirement is improved, and the test effect is further ensured.
Based on the embodiment shown in fig. 2, fig. 3 is a flowchart illustrating step S240 in the test case generation method of fig. 2 according to an embodiment of the present application. Referring to fig. 3, step S240 at least includes steps S310 to S320, which are described in detail as follows:
in step S310, a single interface case corresponding to the information of the interface to be added is generated according to the information of the interface to be added.
The single interface case may be a test program for a single interface, and the single interface may be tested according to the single interface case to determine whether the interface can be normally called.
In this embodiment, the terminal device may generate a single-interface use case corresponding to each piece of to-be-added interface information according to each piece of to-be-added interface information, so as to obtain the single-interface use case for each interface. When testing, the single-interface test case is used for testing, and whether the interface can be normally called can be determined.
In step S320, the target test case is generated according to each single-interface case.
In this embodiment, based on a plurality of single-interface use cases, at least two single-interface use cases are associated and combined to obtain a target test case. It should be understood that a user may involve multiple interfaces in one operation process, and therefore, the target test case is generated based on multiple single-interface cases, so that the generated target test case can meet actual operation requirements of the user, and meanwhile, working conditions of the multiple interfaces when being used in association can be tested, and a test effect of the target test case is ensured.
Based on the embodiments shown in fig. 2 and fig. 3, fig. 4 is a flowchart illustrating step S310 in the test case generation method of fig. 3 according to an embodiment of the present application. Referring to fig. 4, step S310 at least includes steps S410 to S440, which are described in detail as follows:
in step S410, according to the information of the interface to be added, monitoring an interface corresponding to the information of the interface to be added.
In an embodiment of the present application, the terminal device may use a preset interface monitor to monitor an interface corresponding to the to-be-added interface information, so as to obtain call information of the to-be-added interface, where the call information may include, but is not limited to, request information for calling the to-be-added interface, a call state for calling the to-be-added interface, and the like. The call state may be used to indicate a call result of the interface to be added, for example, the call state may include call success and call failure, and the like.
In an example, the call state of the interface to be added can be determined by intercepting the feedback information for calling the interface to be added. The feedback information may be information returned by the interface to be added after the interface to be added is called. If the calling is successful, the feedback information may include information to be accessed by the user for calling the interface to be added, and if the calling is failed, the feedback information may include prompt information that the interface calling is abnormal. Therefore, the calling state of the interface to be added can be determined according to the feedback information.
In step S420, if it is detected that the interface is called, request information for calling the interface and a calling state of the interface are obtained, where the calling state is used to describe a calling result of the interface.
In this embodiment, when the interface monitor receives request information for calling an interface to be added, the interface monitor may record the request information correspondingly, and obtain a calling state of the interface after the interface calling is finished, so as to determine whether the interface to be added is successfully called.
In step S430, if the calling state is that the calling is successful, an interface request path and an interface input parameter are obtained according to the request information for calling the interface.
In this embodiment, the terminal device may divide the history call record of the interface to be added into two categories, i.e., a call success category and a call exception category, according to different interface call states, and if the call is abnormal, it indicates that the request information or the input parameter of the interface to be added is incorrect, or that the two interfaces conflict with each other, so that the interface to be added cannot be correctly called.
Therefore, the terminal device can obtain the interface request path and the interface input parameters contained in the request information according to the successful call of the interface to be added. The interface input parameters may be parameters required for invoking an interface, for example, when a user invokes a login interface, the user needs to input a user account and an account password as interface input parameters, and the like.
In step S440, the single interface case corresponding to the to-be-added interface information is generated according to the interface request path and the interface input parameter.
In this embodiment, since the interface request path and the interface input parameter are obtained from the request information that is successfully called, the feasibility of the single interface case of the to-be-added interface generated according to the interface request path and the interface input parameter can be ensured, and the single interface test case is prevented from being unable to successfully call the interface, thereby affecting the test result of the test case.
Based on the embodiments shown in fig. 2, fig. 3, and fig. 4, in an embodiment of the present application, generating the single interface use case corresponding to the to-be-added interface information according to the interface request path and the interface input parameter includes:
acquiring a target log corresponding to the interface to be added, wherein the target log comprises a call success log and a call failure log;
acquiring parameter characteristic information of the interface to be added according to the target log, wherein the parameter characteristic information is used for describing a format rule of an interface input parameter;
and generating the single interface case corresponding to the interface information to be added according to the interface request path, the interface input parameters and the parameter characteristic information.
The target log may be log information generated by the interface to be added in the historical call, and may be divided into a call success log and a call failure log according to a call state of the interface to be added each time the interface is called.
The parameter characteristic information is used to describe a format rule of the interface input parameter, for example, the parameter characteristic information may be a data type of a certain parameter or a correct execution operation corresponding to the parameter, and the like. Specifically, the call success log and the call failure log are compared, so that the correct data type corresponding to each interface input parameter and the correct execution operation of the interface input parameter and the like can be determined when the to-be-added interface is requested to be called, the parameter characteristic information of the to-be-added interface can be observed when a single-interface use case is generated, and the situation that the generated single-interface use case cannot normally run due to the fact that the interface input parameters of the single-interface use case do not accord with format rules is prevented.
Based on the embodiments shown in fig. 2 and fig. 3, fig. 5 shows a flowchart of step S320 in the test case generation method of fig. 3 according to an embodiment of the present application. Referring to fig. 5, step S320 at least includes steps S510 to S520, which are described in detail as follows:
in step S510, timestamp information of the log to be processed is acquired.
In this embodiment, the time stamp information may be information indicating the time when the interface is called. It should be understood that each log may correspond to a call record of an interface, and the timestamp information for generating the log is the time information for calling the corresponding interface. Therefore, according to the timestamp information of each log to be processed, the calling sequence of each interface can be known.
In step S520, the target test case is generated based on the timestamp information of the log to be processed corresponding to each piece of interface information to be added and the single interface case corresponding to each piece of interface information to be added.
In the embodiment, the single interface cases corresponding to the interface information to be added are sorted according to the timestamp information of the log to be processed, and then the target test case is generated according to the sorted single interface cases, so that the logic correctness of the generated target test case can be ensured, the target test case can be tested based on actual business logic, and the test effect of the target test case is ensured.
Based on the foregoing embodiment, in an embodiment of the present application, generating the target test case based on timestamp information of a log to be processed corresponding to each piece of interface information to be added and the single interface case corresponding to each piece of interface information to be added includes:
and selecting a preset number of single interface cases to generate the target test case based on the timestamp information of the log to be processed corresponding to each interface information to be added and the single interface cases corresponding to each interface information to be added.
In this embodiment, the predetermined number may be a predetermined threshold value for defining the number of single interface cases contained in the test case. For example, the predetermined number may be 3 or 5, etc., which are merely exemplary examples, and a person skilled in the art may determine the corresponding predetermined number according to actual needs, and the present application is not limited to this specifically.
The preset quantity is determined in advance, so that the quantity of the single-interface cases contained in each target test case is limited, the situation that the interfaces with abnormal work cannot be quickly positioned when the target test cases determine that the interfaces work abnormally due to the fact that the single-interface test cases contained in the target test cases are too many can be prevented, and the positioning efficiency of the abnormal interfaces can be improved.
Based on the embodiment shown in fig. 2, fig. 6 is a flowchart illustrating step S230 in the test case generation method of fig. 2 according to an embodiment of the present application. Referring to fig. 6, step S230 at least includes steps S610 to S620, which are described in detail as follows:
in step S610, an existing interface corresponding to the existing test case is determined according to the existing test case.
In this embodiment, the terminal device may determine, according to an existing test case, an interface involved in the existing test case, that is, an interface of the existing test case. It should be noted that there may be one or more existing interfaces involved in one test case.
In step S620, comparing the calling interface information with the existing interface, determining an interface to be added that is not included in the existing interface, and determining information of an interface to be added corresponding to the interface to be added.
In the embodiment, the terminal equipment compares the calling interface information with the existing interface, and if the calling interface information is matched with the existing interface, the terminal equipment indicates that the interface corresponding to the calling interface information has the test case, and does not need to regenerate the test case; if the calling interface information is not matched with the existing interface, it indicates that there is no test case corresponding to the interface calling information, and the interface may be used as an interface to be added, and the information (for example, an interface name or identification information) of the interface to be added corresponding to the interface to be added is determined.
Therefore, whether a certain interface needs to generate a corresponding test case or not can be accurately known, so that the coverage rate of the generated target test case and the actual test requirement can be improved, and the test effect of the target test case is further ensured.
Based on the embodiment shown in fig. 2, fig. 7 is a flowchart illustrating a reverse single-interface case generation process further included in the test case generation method according to an embodiment of the present application. Referring to fig. 7, generating the reverse single interface use case at least includes steps S710 to S720, which are described in detail as follows:
in step S710, based on the interface information to be added, an input parameter type corresponding to the interface information to be added is obtained, where the input parameter type includes necessary and unnecessary.
The input parameter type may be identification information indicating whether the input parameter of the interface is necessary, and may include both necessary and unnecessary types. For example, in the login process, a user calls a login interface, and the input parameter types of the user ID and the password are required; if the user calls the query interface, the user does not need to have input parameters in the query process, and can query in a full range, or input information to perform accurate query, such as querying the quotations of all stocks or accurately querying the quotation of a certain stock, and the like, so that the type of the input parameters of the query interface is unnecessary, and the like. By classifying the interface input parameters, the importance of the interface input parameters can be determined when the interface to be added is called.
In an embodiment of the present application, a correspondence table between interface information and input parameter types may be pre-established, so that the correspondence table may be queried according to the interface information to be added, so as to clarify the input parameter type of the interface to be added.
In step S720, a reverse single-interface use case corresponding to the information of the interface to be added is generated according to the type of the input parameter.
The reverse single-interface use case may be a use case for testing an interface when an input parameter type is necessary.
In this embodiment, if the type of the input parameter of a certain interface to be added is necessary, a corresponding reverse single-interface use case may be generated according to the information of the interface to be added, where the reverse single-interface use case does not include an interface input parameter necessary for invoking the interface to be added. Therefore, whether the interface to be added can respond correctly can be tested. For example, when a login interface is called, a user account and an account password are not input, and the interface can also be successfully called, which indicates that the login interface is abnormal, and the like.
Therefore, the interface to be added can be comprehensively tested by generating the reverse single-interface case, so that the comprehensiveness of the test result of the interface to be added is ensured, and the normal work of the interface to be added can be ensured.
The present disclosure also provides a test case generation device. Referring to fig. 8, the apparatus may include a first obtaining module 810, a second obtaining module 820, a determining module 830, and a processing module 840. Wherein:
the first obtaining module 810 is configured to obtain a log to be processed;
the second obtaining module 820 is configured to analyze the log to be processed, and obtain call interface information included in the log to be processed;
the determining module 830 is configured to compare the call interface information with an existing test case, and determine interface information to be added;
the processing module 840 is configured to generate a corresponding target test case according to the information of the interface to be added.
The specific details of each module in the test case generation apparatus have been described in detail in the corresponding test case generation method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 500 according to this embodiment of the invention is described below with reference to fig. 9. The electronic device 500 shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 9, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: the at least one processing unit 510, the at least one memory unit 520, and a bus 530 that couples various system components including the memory unit 520 and the processing unit 510.
Wherein the storage unit stores program code that is executable by the processing unit 510 to cause the processing unit 510 to perform steps according to various exemplary embodiments of the present invention as described in the above section "exemplary methods" of the present specification. For example, the processing unit 510 may perform step 210 as shown in fig. 2: acquiring a log to be processed; step S220: analyzing the log to be processed to obtain calling interface information contained in the log to be processed; step S230, comparing the calling interface information with the existing test case, and determining the interface information to be added; and step S240, generating a corresponding target test case according to the information of the interface to be added.
The memory unit 520 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)5201 and/or a cache memory unit 5202, and may further include a read only memory unit (ROM) 5203.
Storage unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may be one or more of any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 700 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 500, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 550. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 560. As shown, the network adapter 560 communicates with the other modules of the electronic device 500 over the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.
Referring to fig. 10, a program product 600 for implementing the above method according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A test case generation method is characterized by comprising the following steps:
acquiring a log to be processed;
analyzing the log to be processed to obtain calling interface information contained in the log to be processed;
comparing the calling interface information with the existing test case to determine the information of the interface to be added;
and generating a corresponding target test case according to the information of the interface to be added.
2. The method according to claim 1, wherein generating a corresponding target test case according to the information of the interface to be added comprises:
generating a single interface case corresponding to the interface information to be added according to the interface information to be added;
and generating the target test case according to each single-interface case.
3. The method according to claim 2, wherein generating a single interface use case corresponding to the interface information to be added according to the interface information to be added comprises:
monitoring an interface corresponding to the interface information to be added according to the interface information to be added;
if the interface is detected to be called, acquiring request information for calling the interface and a calling state of the interface, wherein the calling state is used for describing a calling result of the interface;
if the calling state is calling successfully, acquiring an interface request path and interface input parameters according to the request information for calling the interface;
and generating the single interface case corresponding to the interface information to be added according to the interface request path and the interface input parameters.
4. The method of claim 2, wherein generating the target test case from each of the single-interface cases comprises:
acquiring timestamp information of the log to be processed;
and generating the target test case based on the timestamp information of the log to be processed corresponding to each piece of interface information to be added and the single interface case corresponding to each piece of interface information to be added.
5. The method according to claim 4, wherein generating the target test case based on timestamp information of a log to be processed corresponding to each piece of interface information to be added and the single interface case corresponding to each piece of interface information to be added comprises:
and selecting a preset number of single interface cases to generate the target test case based on the timestamp information of the log to be processed corresponding to each interface information to be added and the single interface cases corresponding to each interface information to be added.
6. The method of claim 1, wherein comparing the calling interface information with existing test cases to determine interface information to be added comprises:
determining an existing interface corresponding to the existing test case according to the existing test case;
and comparing the calling interface information with the existing interface, determining an interface to be added which is not contained in the existing interface, and determining interface information to be added corresponding to the interface to be added.
7. The method of claim 1, further comprising:
acquiring an input parameter type corresponding to the interface information to be added based on the interface information to be added, wherein the input parameter type comprises necessary and unnecessary types;
and generating a reverse single-interface use case corresponding to the information of the interface to be added according to the input parameter type.
8. A test case generation apparatus, comprising:
the first acquisition module is used for acquiring the log to be processed;
the second acquisition module is used for analyzing the log to be processed and acquiring calling interface information contained in the log to be processed;
the determining module is used for comparing the calling interface information with the existing test case and determining the interface information to be added;
and the processing module is used for generating a corresponding target test case according to the information of the interface to be added.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a test case generation method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a processor; and
a memory having a computer program stored thereon;
wherein the processor is configured to implement the test case generation method of any one of claims 1-7 via execution of the computer program.
CN202011610774.8A 2020-12-30 2020-12-30 Test case generation method and device, storage medium and electronic equipment Pending CN112631929A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011610774.8A CN112631929A (en) 2020-12-30 2020-12-30 Test case generation method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011610774.8A CN112631929A (en) 2020-12-30 2020-12-30 Test case generation method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN112631929A true CN112631929A (en) 2021-04-09

Family

ID=75286663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011610774.8A Pending CN112631929A (en) 2020-12-30 2020-12-30 Test case generation method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112631929A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113849419A (en) * 2021-12-02 2021-12-28 上海燧原科技有限公司 Method, system, equipment and storage medium for generating test vector of chip

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113849419A (en) * 2021-12-02 2021-12-28 上海燧原科技有限公司 Method, system, equipment and storage medium for generating test vector of chip
CN113849419B (en) * 2021-12-02 2022-04-05 上海燧原科技有限公司 Method, system, equipment and storage medium for generating test vector of chip

Similar Documents

Publication Publication Date Title
CN107341098B (en) Software performance testing method, platform, equipment and storage medium
CN109284269B (en) Abnormal log analysis method and device, storage medium and server
CN108683562B (en) Anomaly detection positioning method and device, computer equipment and storage medium
CN108628748B (en) Automatic test management method and automatic test management system
CN110674009B (en) Application server performance monitoring method and device, storage medium and electronic equipment
CN110058920B (en) Virtual machine performance detection method and device, electronic equipment and storage medium
US20160274997A1 (en) End user monitoring to automate issue tracking
US10467590B2 (en) Business process optimization and problem resolution
CN110109824B (en) Big data autoregression test method and device, computer equipment and storage medium
CN110727581B (en) Crash positioning method and electronic equipment
CN111240955A (en) Automatic testing method and device for Http interface, storage medium and electronic device
CN110716843B (en) System fault analysis processing method and device, storage medium and electronic equipment
CN112817853A (en) Automatic test method, system and electronic equipment
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN112631929A (en) Test case generation method and device, storage medium and electronic equipment
EP3818445B1 (en) Automated control of distributed computing devices
CN112269697A (en) Equipment storage performance testing method, system and related device
CN111124805A (en) Data acquisition method, device, equipment and storage medium
CN112241362A (en) Test method, test device, server and storage medium
CN113934595A (en) Data analysis method and system, storage medium and electronic terminal
CN112988589A (en) Interface testing method, device and system
CN110362464B (en) Software analysis method and equipment
CN113656391A (en) Data detection method and device, storage medium and electronic equipment
CN111737129A (en) Service control method, service control device, computer readable medium and electronic equipment
CN117130945B (en) Test method and device

Legal Events

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