CN112380114A - Automatic generation method and device for reverse test case file and electronic equipment - Google Patents

Automatic generation method and device for reverse test case file and electronic equipment Download PDF

Info

Publication number
CN112380114A
CN112380114A CN202011223970.XA CN202011223970A CN112380114A CN 112380114 A CN112380114 A CN 112380114A CN 202011223970 A CN202011223970 A CN 202011223970A CN 112380114 A CN112380114 A CN 112380114A
Authority
CN
China
Prior art keywords
test case
reverse
case file
key field
file
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
CN202011223970.XA
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.)
China Life Insurance Co Ltd China
Original Assignee
China Life Insurance Co Ltd China
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 China Life Insurance Co Ltd China filed Critical China Life Insurance Co Ltd China
Priority to CN202011223970.XA priority Critical patent/CN112380114A/en
Publication of CN112380114A publication Critical patent/CN112380114A/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

One or more embodiments of the present specification provide a method, an apparatus, and an electronic device for automatically generating a reverse test case file, where the method includes: analyzing the forward test case file to obtain a forward key field; and covering the forward key field with the reverse key field to generate a reverse test case file. The reverse test case file is directly generated by converting the input forward test case file into the forward and reverse key fields, so that the time for software testers to compile cases is greatly saved, the working efficiency of the software testers is improved, and the test coverage of the cases is improved.

Description

Automatic generation method and device for reverse test case file and electronic equipment
Technical Field
One or more embodiments of the present disclosure relate to the technical field of software testing, and in particular, to a method and an apparatus for automatically generating a reverse test case file, and an electronic device.
Background
Nowadays, the information technology greatly promotes the development of society, and the software testing technology is also rapidly developed along with the development of the information technology, and gradually evolves from the initial manual testing to the automatic testing. Generally, the automatic test technology is divided into software test automation, test case generation automation and the like. Test cases can be generally classified into forward test case files and reverse test case files. The forward test case file generally focuses on whether the requirements of the system are realized or not from the requirements; the reverse test case file generally starts from the reverse direction of the requirement and focuses on investigating the fault tolerance of the system. Reverse test case files generally have several characteristics: (1) the similarity between the content and the forward test case file is very high, and the repeating rate of the dialogues is extremely high; (2) one forward test case file can generally extend multiple reverse test case files.
In the prior art, a forward test case file and a reverse test case file are written separately, wherein especially writing of a reverse case consumes most time of software testers, and writing of the reverse test case file alone often has the problems of low test coverage and incomplete design of the reverse test case file, and many system problems are caused by the fact that the reverse test case file is not designed completely.
Disclosure of Invention
In view of this, one or more embodiments of the present disclosure are directed to a method, an apparatus, and an electronic device for automatically generating a reverse test case file, where the reverse test case file is directly generated from an input forward test case file through conversion of forward and reverse key fields by using characteristics of the reverse test case file, so that time for software testers to write a case is greatly saved, thereby improving work efficiency of the software testers, improving test coverage of the case, and solving problems in the prior art that time is consumed for writing the reverse test case file alone, test coverage of the reverse test case file is low, and design is incomplete.
In view of the foregoing, one or more embodiments of the present specification provide an automatic generation method of a reverse test case file, including:
analyzing the forward test case file to obtain a forward key field;
determining a type of the forward critical field;
calling a forward key field and reverse key field set mapping table according to the type; each forward key field in the mapping table corresponds to one reverse key field set, the reverse key field set comprises at least one reverse key field, and if two or more reverse key fields are included, two adjacent reverse key fields are separated by a separator;
and the reverse key fields in the reverse key field set cover the corresponding forward key fields in the forward test case, and reverse test case files with the same number as the reverse key fields in the reverse key field set are generated.
Further, still include:
setting a test case set, wherein the test case set comprises at least one forward test case file;
further, the setting the test case set includes:
generating a test case set, and setting the test case set to be null;
inputting a plurality of forward test case files into the test case set, wherein a spacer is arranged between every two adjacent forward test case files;
and analyzing a plurality of independent forward test case files in the test case set according to the spacers.
Further, when the number of the forward key fields is two or more, the forward key fields are stored in a queue, a separator is arranged between two adjacent forward key fields in the queue, and the forward key fields stored in the queue are separated and independent by the separator and are arranged in sequence.
Further, the parsing the forward test case file to obtain the forward key field includes:
calling one forward key field in the queue;
acquiring the format of a forward test case file;
calling an opening function corresponding to the format, and opening the forward test case file;
calling a reading function corresponding to the format, reading the forward test case file line by line until the last line of the forward test case file is read, and searching all the forward key fields in the forward test case file by taking the called forward key fields as search words;
the reverse key fields in the reverse key field set cover the corresponding forward key fields in the forward test cases, and reverse test cases with the same number as the reverse key fields in the reverse key field set are generated, including:
and uniformly covering all the forward key fields by the reverse key fields corresponding to the forward key fields, generating a reverse test case file, calling a read function to end, and closing the forward test case file.
And further, generating a new test case set and storing the reverse test case file.
Further, the generating a new test case set and storing a reverse test case file includes:
generating a new test sample set, and setting the new test sample set to be null;
setting a storage path of the generated reverse test case file;
and storing the newly generated reverse test case files in a new test case set, wherein a spacer is arranged between every two adjacent reverse test case files.
Based on the same inventive concept, one or more embodiments of the present specification further provide an apparatus for automatically generating a reverse test case file, including:
the analysis module is configured for analyzing the forward test case file to obtain a forward key field;
and the generating module is used for covering the forward key field with the reverse key field to generate a reverse test case file.
Based on the same inventive concept, one or more embodiments of the present specification further provide an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the method as described in any one of the above items when executing the program.
Based on the same inventive concept, one or more embodiments of the present specification also provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method as described in any one of the above.
As can be seen from the above description, according to the method, the apparatus, and the electronic device for automatically generating a reverse test case file provided in one or more embodiments of the present disclosure, by using the characteristics that "the content of the reverse test case file is highly similar to the content of the forward test case file, and one forward test case file can extract a plurality of reverse test case files", the reverse test case file is directly generated by the input forward test case file according to the rule that "the forward key field is covered by the reverse key field", so that the time for software testers to write cases can be greatly saved, thereby improving the working efficiency of the software testers and improving the test coverage of the reverse test case file.
Drawings
In order to more clearly illustrate one or more embodiments or prior art solutions of the present specification, the drawings that are needed in the description of the embodiments or prior art will be briefly described below, and it is obvious that the drawings in the following description are only one or more embodiments of the present specification, and that other drawings may be obtained by those skilled in the art without inventive effort from these drawings.
FIG. 1 is a schematic diagram of a method for automatically generating a reverse test case file according to one or more embodiments of the present disclosure;
FIG. 2 is a schematic diagram of a method for generating a reverse test case file by covering a forward key field with a reverse key field according to one or more embodiments of the present disclosure;
FIG. 3 is a schematic diagram of another method for automatically generating a reverse test case file according to one or more embodiments of the present disclosure;
FIG. 4 is a schematic diagram of a method for setting a test case set according to one or more embodiments of the present disclosure;
FIG. 5 is a diagram illustrating a file call method of a reverse test case file automatic generation process according to one or more embodiments of the present disclosure;
FIG. 6 is a schematic diagram of a method of storing reverse test case files according to one or more embodiments of the present disclosure;
FIG. 7 is a schematic diagram of an apparatus for automatically generating a reverse test case file according to one or more embodiments of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to one or more embodiments of the present disclosure.
Detailed Description
For the purpose of promoting a better understanding of the objects, aspects and advantages of the present disclosure, reference is made to the following detailed description taken in conjunction with the accompanying drawings.
It is to be noted that unless otherwise defined, technical or scientific terms used in one or more embodiments of the present specification should have the ordinary meaning as understood by those of ordinary skill in the art to which this disclosure belongs.
As described in the background section, the reverse test case file has the characteristics that the content of the reverse test case file is high in similarity with the content of the forward test case file, and one forward test case file can extract a plurality of reverse test case files, but the prior art does not utilize the characteristics of the reverse test case, and still adopts a mode of independently writing the forward test case file and the reverse test case file, so that the problem of consuming time for software testers to write test cases is generated, and the independent writing is easy to have omission, so that the problems of incomplete test coverage and incomplete design of the reverse test case file are caused.
In view of this, one or more embodiments of the present disclosure provide an automatic generation method for reverse test case files, specifically, first, a plurality of mutually independent forward test case files are placed in a test case set; then, calling a forward test case file in the test case set, analyzing whether a forward key field exists in the forward test case file, and if the forward key field does not exist, continuously analyzing the next forward test case file; and if the forward key field exists, automatically covering the forward key field in the forward test case file by using the reverse key field, and finally generating the reverse test case file.
Therefore, according to the method, the device and the electronic equipment for automatically generating the reverse test case file provided by one or more embodiments of the specification, the reverse test case file is directly generated from the forward test case file through the rule that the reverse key field covers the forward key field, so that the working efficiency of software testers is improved, and the test coverage of the reverse test case file is improved.
The technical solutions of one or more embodiments of the present specification are described in detail below with reference to specific embodiments.
Referring to fig. 1, an automatic reverse test case file generation method according to an embodiment of the present specification includes:
s101, analyzing a forward test case file to obtain a forward key field;
and S102, covering the forward key field with the reverse key field to generate a reverse test case file.
In this embodiment, a conversion relationship is directly established between a forward key field in a forward test case file and a reverse key field in a reverse test case file, so as to generate a reverse test case file;
further, referring to fig. 2, the generating a reverse test case file by covering the forward key field with the reverse key field corresponding to the forward key field includes:
s201, determining the type of a forward key field;
s202, calling a forward key field and reverse key field set mapping table according to the type; each forward key field in the mapping table corresponds to one reverse key field set, the reverse key field set comprises at least one reverse key field, and if two or more reverse key fields are included, two adjacent reverse key fields are separated by a separator;
s203, the reverse key fields in the reverse key field set cover the corresponding forward key fields in the forward test case, and reverse test case files with the same number as the reverse key fields in the reverse key field set are generated.
Further, the establishing process of the mapping table is as follows:
classifying the key fields, wherein each class corresponds to a conversion rule;
and setting the reverse key field set according to the conversion rule.
Specifically, the type of the forward key field may be a number type, a judgment type, a quantity type, and the like, and the conversion rule of each type is as follows:
for the number type, the number type comprises a number and a number range, if the number type is the number, the conversion rule is that other numbers different from the number are selected; in the case of a numerical range, the conversion rule is to select another numerical range different from the numerical range, or to select a number outside the numerical range.
For the judgment type, converting the rule into a negative word corresponding to the judgment word;
for quantity types, the conversion rule is to select a range of quantities outside the range of quantities.
And creating a mapping table of the forward key field and the reverse key field set according to the conversion rule and by combining practical application, as shown in table 1.
TABLE 1 mapping table of Forward Key field and reverse Key field
Figure BDA0002763044030000061
As can be seen from the above table, a forward key field at least corresponds to a reverse key field, for example, when the forward key field obtained from the test force file is "n years old", it corresponds to two reverse key fields, one is "n-5 years old", and one is "n +5 years old", and the two reverse key fields are separated by a separator (the separator may be a common separator such as a ton mark, a comma, a semicolon, etc.), the two reverse key fields are separated and independent by the separator, when the mapping table is called and the reverse key field corresponding to the forward key field is analyzed to contain the separator, the forward key field is covered by each reverse key field in the reverse key field set one by one, and the reverse test cases with the same number of reverse key fields in the reverse key field set are generated, that is, if the key word of the forward test case is "n years old", it can generate two reverse test cases containing "n-5 years old" and "n +5 years old", respectively.
As an alternative embodiment, referring to fig. 3, a method for automatically generating a reverse test case file includes:
s301, setting a test case set, wherein the test case set comprises at least one forward test case file;
s302, analyzing the forward test case file to obtain a forward key field;
s303, covering the forward key field with the reverse key field to generate a reverse test case file;
and S304, generating a new test case set and storing the reverse test case file.
In the embodiment, the automatic generation of the reverse test case file is divided into three steps of inputting, judging, generating and storing, wherein the inputting is to input a plurality of forward test case files; the step of judging and generating is to judge whether the forward key field is covered in the forward test case file, if not, the reverse test case file is not generated, and if so, the forward key field is covered by the reverse key field, and the reverse test case is generated; "store" is to store the newly generated reverse test case file in the new test case set.
Referring to fig. 4, as an alternative embodiment, the setting a test case set includes:
s401, generating a test case set, and setting the test case set to be null;
s402, inputting a plurality of forward test case files into the test case set, wherein a spacer is arranged between every two adjacent forward test case files;
and S403, analyzing a single forward test case file in the test case set according to the spacer.
That is, the set test case set in this embodiment is mainly the input and separation of the forward test case file, wherein the spacer of the forward test case file may be carriage return, space, etc. The spacer has a separation effect on a plurality of forward test case files in the test case set, and is beneficial to calling a single forward test case file in the subsequent steps.
As an optional embodiment, the forward key fields are artificially set, when two or more forward key fields are present, the forward key fields are stored in a queue, a separator (which may be a common separator such as a pause sign, a comma, a semicolon, or the like) is disposed between two adjacent forward key fields in the queue, and the forward key fields stored in the queue are separated and independent by the separator and are sequentially arranged.
The calling process of the forward key field in the queue is as follows:
and taking a forward key field in the queue as a search word, searching all forward test cases in the test case set, calling the next forward key field to search all forward test cases in the test case set, and repeating the steps until the last forward key field is taken as the search word to search all forward test cases in the test case set.
Referring to fig. 5, as an alternative embodiment, the parsing parses the forward test case file to obtain forward key fields therefrom; covering the forward key field with the reverse key field to generate a reverse test case file, wherein the file calling process comprises the following steps:
s501, calling one forward key field in the queue;
s502, obtaining the format of the forward test case file;
s503, calling an opening function corresponding to the format, and opening the forward test case file;
s504, calling a reading function corresponding to the format, reading the forward test case file line by line until the last line of the forward test case file is read, and searching all the forward key fields in the forward test case file by taking the called forward key fields in the S501 as search terms;
and S505, uniformly covering all the forward key fields by the reverse key fields corresponding to the forward key fields, generating reverse test case files, calling a read function to end, and closing the forward test case files.
The forward test case file and the reverse test case file have the same file format, are both in text format, and specifically can be one of xml, txt, doc, docx and wps. And the file format is directly embodied in the file name of the test case file, and the format of the test case file can be obtained only by reading the name of the test case file.
For example, if the name of the forward test case file is filename1.txt and the format is txt, then an open function is called to open the file, and then txt.reader and reader.next _; under the condition that the forward key field is not read, reading the last line of the forward test case file, calling the read function to end, closing the forward test case file, and calling the next forward test case file to open and read; and if the forward key field is read, performing the subsequent steps.
In the embodiment, the original forward test case file is analyzed through a text analysis technology and a keyword matching technology, and the forward key fields in the forward test case file are identified.
Referring to fig. 6, as an alternative embodiment, the generating a new test case set and storing a reverse test case file includes:
s601, generating a new test sample set, and setting the new test sample set to be null;
s602, setting a storage path of the generated reverse test case file;
s603, storing the newly generated reverse test case files in a new test case set, wherein a spacer is arranged between every two adjacent reverse test case files.
That is, in this embodiment, the newly generated reverse test case file is separately stored in the new test case set, and the original forward test case file is still stored in the test case set, so that the software tester can search, query, update and apply the forward test case file and the reverse test case file, respectively.
In addition, a spacer is also arranged between every two adjacent reverse test case files, so that the reverse test case file conversion identity in the new test case set is conveniently used as a new forward test case file to perform subsequent reverse test case file conversion.
As an optional embodiment, the file name of the reverse test case file in the new test case set is associated with the file name of the forward test case file in the test case set, that is, which forward test case file is associated with the reverse test case file can be known through the file name, and when there is a place in the forward test case file that needs to be modified, the associated reverse test case file can be found as soon as possible and modified.
For example, the forward test case file names in the test case set are filename1.txt, filename2.txt, filename3.txt, …, filenamen. txt, and if filename1.txt generates one reverse test case file, filename2.txt generates two reverse test case files, and filename3.txt generates three reverse test case files, the corresponding reverse test case file names stored in the new test case set are next 1filename1.txt, next 1filename2.txt, next 2filename2.txt, next 1filename3.txt, next 2filename 3.txt, and next 3 filename3. txt.
It should be noted that the method of one or more embodiments of the present disclosure may be performed by a single device, such as a computer or server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the devices may perform only one or more steps of the method of one or more embodiments of the present disclosure, and the devices may interact with each other to complete the method.
It should be noted that the above description describes certain embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Referring to fig. 7, based on the same inventive concept, corresponding to any of the above-described embodiments, one or more embodiments of the present specification further provide an apparatus for automatically generating a reverse test case file.
The automatic generating device of the reverse test case file comprises:
the analysis module 701 is configured to analyze the forward test case file to obtain a forward key field;
the generating module 702 generates a reverse test case file by covering the forward key field with the reverse key field.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the modules may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
The apparatus of the foregoing embodiment is used to implement the corresponding automatic reverse test case file generation method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, one or more embodiments of the present specification further provide an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the automatic reverse test case file generation method according to any of the above-mentioned embodiments.
Fig. 8 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The electronic device of the above embodiment is used to implement the corresponding automatic reverse test case file generation method in any one of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, one or more embodiments of the present specification further provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the automatic reverse test case file generation method according to any of the above-mentioned embodiments.
Computer-readable media of the present embodiments, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the automatic reverse test case file generation method according to any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the spirit of the present disclosure, features from the above embodiments or from different embodiments may also be combined, steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present description as described above, which are not provided in detail for the sake of brevity.
In addition, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown in the provided figures, for simplicity of illustration and discussion, and so as not to obscure one or more embodiments of the disclosure. Furthermore, devices may be shown in block diagram form in order to avoid obscuring the understanding of one or more embodiments of the present description, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the one or more embodiments of the present description are to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the disclosure, it should be apparent to one skilled in the art that one or more embodiments of the disclosure can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
It is intended that the one or more embodiments of the present specification embrace all such alternatives, modifications and variations as fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of one or more embodiments of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (10)

1. A reverse test case file automatic generation method is characterized by comprising the following steps:
analyzing the forward test case file to obtain a forward key field;
determining a type of the forward critical field;
calling a forward key field and reverse key field set mapping table according to the type; each forward key field in the mapping table corresponds to one reverse key field set, the reverse key field set comprises at least one reverse key field, and if two or more reverse key fields are included, two adjacent reverse key fields are separated by a separator;
and the reverse key fields in the reverse key field set cover the corresponding forward key fields in the forward test case, and reverse test case files with the same number as the reverse key fields in the reverse key field set are generated.
2. The method of claim 1, further comprising:
and setting a test case set, wherein the test case set comprises at least one forward test case file.
3. The method of claim 2, wherein the setting the set of test cases comprises:
generating a test case set, and setting the test case set to be null;
inputting a plurality of forward test case files into the test case set, wherein a spacer is arranged between every two adjacent forward test case files;
and analyzing a plurality of independent forward test case files in the test case set according to the spacers.
4. The method of claim 3, wherein when there are two or more forward key fields, the forward key fields are stored in a queue, a separator is disposed between two adjacent forward key fields in the queue, and the forward key fields stored in the queue are separated and independent by the separator and are arranged sequentially.
5. The method of claim 4, wherein parsing the forward test case file to obtain forward critical fields comprises:
calling one forward key field in the queue;
acquiring the format of a forward test case file;
calling an opening function corresponding to the format, and opening the forward test case file;
calling a reading function corresponding to the format, reading the forward test case file line by line until the last line of the forward test case file is read, and searching all the forward key fields in the forward test case file by taking the called forward key fields as search words;
the reverse key fields in the reverse key field set cover the corresponding forward key fields in the forward test cases, and reverse test cases with the same number as the reverse key fields in the reverse key field set are generated, including:
and uniformly covering all the forward key fields by the reverse key fields corresponding to the forward key fields, generating a reverse test case file, calling a read function to end, and closing the forward test case file.
6. The method of claim 1, further comprising generating a new test case set and storing the reverse test case file.
7. The method of claim 6, wherein generating a new test case set and storing a reverse test case file comprises:
generating a new test sample set, and setting the new test sample set to be null;
setting a storage path of the generated reverse test case file;
and storing the newly generated reverse test case files in a new test case set, wherein a spacer is arranged between every two adjacent reverse test case files.
8. An automatic generation device for reverse test case files is characterized by comprising the following components:
the analysis module is configured for analyzing the forward test case file to obtain a forward key field;
and the generating module is used for covering the forward key field with the reverse key field to generate a reverse test case file.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to claims 1 to 7 when executing the program.
10. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of claims 1-7.
CN202011223970.XA 2020-11-05 2020-11-05 Automatic generation method and device for reverse test case file and electronic equipment Pending CN112380114A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011223970.XA CN112380114A (en) 2020-11-05 2020-11-05 Automatic generation method and device for reverse test case file and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011223970.XA CN112380114A (en) 2020-11-05 2020-11-05 Automatic generation method and device for reverse test case file and electronic equipment

Publications (1)

Publication Number Publication Date
CN112380114A true CN112380114A (en) 2021-02-19

Family

ID=74578311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011223970.XA Pending CN112380114A (en) 2020-11-05 2020-11-05 Automatic generation method and device for reverse test case file and electronic equipment

Country Status (1)

Country Link
CN (1) CN112380114A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407976A (en) * 2014-11-28 2015-03-11 联动优势电子商务有限公司 Method and device for generating interface robustness test case
CN109308265A (en) * 2018-10-26 2019-02-05 广州酷狗计算机科技有限公司 The method and apparatus for generating negative testing use-case
CN109388561A (en) * 2018-09-18 2019-02-26 深圳壹账通智能科技有限公司 Interface testing case generation method, device, computer equipment and storage medium
CN110597708A (en) * 2019-08-02 2019-12-20 北京奇艺世纪科技有限公司 Test case file conversion method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407976A (en) * 2014-11-28 2015-03-11 联动优势电子商务有限公司 Method and device for generating interface robustness test case
CN109388561A (en) * 2018-09-18 2019-02-26 深圳壹账通智能科技有限公司 Interface testing case generation method, device, computer equipment and storage medium
CN109308265A (en) * 2018-10-26 2019-02-05 广州酷狗计算机科技有限公司 The method and apparatus for generating negative testing use-case
CN110597708A (en) * 2019-08-02 2019-12-20 北京奇艺世纪科技有限公司 Test case file conversion method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109308254B (en) Test method, test device and test equipment
CN109558128A (en) Json data analysis method, device and computer readable storage medium
CN114356851A (en) Data file storage method and device, electronic equipment and storage medium
CN111079944A (en) Method and device for realizing interpretation of transfer learning model, electronic equipment and storage medium
CN106649210B (en) Data conversion method and device
CN110688315A (en) Interface code detection report generation method, electronic device, and storage medium
CN110795920B (en) Document generation method and device
CN115495082B (en) TLV format data automatic conversion method and related equipment
CN111142871A (en) Front-end page development system, method, equipment and medium
CN111612158A (en) Model deployment method, device, equipment and storage medium
CN111459802A (en) Method, device and equipment for testing WebView page of Android application program based on GUI
KR20200103133A (en) Method and apparatus for performing extract-transfrom-load procedures in a hadoop-based big data processing system
CN112380114A (en) Automatic generation method and device for reverse test case file and electronic equipment
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
CN115757174A (en) Database difference detection method and device
CN112380117A (en) Production method and device of software test basic case and electronic equipment
CN112671671A (en) Third party flow identification method, device and equipment based on third party library
CN113419959A (en) Method and equipment for generating coverage rate verification report
JP7344521B1 (en) Program, method, information processing device, and system
CN110737515B (en) Processing method of data task instruction, computer equipment and storage medium
CN116484846A (en) Construction method of keyword library in power industry
CN114943212A (en) Parameter report generation method and related equipment thereof
CN115391619A (en) Data analysis method and device, electronic equipment and storage medium
CN114816989A (en) Optimization method of automatic test script and related equipment
CN117931893A (en) Data retrieval method and system based on distributed search engine

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