CN115309649A - Test case generation method and device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN115309649A
CN115309649A CN202210967058.8A CN202210967058A CN115309649A CN 115309649 A CN115309649 A CN 115309649A CN 202210967058 A CN202210967058 A CN 202210967058A CN 115309649 A CN115309649 A CN 115309649A
Authority
CN
China
Prior art keywords
test
test case
template
information
interface
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
CN202210967058.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 Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202210967058.8A priority Critical patent/CN115309649A/en
Publication of CN115309649A publication Critical patent/CN115309649A/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

Abstract

The embodiment of the application belongs to the field of research and development management, and relates to a test case generation method, which comprises the following steps: judging whether a use case generation request triggered by a user is received or not; if yes, responding to the case generation request, and analyzing interface information from the case generation request; acquiring an interface type corresponding to the interface information, and acquiring a specified test case template corresponding to the interface type; generating parameter input reminding information based on the specified test case template, and displaying the parameter input reminding information; receiving parameter information input by a user based on the parameter input reminding information; and generating a target test case corresponding to the interface information based on the parameter information and the specified test case template. The application also provides a test case generation device, computer equipment and a storage medium. In addition, the application also relates to a block chain technology, and the target test case can be stored in the block chain. The method and the device reduce the workload of testers, improve the generation efficiency of the test cases, and ensure the data accuracy of the test cases.

Description

Test case generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of research and development management technologies, and in particular, to a test case generation method and apparatus, a computer device, and a storage medium.
Background
The interface test is an important part in project test, and the main object of the interface test is an interface which is a test for testing interfaces among components of a system. Interface testing requires testing using test cases, which are a set of test inputs, execution conditions, and expected results tailored for a particular purpose for testing a certain program path or verifying that a certain specific requirement is met.
The test cases used for the existing interface test are generated by manual writing of testers according to different product requirements, and need to be manually maintained in a data table after writing is completed. The inventor realizes that generating the test case by adopting a manual writing mode usually consumes a great amount of human resources of testers, and the test case is low in generation efficiency and easy to make mistakes. In addition, for a plurality of interfaces with the same or similar types, the contents of the test cases are also similar, and if the test cases are rewritten every time the test is performed, the repeated labor is more likely to be caused, so that the test efficiency is further reduced.
Disclosure of Invention
An embodiment of the application aims to provide a test case generation method, a test case generation device, computer equipment and a storage medium, so as to solve the technical problems that a great amount of human resources of testers need to be consumed in the existing test case generation mode, the test case generation efficiency is low, and errors are easy to occur.
In order to solve the above technical problem, an embodiment of the present application provides a test case generation method, which adopts the following technical solutions:
judging whether a use case generation request triggered by a user is received or not; wherein the use case generation request carries interface information;
if yes, responding to the use case generation request, and analyzing the interface information from the use case generation request;
acquiring an interface type corresponding to the interface information, and acquiring a specified test case template corresponding to the interface type;
generating corresponding parameter input reminding information based on the specified test case template, and displaying the parameter input reminding information;
receiving parameter information input by the user based on the parameter input reminding information;
and generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
Further, the step of obtaining the interface type corresponding to the interface information and obtaining the specified test case template corresponding to the interface type specifically includes:
acquiring an interface identifier based on the interface information;
acquiring an interface type corresponding to the interface information based on the interface identifier;
calling a preset test case library;
and inquiring a test case template corresponding to the interface type from the test case library based on the interface type to obtain the specified test case template.
Further, the parameter information includes a test object and test parameter data corresponding to the test object; the step of generating the target test case corresponding to the interface information based on the parameter information and the specified test case template specifically includes:
copying the specified test case template to obtain a corresponding test case template copy;
acquiring a target test object matched with the test object from the test case template copy;
determining parameter data corresponding to the target test object from the test case template copy based on the target test object;
replacing the parameter data in the test case template copy based on the test parameter data to obtain a processed test case template copy;
and taking the processed test case template copy as the target test case.
Further, after the step of generating the target test case corresponding to the interface information based on the parameter information and the specified test case template, the method further includes:
judging whether an operation instruction for the target test case triggered by the user is received;
if yes, responding to the operation instruction, and executing the target test case;
obtaining a test result generated in the execution process of the target test case;
and storing the test result.
Further, after the step of obtaining the test result generated by the target test case in the execution process, the method further includes:
obtaining an expected test result corresponding to the target test case;
determining a target test report template from preset test report templates;
generating a corresponding target test report based on the expected test result, the test result and the target test report template;
and storing and displaying the target test report.
Further, the step of determining a target test report template from preset test report templates specifically includes:
displaying the test report template;
receiving a selection instruction for the test report template triggered by the user;
acquiring a specified test report template corresponding to the selection instruction;
and taking the specified test report template as the target test report template.
Further, the step of generating a corresponding target test report based on the expected test result, the test result and the target test report template specifically includes:
comparing the expected test result with the test result to obtain corresponding result difference information;
acquiring test information corresponding to the running instruction;
filling the result difference information and the test information into the test report template to obtain a filled test report template;
and taking the filled test report template as the target test report.
In order to solve the above technical problem, an embodiment of the present application further provides a test case generation apparatus, which adopts the following technical solutions:
the first judgment module is used for judging whether a use case generation request triggered by a user is received or not; wherein the use case generation request carries interface information;
the analysis module is used for responding to the use case generation request and analyzing the interface information from the use case generation request if the interface information is in the use case generation request;
the first acquisition module is used for acquiring the interface type corresponding to the interface information and acquiring a specified test case template corresponding to the interface type;
the first generation module is used for generating corresponding parameter input reminding information based on the specified test case template and displaying the parameter input reminding information;
the receiving module is used for receiving the parameter information input by the user based on the parameter input reminding information;
and the second generation module is used for generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
judging whether a use case generation request triggered by a user is received or not; wherein the use case generation request carries interface information;
if yes, responding to the use case generation request, and analyzing the interface information from the use case generation request;
acquiring an interface type corresponding to the interface information, and acquiring a specified test case template corresponding to the interface type;
generating corresponding parameter input reminding information based on the specified test case template, and displaying the parameter input reminding information;
receiving parameter information input by the user based on the parameter input reminding information;
and generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
In order to solve the foregoing technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
judging whether a use case generation request triggered by a user is received or not; wherein the use case generation request carries interface information;
if yes, responding to the use case generation request, and analyzing the interface information from the use case generation request;
acquiring an interface type corresponding to the interface information, and acquiring a specified test case template corresponding to the interface type;
generating corresponding parameter input reminding information based on the specified test case template, and displaying the parameter input reminding information;
receiving parameter information input by the user based on the parameter input reminding information;
and generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
when a case generation request triggered by a user is received, the case generation request is responded, interface information is analyzed from the case generation request, then an interface type corresponding to the interface information is obtained, a specified test case template corresponding to the interface type is obtained, corresponding parameter input reminding information is generated based on the specified test case template, the parameter input reminding information is displayed, parameter information input by the user based on the parameter input reminding information is subsequently received, and finally a target test case corresponding to the interface information is generated based on the parameter information and the specified test case template. According to the method and the device, after a user-triggered case generation request carrying interface information is received, a corresponding test case can be generated rapidly and intelligently based on the interface information and parameter information input by the user, a tester does not need to write the test case manually, the user only needs to input related parameters, the workload of development and the tester is greatly reduced, the generation efficiency of the test case is improved, the data accuracy of the test case is guaranteed, and the generation difficulty of the test case is also reduced.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a test case generation method according to the present application;
FIG. 3 is a schematic structural diagram of an embodiment of a test case generation apparatus according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein may be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is the medium used to provide communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, an e-book reader, an MP3 player (Moving Picture experts Group Audio Layer III, motion Picture experts compression standard Audio Layer 3), an MP4 player (Moving Picture experts Group Audio Layer IV, motion Picture experts compression standard Audio Layer 4), a laptop portable computer, a desktop computer, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that the test case generation method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the test case generation apparatus is generally disposed in the server/terminal device.
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.
With continued reference to FIG. 2, a flowchart of one embodiment of a test case generation method according to the present application is shown. The test case generation method comprises the following steps:
step S201, judging whether a use case generation request triggered by a user is received; wherein the use case generation request carries interface information.
In this embodiment, the electronic device (for example, the server/terminal device shown in fig. 1) on which the test case generation method operates may obtain the case generation request in a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G/5G connection, a WiFi connection, a bluetooth connection, a WiAX connection, a Zigbee connection, an UWB (ultra wideband) connection, and other wireless connection means now known or developed in the future. The interface information is information which is input by a user and used for requesting to generate a required test case, and the interface information is used for identifying function information which can be realized by the test case generated by the user request.
And S202, if yes, responding to the use case generation request, and analyzing the interface information from the use case generation request.
In this embodiment, the interface information may be obtained by analyzing the use case generation request. The interface information may include an interface identification.
Step S203, obtaining the interface type corresponding to the interface information, and obtaining the specified test case template corresponding to the interface type.
In this embodiment, the electronic device may call a preset test case library for managing the test case according to the interface type corresponding to the interface identifier included in the interface information, and since the interface information is used to identify the function information that can be realized by the test case requested to be generated by the case generation request, the electronic device may obtain, from the test case library, the test case template matched with the function information that can be realized by the test case according to the function information that can be realized by the test case requested to be generated.
And S204, generating corresponding parameter input reminding information based on the specified test case template, and displaying the parameter input reminding information.
In this embodiment, after the specified test case template is determined, the parameter input prompting information may be extracted from the obtained specified test case template, and the extracted parameter input prompting information is displayed. The parameter input reminding information comprises input parameter reminding information and output parameter reminding information, wherein the input parameter reminding information is used for indicating a tester to fill in input parameters, and the output parameter reminding information is used for indicating the tester to fill in expected output parameters.
Step S205, receiving parameter information input by the user based on the parameter input reminding information.
In this embodiment, the parameter information may include information such as a library name corresponding to the test table, a table name corresponding to the test table, and a version number.
And step S206, generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
In this embodiment, after obtaining the parameter information, the parameter information may be updated into the specified test case template to create the target test case composed of the parameter information.
According to the method and the device, after a case generation request triggered by a user is received, the case generation request is responded, interface information is analyzed from the case generation request, then an interface type corresponding to the interface information is obtained, a specified test case template corresponding to the interface type is obtained, corresponding parameter input reminding information is generated based on the specified test case template, the parameter input reminding information is displayed, parameter information input by the user based on the parameter input reminding information is subsequently received, and finally a target test case corresponding to the interface information is generated based on the parameter information and the specified test case template. According to the method and the device, after a case generation request which is triggered by a user and carries interface information is received, a corresponding test case can be generated quickly and intelligently based on the interface information and parameter information input by the user, the test case does not need to be compiled manually by testers, the user only needs to input related parameters, the workload of development and testers is greatly reduced, the generation efficiency of the test case is improved, the data accuracy of the test case is guaranteed, and the generation difficulty of the test case is also reduced.
In some optional implementations, step S203 includes the following steps:
and acquiring an interface identifier based on the interface information.
In this embodiment, the interface information further includes an interface identifier, and the electronic device may determine an interface type to which the API that needs to be called belongs according to the interface identifier included in the interface information, and allocate a name of the automation test case according to the determined interface type and the function information that the automation case can implement
And acquiring an interface type corresponding to the interface information based on the interface identifier.
In this embodiment, the interface types may include an interface of a query type, such as a get type, an interface of an add type, such as a post type, and an interface of a modify type, such as a put type, and an interface of a delete type, such as a delete type. Wherein, the same interface type can correspond to a plurality of interface identifications.
And calling a preset test case library.
In this embodiment, the test case library is a database that is pre-constructed according to actual service usage requirements and is used for managing test cases, and the test case library stores a plurality of interface types and test case templates corresponding to the interface types one to one.
And inquiring a test case template corresponding to the interface type from the test case library based on the interface type to obtain the specified test case template.
According to the method and the device, the interface type is obtained based on the interface identification in the interface information, and then the specified test case template corresponding to the interface type can be inquired from the preset test case library based on the obtained interface type, so that the target test case can be generated quickly and accurately based on the specified test case template and the parameter information, that is, a user can generate the required target test case according to the input related parameters, the technical threshold of automatic test case design is reduced, and the generation efficiency of the automatic test case is improved.
In some optional implementations of this embodiment, the parameter information includes a test object and test parameter data corresponding to the test object; step S206 includes the steps of:
and copying the specified test case template to obtain a corresponding test case template copy.
In this embodiment, the specified test case template is a test case template corresponding to an interface of which the interface type corresponding to the interface information belongs to the same type. The data format of the test object contained in the specified test case is the same as that of the test object of the target test case corresponding to the interface information, and only the parameter data corresponding to the test object in the specified test case template is different from that of the target test case, so that the parameter data of some test objects can be adaptively replaced on the specified test case template based on the parameter information input by the user, and the required target test case can be generated.
And acquiring a target test object matched with the test object from the test case template copy.
In this embodiment, the target test object matching the test object refers to the same test object as the test object in the test case template copy.
And determining parameter data corresponding to the target test object from the test case template copy based on the target test object.
And replacing the parameter data in the test case template copy based on the test parameter data to obtain the processed test case template copy.
And taking the processed test case template copy as the target test case.
According to the method and the device, after the test case template copy is obtained based on the specified test case template, the test parameter data corresponding to the test object contained in the parameter information input by the user can be intelligently extracted from the test case template copy, and then the test parameter data is used for carrying out replacement processing on the parameter data corresponding to the test object in the test case template copy so as to generate the required target test case. The required target test case can be intelligently and quickly generated by directly copying and correspondingly replacing the parameter data in the specified test case template copy without the need of a tester to rewrite the test case, so that the generation efficiency of the target test case is improved, and the generation difficulty of the target test case is also reduced.
In some optional implementations, after step S206, the electronic device may further perform the following steps:
and judging whether an operation instruction for the target test case triggered by the user is received.
In this embodiment, the operation instruction is an instruction triggered by a user and used for testing the target test case.
And if so, responding to the operation instruction and executing the target test case.
And acquiring a test result generated in the execution process of the target test case.
In this embodiment, the test result is test result data of each parameter expected to be output in the target test case.
And storing the test result.
In this embodiment, the storage manner of the test result is not specifically limited, and may be determined according to actual use requirements, for example, the test result may be stored locally, or may be stored in a block chain, and the like.
After the target test case is generated, the user can automatically operate the target test case and generate a corresponding test result by triggering the operation instruction of the target test case, so that the workload of manual testing is reduced, the processing efficiency of automatic testing is improved, and the test experience of the user is improved.
In some optional implementation manners, after the step of obtaining the test result generated in the execution process of the target test case, the electronic device may further perform the following steps:
and obtaining an expected test result corresponding to the target test case.
In the present embodiment, the expected test result is used to indicate the parameter result data of the expected output filled by the tester.
And determining a target test report template from the preset test report templates.
In this embodiment, the above-mentioned specific implementation process of determining the target test report template from the preset test report templates will be described in further detail in the following specific embodiments, which are not set forth herein too much.
And generating a corresponding target test report based on the expected test result, the test result and the target test report template.
In this embodiment, an association relationship among the name of the target test case, the expected test result of the target test case, and the test result of the target test case may be established to generate a target test report of the target test case, where the target test report includes the name of the target test case, the expected test result, and the test result.
And storing and displaying the target test report.
In this embodiment, the storage manner of the target test report is not specifically limited, and may be determined according to actual usage requirements, for example, the target test report may be stored locally, or may be stored in a block chain, and the like.
According to the method and the device, after the test result generated in the execution process of the target test case is obtained, the expected test result of the target test case can be further obtained, the target test report template is determined from the preset test report template, and then the target test report corresponding to the target test case is generated and displayed based on the test result, the expected test result and the target test report template, so that a tester can know the related test data of the target test case through the generated target test report, and the test experience of the tester is improved.
In some optional implementations of this embodiment, the determining the target test report template from the preset test report templates includes the following steps:
and displaying the test report template.
In this embodiment, the test report template refers to a report structure and data to be filled of a test report, that is, a corresponding test report may be displayed in a standardized manner according to the test report template, and the electronic device may correspondingly fill corresponding data according to a report structure included in the test report template according to the selected test report template, for example, the report structure in the test report may include a test case to be executed, may include an execution condition of the test case to be executed, and may further correspondingly fill a specific test case and an execution result of the specific test case according to the report structure. Additionally, presenting the test report template may refer to presenting the test report template at the current interface.
Receiving a selection instruction triggered by the user for the test report template.
In this embodiment, the selection instruction is a command triggered by a user and used for selecting a corresponding test report display template, and the selection instruction may carry a template identifier of a test report template to be selected, for example, a template number, a template name, and the like of the test report template to be selected. Specifically, different test report templates are displayed on a current display interface of the electronic device, a user selects a test report template required to generate a test report, a corresponding rotation instruction is generated according to the test report template selected by the user, the selection instruction carries a template identifier of the corresponding test report template, and then when the electronic device receives the selection instruction, subsequent operation is performed according to the selection instruction.
And acquiring a specified test report template corresponding to the selection instruction.
In this embodiment, after a selection instruction for a test report template triggered by a user is received, a template identifier carried in the selection instruction is extracted, a pre-stored test report template is queried according to the template identifier, and when a test report template corresponding to the template identifier is queried, a test report display template is obtained. The template identifier refers to an identifier corresponding to the test report template, the template identifier may uniquely indicate the test report template, and the template identifier may be a template name, a template number, and the like of the test report template.
And taking the specified test report template as the target test report template.
According to the method and the device, the corresponding target test report template is selected according to the selection instruction of the test report template triggered by the user, so that when the test result generated by the target test case in the execution process is acquired subsequently, the corresponding target test report can be generated according to the test result and the acquired test report template and the expected test result of the target test case, namely the target test report can be correspondingly displayed according to the selected test report template, and therefore the target test report is displayed in a mode that the test is not passed or not passed through singly, the application is flexible, the applicability is strong, and the processing intelligence for generating the test report is improved.
In some optional implementations of this embodiment, the generating a corresponding target test report based on the expected test result, the test result, and the target test report template includes:
and comparing the expected test result with the test result to obtain corresponding result difference information.
In this embodiment, the expected test result and the test result are compared to determine the difference information between the expected test result and the test result, so as to obtain the result difference information.
And acquiring test information corresponding to the operation instruction.
In this embodiment, the test information may include a test start time and a test end time.
And filling the result difference information and the test information into the test report template to obtain the filled test report template.
And taking the filled test report template as the target test report.
In the process of testing by using the target test case, the test result returned after the test is finished can be directly compared with the expected test result, and the corresponding target test report is generated based on the test information corresponding to the operation instruction, so that the feedback result returned by the interface to be tested does not need to be manually analyzed and the test report is written, and the generation efficiency and the accuracy of the test report are improved.
It is emphasized that, in order to further ensure the privacy and security of the target test case, the target test case may also be stored in a node of a block chain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a test case generating apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 3, the test case generating apparatus 300 according to this embodiment includes: a first determining module 301, a parsing module 302, a first obtaining module 303, a first generating module 304, a receiving module 305, and a second generating module 306. Wherein:
a first judging module 301, configured to judge whether a use case generation request triggered by a user is received; wherein the use case generation request carries interface information;
the analysis module 302 is configured to respond to the use case generation request and analyze the interface information from the use case generation request if the interface information is received;
a first obtaining module 303, configured to obtain an interface type corresponding to the interface information, and obtain a specified test case template corresponding to the interface type;
a first generating module 304, configured to generate corresponding parameter input prompting information based on the specified test case template, and display the parameter input prompting information;
a receiving module 305, configured to receive parameter information input by the user based on the parameter input reminding information;
a second generating module 306, configured to generate a target test case corresponding to the interface information based on the parameter information and the specified test case template.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the first obtaining module 303 includes:
the first obtaining submodule is used for obtaining an interface identifier based on the interface information;
the second obtaining submodule is used for obtaining an interface type corresponding to the interface information based on the interface identification;
the calling submodule is used for calling a preset test case library;
and the query submodule is used for querying the test case template corresponding to the interface type from the test case library based on the interface type to obtain the specified test case template.
In this embodiment, the operations that the modules or units are respectively used to execute correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementation manners of this embodiment, the parameter information includes a test object and test parameter data corresponding to the test object; the second generation module 306 includes:
the first processing submodule is used for copying the specified test case template to obtain a corresponding test case template copy;
the third obtaining sub-module is used for obtaining a target test object matched with the test object from the test case template copy;
the first determining submodule is used for determining parameter data corresponding to the target test object from the test case template copy based on the target test object;
the second processing submodule is used for carrying out replacement processing on the parameter data in the test case template copy based on the test parameter data to obtain a processed test case template copy;
and the second determining submodule is used for taking the processed test case template copy as the target test case.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementation manners of this embodiment, the test case generating device further includes:
the second judgment module is used for judging whether an operation instruction which is triggered by the user and is used for the target test case is received or not;
the execution module is used for responding to the operation instruction and executing the target test case if the target test case is in the set state;
the second acquisition module is used for acquiring a test result generated in the execution process of the target test case;
and the first storage module is used for storing the test result.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the test case generating device further includes:
a third obtaining module, configured to obtain an expected test result corresponding to the target test case;
the determining module is used for determining a target test report template from preset test report templates;
a third generating module, configured to generate a corresponding target test report based on the expected test result, the test result, and the target test report template;
and the second storage module is used for storing and displaying the target test report.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the determining module includes:
the display sub-module is used for displaying the test report template;
the receiving submodule is used for receiving a selection instruction of the test report template triggered by the user;
the fourth acquisition sub-module is used for acquiring the specified test report template corresponding to the selection instruction;
and the third determining sub-module is used for taking the specified test report template as the target test report template.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the third generating module includes:
the third processing submodule is used for comparing the expected test result with the test result to obtain corresponding result difference information;
a fifth obtaining submodule, configured to obtain test information corresponding to the operation instruction;
the filling sub-module is used for filling the result difference information and the test information into the test report template to obtain a filled test report template;
and the fourth determining submodule is used for taking the filled test report template as the target test report.
In this embodiment, the operations that the modules or units are respectively used for executing correspond to the steps of the test case generation method in the foregoing embodiment one to one, and are not described herein again.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, and a network interface 43, which are communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including flash memory, hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disks, optical disks, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as computer readable instructions of a test case generation method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute the computer readable instructions stored in the memory 41 or process data, for example, execute the computer readable instructions of the test case generation method.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
in the embodiment of the application, after a case generation request triggered by a user is received, the case generation request is responded, interface information is analyzed from the case generation request, then an interface type corresponding to the interface information is obtained, a specified test case template corresponding to the interface type is obtained, corresponding parameter input reminding information is generated based on the specified test case template, the parameter input reminding information is displayed, parameter information input by the user based on the parameter input reminding information is subsequently received, and finally a target test case corresponding to the interface information is generated based on the parameter information and the specified test case template. According to the method and the device, after a user-triggered case generation request carrying interface information is received, a corresponding test case can be generated rapidly and intelligently based on the interface information and parameter information input by the user, a tester does not need to write the test case manually, the user only needs to input related parameters, the workload of development and the tester is greatly reduced, the generation efficiency of the test case is improved, the data accuracy of the test case is guaranteed, and the generation difficulty of the test case is also reduced.
The present application further provides another embodiment, which is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, which can be executed by at least one processor, so as to cause the at least one processor to execute the steps of the test case generation method as described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
in the embodiment of the application, after a case generation request triggered by a user is received, the case generation request is responded, interface information is analyzed from the case generation request, then an interface type corresponding to the interface information is obtained, a specified test case template corresponding to the interface type is obtained, corresponding parameter input reminding information is generated based on the specified test case template, the parameter input reminding information is displayed, parameter information input by the user based on the parameter input reminding information is subsequently received, and finally a target test case corresponding to the interface information is generated based on the parameter information and the specified test case template. According to the method and the device, after a user-triggered case generation request carrying interface information is received, a corresponding test case can be generated rapidly and intelligently based on the interface information and parameter information input by the user, a tester does not need to write the test case manually, the user only needs to input related parameters, the workload of development and the tester is greatly reduced, the generation efficiency of the test case is improved, the data accuracy of the test case is guaranteed, and the generation difficulty of the test case is also reduced.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and the embodiments are provided so that this disclosure will be thorough and complete. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields, and all the equivalent structures are within the protection scope of the present application.

Claims (10)

1. A test case generation method is characterized by comprising the following steps:
judging whether a use case generation request triggered by a user is received or not; the use case generation request carries interface information;
if yes, responding to the use case generation request, and analyzing the interface information from the use case generation request;
acquiring an interface type corresponding to the interface information, and acquiring a specified test case template corresponding to the interface type;
generating corresponding parameter input reminding information based on the specified test case template, and displaying the parameter input reminding information;
receiving parameter information input by the user based on the parameter input reminding information;
and generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
2. The method for generating the test case according to claim 1, wherein the step of obtaining the interface type corresponding to the interface information and obtaining the specified test case template corresponding to the interface type specifically includes:
acquiring an interface identifier based on the interface information;
acquiring an interface type corresponding to the interface information based on the interface identifier;
calling a preset test case library;
and inquiring a test case template corresponding to the interface type from the test case library based on the interface type to obtain the specified test case template.
3. The method for generating test cases according to claim 1, wherein the parameter information includes a test object and test parameter data corresponding to the test object; the step of generating the target test case corresponding to the interface information based on the parameter information and the specified test case template specifically includes:
copying the specified test case template to obtain a corresponding test case template copy;
acquiring a target test object matched with the test object from the test case template copy;
determining parameter data corresponding to the target test object from the test case template copy based on the target test object;
replacing the parameter data in the test case template copy based on the test parameter data to obtain a processed test case template copy;
and taking the processed test case template copy as the target test case.
4. The method according to claim 1, further comprising, after the step of generating the target test case corresponding to the interface information based on the parameter information and the specified test case template:
judging whether an operation instruction for the target test case triggered by the user is received;
if yes, responding to the operation instruction, and executing the target test case;
obtaining a test result generated in the execution process of the target test case;
and storing the test result.
5. The method for generating test cases according to claim 4, after the step of obtaining the test results generated by the target test cases during the execution process, further comprising:
obtaining an expected test result corresponding to the target test case;
determining a target test report template from preset test report templates;
generating a corresponding target test report based on the expected test result, the test result and the target test report template;
and storing and displaying the target test report.
6. The method for generating test cases according to claim 5, wherein the step of determining the target test report template from the preset test report templates specifically includes:
displaying the test report template;
receiving a selection instruction triggered by the user for the test report template;
acquiring a specified test report template corresponding to the selection instruction;
and taking the specified test report template as the target test report template.
7. The method for generating test cases according to claim 5, wherein the step of generating corresponding target test reports based on the expected test results, the test results, and the target test report template specifically includes:
comparing the expected test result with the test result to obtain corresponding result difference information;
acquiring test information corresponding to the running instruction;
filling the result difference information and the test information into the test report template to obtain a filled test report template;
and taking the filled test report template as the target test report.
8. A test case generation apparatus, comprising:
the first judgment module is used for judging whether a use case generation request triggered by a user is received or not; wherein the use case generation request carries interface information;
the analysis module is used for responding to the use case generation request and analyzing the interface information from the use case generation request if the interface information is in the use case generation request;
the first acquisition module is used for acquiring the interface type corresponding to the interface information and acquiring a specified test case template corresponding to the interface type;
the first generation module is used for generating corresponding parameter input reminding information based on the specified test case template and displaying the parameter input reminding information;
the receiving module is used for receiving parameter information input by the user based on the parameter input reminding information;
and the second generation module is used for generating a target test case corresponding to the interface information based on the parameter information and the specified test case template.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the test case generation method of any of claims 1 to 7.
10. A computer-readable storage medium having computer-readable instructions stored thereon which, when executed by a processor, implement the steps of the test case generation method of any of claims 1 to 7.
CN202210967058.8A 2022-08-11 2022-08-11 Test case generation method and device, computer equipment and storage medium Pending CN115309649A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210967058.8A CN115309649A (en) 2022-08-11 2022-08-11 Test case generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210967058.8A CN115309649A (en) 2022-08-11 2022-08-11 Test case generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115309649A true CN115309649A (en) 2022-11-08

Family

ID=83861927

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210967058.8A Pending CN115309649A (en) 2022-08-11 2022-08-11 Test case generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115309649A (en)

Similar Documents

Publication Publication Date Title
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN112631911A (en) Automatic testing method and device, computer equipment and storage medium
CN112835808A (en) Interface testing method and device, computer equipment and storage medium
CN115712422A (en) Form page generation method and device, computer equipment and storage medium
CN115757075A (en) Task abnormity detection method and device, computer equipment and storage medium
CN115309649A (en) Test case generation method and device, computer equipment and storage medium
CN115328764A (en) Test code optimization method based on automatic test and related equipment thereof
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN114626352A (en) Report automatic generation method and device, computer equipment and storage medium
CN112069807A (en) Text data theme extraction method and device, computer equipment and storage medium
CN115080045A (en) Link generation method and device, computer equipment and storage medium
CN117421233A (en) Annotation-based code generation method, annotation-based code generation device, computer equipment and storage medium
CN115731057A (en) Information generation method and device, computer equipment and storage medium
CN115756640A (en) Method for automatically generating job scheduling configuration and related equipment thereof
CN115033486A (en) Processing method for error reporting of test case and related equipment thereof
CN115757889A (en) Data item processing method and device, computer equipment and storage medium
CN117251502A (en) Data billboard generation method and device, computer equipment and storage medium
CN116738084A (en) Buried data processing method, buried data processing device, computer equipment and storage medium
CN113806372A (en) New data information construction method and device, computer equipment and storage medium
CN117667653A (en) Recommendation method and device of experiment template, electronic equipment, storage medium and product
CN115809241A (en) Data storage method and device, computer equipment and storage medium
CN115828018A (en) Electronic magazine interface material replacing method and related equipment thereof
CN115578050A (en) Approval progress identification method and device, computer equipment and storage medium
CN114218191A (en) System function migration method and device, computer equipment and storage medium
CN116820443A (en) Data analysis method, device, computer equipment and storage medium

Legal Events

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