CN114416597A - Test case record generation method and device - Google Patents

Test case record generation method and device Download PDF

Info

Publication number
CN114416597A
CN114416597A CN202210224740.8A CN202210224740A CN114416597A CN 114416597 A CN114416597 A CN 114416597A CN 202210224740 A CN202210224740 A CN 202210224740A CN 114416597 A CN114416597 A CN 114416597A
Authority
CN
China
Prior art keywords
test
interface
test case
grouping
generating
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
CN202210224740.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.)
Jingdong City Beijing Digital Technology Co Ltd
Original Assignee
Jingdong City Beijing Digital Technology 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 Jingdong City Beijing Digital Technology Co Ltd filed Critical Jingdong City Beijing Digital Technology Co Ltd
Priority to CN202210224740.8A priority Critical patent/CN114416597A/en
Publication of CN114416597A publication Critical patent/CN114416597A/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/3688Test management for test execution, e.g. scheduling of test suites
    • 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 invention discloses a method and a device for generating a test case record, and relates to the technical field of computers. One embodiment of the method comprises: acquiring test message data for service test; grouping the test message data to obtain at least one interface group; determining grouping parameter values of the interface groups, and determining the upstream and downstream relations of the interface groups according to the grouping parameter values; for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups. The embodiment can automatically generate the test case record which can be used for generating the test platform.

Description

Test case record generation method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating a test case record.
Background
The automated test platform can significantly improve the efficiency of the test process. Before the test platform is used for testing, a tester needs to compile test cases on the test platform according to the requirements of service tests. The compiling of the test cases consumes a large amount of labor cost, and becomes a bottleneck of an automatic test platform in practical popularization and application.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for generating a test case record, which can automatically generate a test case record, where the test case record can be used to generate a test case of a test platform, so that a manual writing of the test case in the test platform is not required, and a labor cost required for using the test platform is reduced.
In a first aspect, an embodiment of the present invention provides a method for generating a test case record, including:
acquiring test message data for service test;
grouping the test message data to obtain at least one interface group;
determining grouping parameter values of the interface groups, and determining the upstream and downstream relations of the interface groups according to the grouping parameter values;
for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups.
Optionally, the grouping the test packet data to obtain at least one interface packet includes:
analyzing the test message data to generate plaintext message data;
obtaining message information of the test message data from the plaintext message data, wherein the message information includes at least one of the following: time stamp, request header content and link address;
and grouping the test message data according to the message content to obtain at least one interface grouping.
Optionally, the test case record includes a plurality of case keywords;
the generating of the test case record corresponding to the interface packet includes:
determining a mapping relation between the target parameters and the use case keywords;
for each case keyword in the test case record: determining current parameters corresponding to key fields of the current use case from a plurality of target parameters of the interface grouping according to the mapping relation; and determining the value of the current parameter as the value of the current use case keyword.
Optionally, before determining the mapping relationship between the target parameter and the use case keyword, the method further includes:
receiving a matching instruction input by a user, wherein the matching instruction is used for determining case keywords corresponding to each target parameter;
and generating a mapping relation between the target parameters and the use case keywords according to the matching instruction.
Optionally, the generating a test case record corresponding to the interface packet includes:
determining a target execution sequence of the test case record according to the upstream and downstream relation of the interface group; the execution sequence of the test case records corresponding to the upstream packet of the interface packet is located before the target execution sequence, and the execution sequence of the test case records corresponding to the downstream packet of the interface packet is located after the target execution sequence.
Optionally, before generating the test case record corresponding to the interface packet, the method further includes:
generating interface request data according to a plurality of target parameter values of the interface grouping;
sending the interface request data, and receiving interface return data returned by the interface request data;
determining whether the interface request data meet preset conditions or not according to the interface return data;
and under the condition that the interface request data meet preset conditions, executing the step of generating the test case record corresponding to the interface grouping.
Optionally, after generating the test case record corresponding to the interface packet, the method further includes:
displaying the test case record, and receiving the editing operation of a user aiming at the test case record;
processing the test case record according to the editing operation;
and importing the processed test case record into a test platform.
In a second aspect, an embodiment of the present invention provides a device for generating a test case record, where the device is applied to a client, and includes:
the data acquisition module is used for acquiring test message data for service test;
the grouping module is used for grouping the test message data to obtain at least one interface grouping;
the relation determining module is used for determining grouping parameter values of the interface groups and determining the upstream and downstream relation of the interface groups according to the grouping parameter values;
a record generation module to, for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
In a fourth aspect, an embodiment of the present invention provides a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method of any one of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: according to the test message data for carrying out the service test, the test case record can be automatically generated. The test case records can be used for generating the test cases of the test platform, so that the test cases in the test platform do not need to be written manually, and the labor cost for using the test platform is reduced.
In addition, the execution sequence of the test case record is determined according to the upstream and downstream relation of each interface group in the test message data. Therefore, each test case generated according to the interface grouping in the test platform can be tested in a correct execution sequence.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of an exemplary application scenario in which embodiments of the present invention may be applied;
FIG. 2 is a schematic diagram illustrating a flow of a method for generating a test case record according to an embodiment of the present invention;
FIG. 3 is a diagram of a record test case record table according to an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating a flow of another test case record generation method according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating an interface test case transformation tool interaction process according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a device for generating a test case record according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of an exemplary application scenario in which embodiments of the present invention may be applied. As shown in fig. 1, a system architecture 100 may include a test device 101, a network 102, and a server 103. The network 102 is used to provide a medium for a communication link between the test equipment 101 and the server 103. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The tester conducts a business test on the system or service deployed in the server 105 through the test apparatus 101. The test equipment 101 acquires test message data for service test, groups the test message data, and determines the upstream and downstream relationship of each interface group; generating test case records that can be used to generate test platforms. The execution order of the test case records is determined by the upstream and downstream relationship of the interface packets. The test equipment 101 may be a cell phone, server, notebook, tablet, laptop, etc.
It should be noted that the method for generating the test case record provided by the embodiment of the present invention is generally executed by the test equipment 101, and accordingly, the device for generating the test case record is generally disposed in the test equipment 101.
It should be noted that the method or apparatus for generating a test case record provided in the embodiment of the present invention may also be applied to a terminal device or a server other than the test device 101, and the terminal device or the server may monitor and obtain the message data received and sent by the test device 101.
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.
Fig. 2 is a schematic diagram of a flow of a method for generating a test case record according to an embodiment of the present invention. As shown in fig. 2, the method includes:
step 201: and acquiring test message data for service test.
The tester conducts business test on front-end application or interface service such as network or app through the test equipment. The terminal equipment or the server deployed in the scheme of the embodiment of the invention can monitor and acquire the message data transmitted and received on the test equipment. The test message data is related message data sent by a tester for service test.
Step 202: and grouping the test message data to obtain at least one interface grouping.
Message data is a data stream for transmission over a network and is not directly readable. For example, the http message is a data stream based on the tcp protocol, and cannot be directly read. Therefore, it is necessary to convert the test message data into the message data, that is, to convert the data stream into a character string and then perform subsequent processing.
The test message data comprises a plurality of test request messages, and the test message data can be grouped in a plurality of modes. The link address requested by each test request message can be obtained, and the grouping operation is carried out on the test message data according to the requested link address. The link addresses of the requests are different, and the interface groups corresponding to the test request messages are also different. Each test request message may also be assigned to a different interface packet.
In one embodiment of the present invention, grouping test packet data to obtain at least one interface packet includes: analyzing the test message data to generate plaintext message data; acquiring message information of test message data from plaintext message data, wherein the message information comprises at least one of the following: time stamp, request header content and link address; and grouping the test message data according to the message content to obtain at least one interface grouping. And performing interface grouping on the requests in the data according to the link addresses by analyzing the association relation of the data such as the time marks, the request header contents and the like of each test request message.
Step 203: and determining grouping parameter values of the interface groups, and determining the upstream and downstream relations of the interface groups according to the grouping parameter values.
When a service person performs a service test, the service person needs to sequentially send each test message according to a preset execution sequence. For example, for a login function, a service person may need to send in sequence: obtaining a message of logging in the short message, verifying the message of logging in the short message and verifying whether the user logs in normally. If the sending sequence of the three messages is disordered, the test work may not be completed normally.
The upstream and downstream relationship characterizes the sending sequence of the test packets of each interface packet. For example, the first interface packet is an upstream packet of the second interface packet, and the third interface packet is a downstream packet of the second interface packet, so that when a tester performs a service test, it is necessary to first send a test packet in the first interface packet, then send a test packet in the second interface packet, and finally send a test packet in the third interface packet.
The packet parameter is a parameter related to the upstream and downstream relationship of the interface packet. The grouping parameter value is a value corresponding to the grouping parameter. The grouping parameters can be set according to actual requirements. These grouping parameter values have an order of context correlation by which the upstream and downstream relationship of the interface grouping can be determined. For example, the packet parameters may be the requestId of the response part of the message and the requestId of the header part. The response part of the downstream interface has the same requestId as the header part of the upstream interface. The upstream and downstream relations between the interface groups can be determined through the relations.
Step 204: for each interface packet: generating a test case record corresponding to the interface grouping; and the test case record is used for generating the test case in the test platform.
The test case record is composed of a plurality of case keywords. The case keywords can be set according to the fields in the test platform or the actual requirements. The use case keywords may include: link address, port number, access path, header, body, etc. The test cases in the test platform can be generated through the test case records without manually compiling the test cases.
The test case records have an execution order that is determined by the upstream and downstream relationship of the interface packets. The execution sequence of the test case records corresponding to the upstream packet of the interface packet is positioned before the target execution sequence, and the execution sequence of the test case records corresponding to the downstream packet of the interface packet is positioned after the target execution sequence. Therefore, the test cases generated in the test platform according to the test case records can be ensured to complete the test in a correct execution sequence.
Test case records may be stored in excel, csv, txt, and various types of databases. Fig. 3 is a schematic diagram of a table for recording test case records according to an embodiment of the present invention. As shown in FIG. 3, each test case record may include: link address, port number, access path, header, body, etc. The test case records are stored in the excel file, and the excel file can be directly imported into the test platform so as to generate the test case corresponding to the excel file in the test platform.
In the embodiment of the invention, the test case record can be automatically generated according to the test message data for carrying out the service test. The test case record can be used for generating the test case of the test platform, so that the test case in the test platform does not need to be written manually, and the labor cost required by using the test platform is reduced.
In addition, the execution sequence of the test case record is determined according to the upstream and downstream relation of each interface group in the test message data. And determining the execution sequence of each test case in the test platform according to the execution sequence recorded by the test cases. Therefore, each test case in the test platform is ensured to be tested in a correct execution sequence.
Fig. 4 is a schematic diagram of a flow of another test case record generation method according to an embodiment of the present invention. As shown in fig. 4, the method includes:
step 401: and acquiring test message data for service test.
Step 402: and grouping the test message data to obtain at least one interface grouping.
Step 403: and determining grouping parameter values of the interface groups, and determining the upstream and downstream relations of the interface groups according to the grouping parameter values.
Step 404: and determining the mapping relation between the target parameters and the use case keywords.
The target parameter is a field which can extract a value from the test message data. The target parameters may include: link address, port number, access path, header, body, etc. The case keywords are fields related to the test cases in the test platform. The use case keywords may include: protocol type, request mode, port number, access path, header, body, response, etc.
The mapping relation is used for determining the corresponding relation between the target parameters and the use case keywords. For example, the target parameter header corresponds to the use case keyword parameter header.
In an embodiment of the present invention, before determining the mapping relationship between the target parameter and the use case keyword, the method further includes: receiving a matching instruction input by a user, wherein the matching instruction is used for determining case keywords corresponding to each target parameter; and generating a mapping relation between the target parameters and the use case keywords according to the matching instruction. The keywords involved in the test cases in each test platform are different. The target parameters are matched with the case keywords manually by a user, so that the finally generated test case record contains correct data and can be used by a test platform.
Step 405: for each case keyword in the test case record: determining current parameters corresponding to the key fields of the current use case from a plurality of target parameters of the interface grouping according to the mapping relation; and determining the value of the current parameter as the value of the current use case keyword.
Step 406: and determining the target execution sequence of the test case records according to the upstream and downstream relation of the interface groups.
The test case records have an execution order that is determined by the upstream and downstream relationship of the interface packets. The execution sequence of the test case records corresponding to the upstream packet of the interface packet is positioned before the target execution sequence, and the execution sequence of the test case records corresponding to the downstream packet of the interface packet is positioned after the target execution sequence. Therefore, the test cases generated in the test platform according to the test case records can be ensured to complete the test in a correct execution sequence.
In the embodiment of the invention, the value of each keyword in the test case record is determined by using the mapping relation between the target parameter and the case keyword. And determining the target execution sequence of the test case records according to the upstream and downstream relation of the interface groups. The test cases generated in the test platform according to the test case records are ensured to be capable of sending test messages with correct contents in a preset sequence to complete related tests.
In an embodiment of the present invention, before generating the test case record corresponding to the interface packet, the method further includes: generating interface request data according to a plurality of target parameter values of the interface grouping; sending interface request data and receiving interface return data returned by the interface request data; determining whether the interface request data meets a preset condition or not according to the interface return data; and under the condition that the interface request data meet the preset conditions, executing the step of generating a test case record corresponding to the interface grouping.
The preset conditions can be set according to specific requirements. The preset conditions may include: whether the interface request data is sent successfully or not, whether the interface return data is received successfully or not, whether a status code in the interface request data is 200 or not, whether the interface return data contains a preset field value or not and the like.
Before generating a test case record corresponding to the interface grouping, generating and sending interface request data through the extracted multiple target parameter values. And under the condition that the interface request data meet the preset conditions, executing the step of generating the test case record corresponding to the interface group so as to ensure that the generated test case record contains correct content and has a preset test effect.
In an embodiment of the present invention, after generating the test case record corresponding to the interface packet, the method further includes: displaying the test case records, and receiving the editing operation of a user aiming at the test case records; processing the test case record according to the editing operation; and importing the processed test case record into a test platform.
Due to various factors, various errors are inevitable in the generated test case records. And after generating the test case record corresponding to the interface group, displaying the test case record and providing an editing function for a user. And the user can further ensure the correctness of the test case generated in the test platform by editing the generated test case record.
The embodiment of the invention also provides an interface test case conversion tool. FIG. 5 is a diagram illustrating an interface test case transformation tool interaction process according to an embodiment of the present invention. As shown in fig. 5, when a tester performs a manual test, the tool provided in the embodiment of the present invention can obtain an interface test behavior generated in a test process; based on the interface test behavior, performing operations such as protocol analysis, data analysis, interactive analysis and the like; and generating a test case record, and importing the test case record into a test platform. By utilizing the conversion tool disclosed by the embodiment of the invention, a user can automatically generate a test case in a test platform through the following steps:
step S01: the user exports an automation test case template from the automation platform.
Step S02: the user configures the keywords of the test case template of the automation platform into the field mapping table of the tool, if the operation is not carried out, the tool can generate a universal automation test case template, and the field can be automatically adjusted according to the requirement of the automation platform when the user subsequently imports the platform.
Step S03: the tool is operated on the proxy computer during front-end service test or interface test such as Web or app.
Step S04: the user starts to carry out front-end or interface test operation, and the tool automatically converts the test data into an automatic test case.
The transformation process comprises the following steps:
firstly, the program monitors HTTP message data on the proxy computer network card and analyzes the HTTP message into a plaintext.
Analyzing the association relation of data such as the time mark of the HTTP message, the content of the request header and the like, and performing interface grouping on the requests in the data according to the URL.
And thirdly, extracting and associating the parameters transmitted upstream and downstream of the request content and the return content in the packet through a keyword regular matching algorithm.
Fourthly, judging the assertion through the common keywords and the structural body in the preset assertion expression. Assertions are typically defined in programs, such as: the assertion is used for judging whether the code is in json format or not, whether the state code is 200 or not, 40x or 50x, whether the status code contains a mark field such as success or not, and the like.
Fifthly, the analyzed data is constructed into interface request data to carry out replay test.
Sixthly, converting the analyzed data into an automatic test case through a key field mapping relation.
And invoking an external interface to import data and simultaneously generating an automatic test case file.
Step S05: the tool can call an external interface of the test platform to import the analyzed case data into the test platform, the case can be examined and edited on the platform after the import, a user can also import the automatic test case into the test platform by using a file import mode, and the case can be examined and edited before the user imports the automatic test case.
In the embodiment of the invention, the tool has a data analysis function for converting communication data into plaintext data, a data association function for automatically organizing HTTP message data into regular interface interaction data, and a case conversion function for converting the interface interaction data into an automatic test case through matching of a preset template and a key field.
By using the case conversion tool provided by the embodiment of the invention, a tester can directly generate the automatic test case while performing interface test, the automatic conversion of the manual interface test process into the automatic test case is realized, the labor cost for editing and debugging the automatic test case is saved, and the efficiency for generating the automatic test case is improved. In addition, the tester does not need to pay attention to the parameter change in the automatic test case generated by the tool, the errors of manual writing are reduced, and the execution passing rate of the generated automatic test case is high. The tool generates the imported automatic test case in a data conversion mode, does not depend on an automatic platform for running the test case, and reduces the operation difficulty of testers.
Fig. 6 is a schematic structural diagram of a device for generating a test case record according to an embodiment of the present invention. As shown in fig. 6, the apparatus includes:
a data obtaining module 601, configured to obtain test packet data for performing a service test;
a grouping module 602, configured to group the test packet data to obtain at least one interface group;
a relation determining module 603, configured to determine a grouping parameter value of each interface grouping, and determine an upstream-downstream relation of each interface grouping according to the grouping parameter value;
a record generation module 604 for, for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups.
Optionally, the grouping module 602 is specifically configured to:
analyzing the test message data to generate plaintext message data;
obtaining message information of the test message data from the plaintext message data, wherein the message information includes at least one of the following: time stamp, request header content and link address;
and grouping the test message data according to the message content to obtain at least one interface grouping.
Optionally, the test case record includes a plurality of case keywords;
the record generation module 604 is specifically configured to:
determining a mapping relation between the target parameters and the use case keywords;
for each case keyword in the test case record: determining current parameters corresponding to key fields of the current use case from a plurality of target parameters of the interface grouping according to the mapping relation; and determining the value of the current parameter as the value of the current use case keyword.
Optionally, the apparatus further comprises:
a receiving module 605, configured to receive a matching instruction input by a user, where the matching instruction is used to determine use case keywords corresponding to each target parameter;
and generating a mapping relation between the target parameters and the use case keywords according to the matching instruction.
Optionally, the record generating module 604 is specifically configured to:
determining a target execution sequence of the test case record according to the upstream and downstream relation of the interface group; the execution sequence of the test case records corresponding to the upstream packet of the interface packet is located before the target execution sequence, and the execution sequence of the test case records corresponding to the downstream packet of the interface packet is located after the target execution sequence.
Optionally, the apparatus further comprises:
a detection module 606, configured to generate interface request data according to the multiple target parameter values of the interface packet;
sending the interface request data, and receiving interface return data returned by the interface request data;
and determining whether the interface request data meet preset conditions or not according to the interface return data.
Optionally, the apparatus further comprises:
the editing module 607 is configured to display the test case record and receive an editing operation of a user for the test case record;
processing the test case record according to the editing operation;
and importing the processed test case record into a test platform.
An embodiment of the present invention provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method of any of the embodiments described above.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 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. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer 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 of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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. In the present invention, a computer 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. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer 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 computer readable signal medium may also be any computer readable medium that is not a computer 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 computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: the device comprises a data acquisition module, a grouping module, a relation determining module and a record generating module. The names of these modules do not limit the modules themselves in some cases, and for example, the data acquisition module may also be described as a "module that acquires test packet data for performing a service test".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
acquiring test message data for service test;
grouping the test message data to obtain at least one interface group;
determining grouping parameter values of the interface groups, and determining the upstream and downstream relations of the interface groups according to the grouping parameter values;
for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups.
According to the technical scheme of the embodiment of the invention, the test case record can be automatically generated according to the test message data for carrying out the service test. The test case record can be used for generating the test case of the test platform, so that the test case in the test platform does not need to be written manually, and the labor cost required by using the test platform is reduced.
In addition, the execution sequence of the test case record is determined according to the upstream and downstream relation of each interface group in the test message data. And determining the execution sequence of each test case in the test platform according to the execution sequence recorded by the test cases. Therefore, each test case in the test platform is ensured to be tested in a correct execution sequence.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for generating a test case record is characterized by comprising the following steps:
acquiring test message data for service test;
grouping the test message data to obtain at least one interface group;
determining grouping parameter values of the interface groups, and determining the upstream and downstream relations of the interface groups according to the grouping parameter values;
for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups.
2. The method of claim 1, wherein the grouping the test packet data to obtain at least one interface packet comprises:
analyzing the test message data to generate plaintext message data;
obtaining message information of the test message data from the plaintext message data, wherein the message information includes at least one of the following: time stamp, request header content and link address;
and grouping the test message data according to the message content to obtain at least one interface grouping.
3. The method of claim 1, wherein the test case record comprises a plurality of case keywords;
the generating of the test case record corresponding to the interface packet includes:
determining a mapping relation between the target parameters and the use case keywords;
for each case keyword in the test case record: determining current parameters corresponding to key fields of the current use case from a plurality of target parameters of the interface grouping according to the mapping relation; and determining the value of the current parameter as the value of the current use case keyword.
4. The method of claim 3, wherein before determining the mapping relationship between the target parameters and the use case keywords, further comprising:
receiving a matching instruction input by a user, wherein the matching instruction is used for determining case keywords corresponding to each target parameter;
and generating a mapping relation between the target parameters and the use case keywords according to the matching instruction.
5. The method according to claim 1, wherein the generating a test case record corresponding to the interface packet comprises:
determining a target execution sequence of the test case record according to the upstream and downstream relation of the interface group; the execution sequence of the test case records corresponding to the upstream packet of the interface packet is located before the target execution sequence, and the execution sequence of the test case records corresponding to the downstream packet of the interface packet is located after the target execution sequence.
6. The method according to claim 1, wherein before generating the test case record corresponding to the interface packet, further comprising:
generating interface request data according to a plurality of target parameter values of the interface grouping;
sending the interface request data, and receiving interface return data returned by the interface request data;
determining whether the interface request data meet preset conditions or not according to the interface return data;
and under the condition that the interface request data meet preset conditions, executing the step of generating the test case record corresponding to the interface grouping.
7. The method according to claim 1, wherein after generating the test case record corresponding to the interface packet, the method further comprises:
displaying the test case record, and receiving the editing operation of a user aiming at the test case record;
processing the test case record according to the editing operation;
and importing the processed test case record into a test platform.
8. An apparatus for generating a test case record, comprising:
the data acquisition module is used for acquiring test message data for service test;
the grouping module is used for grouping the test message data to obtain at least one interface grouping;
the relation determining module is used for determining grouping parameter values of the interface groups and determining the upstream and downstream relation of the interface groups according to the grouping parameter values;
a record generation module to, for each of the interface packets: generating a test case record corresponding to the interface grouping; the test case records are used for generating test cases in the test platform, the test case records have execution sequences, and the execution sequences are determined by the upstream and downstream relations of the interface groups.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202210224740.8A 2022-03-07 2022-03-07 Test case record generation method and device Pending CN114416597A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210224740.8A CN114416597A (en) 2022-03-07 2022-03-07 Test case record generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210224740.8A CN114416597A (en) 2022-03-07 2022-03-07 Test case record generation method and device

Publications (1)

Publication Number Publication Date
CN114416597A true CN114416597A (en) 2022-04-29

Family

ID=81263184

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210224740.8A Pending CN114416597A (en) 2022-03-07 2022-03-07 Test case record generation method and device

Country Status (1)

Country Link
CN (1) CN114416597A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407320A (en) * 2023-12-15 2024-01-16 成都觅瑞科技有限公司 Automatic testing method and device compatible with multiparty voice control equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407320A (en) * 2023-12-15 2024-01-16 成都觅瑞科技有限公司 Automatic testing method and device compatible with multiparty voice control equipment
CN117407320B (en) * 2023-12-15 2024-02-20 成都觅瑞科技有限公司 Automatic testing method and device compatible with multiparty voice control equipment

Similar Documents

Publication Publication Date Title
CN108459953A (en) test method and device
CN113987074A (en) Distributed service full-link monitoring method and device, electronic equipment and storage medium
CN109976995B (en) Method and apparatus for testing
CN112187558B (en) Data verification method and device and electronic equipment
CN111061696B (en) Method and device for analyzing transaction message log
CN110858172A (en) Automatic test code generation method and device
CN111045942A (en) Application testing method, system, storage medium and electronic equipment
CN113407458B (en) Interface testing method and device, electronic equipment and computer readable medium
CN114416597A (en) Test case record generation method and device
CN112084102A (en) Interface pressure testing method and device
CN113360376A (en) Buried point testing method and device
CN113760730A (en) Automatic testing method and device
CN116881166A (en) Method, device and system for generating test script
CN115904388A (en) Application program protocol analysis method, device, equipment and storage medium
CN113238940B (en) Interface test result comparison method, device, equipment and storage medium
CN113448869B (en) Method and device for generating test case, electronic equipment and computer readable medium
CN115454956A (en) Log generation method and device, electronic equipment and storage medium
CN114819679A (en) Customer service session quality inspection method and device
CN114285774A (en) Flow recording method and device, electronic equipment and storage medium
CN109062797B (en) Method and device for generating information
CN112988560A (en) Method and device for testing system robustness
CN111400623A (en) Method and apparatus for searching information
CN111352751A (en) Data file generation method and device, computer equipment and storage medium
CN109376066A (en) A kind of automatic test approach and device
CN111831530A (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