Test case automatic conversion method, device, electronic device and storage medium

Through the exception throwing mechanism, the mind map file is converted into a dictionary and verified, which solves the problem of lack of interface interactivity and environmental requirements in the existing technology, and realizes automatic conversion of test cases without environmental requirements, improving user experience and conversion efficiency .

CN113918455BActive Publication Date: 2024-11-22TRAFFIC CONTROL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111162207.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2024-11-22
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

The existing test case conversion methods lack interface interactivity, have poor user experience, and need to be executed in a specific environment, making errors prone and difficult to locate errors.

Method used

Through the exception throwing mechanism, the mind map file is converted into a dictionary and verified, and the automatic conversion of test cases without environmental requirements is realized, interface interactivity is provided, and branch content is read cyclically and written to test case tables are written.

Benefits of technology

It realizes automatic conversion of test cases that are simple, fast and easy to operate, improves user experience, and reduces the difficulty of error occurrence and positioning errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113918455B_ABST
    Figure CN113918455B_ABST
Patent Text Reader

Abstract

The present invention provides a test case automatic conversion method, device, electronic device and storage medium, wherein the method comprises: obtaining a target mind map file and generating a test case table according to a first input of a user; converting the target mind map file into a dictionary; using an exception throwing method to perform a first verification on the dictionary to determine whether the mind map is abnormal; when the first verification result is normal, cyclically reading each branch content in the dictionary, and writing the branch content into the test case table, so as to realize simple, fast, easy-to-operate automatic conversion of test cases with interface interactivity, no operating environment requirements, and no corresponding technical requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a test case automatic conversion method, device, electronic equipment and storage medium. Background Art

[0002] With the development of society, the iteration speed of software is getting faster and faster, and improving the efficiency of software testing is an inevitable process.

[0003] The traditional method of writing test cases is mainly completed through manual input in Word and Excel. Its disadvantages are incomplete scenario coverage, non-standardization, prone to errors and low efficiency. The automated writing method of test cases is mainly achieved by converting Xmind files into Excel files in a python environment, which is implemented by ZenTao, interfaces and convolutional neural network models.

[0004] The disadvantages of existing conversion methods are that they are too complicated, lack interface interactivity, require a test environment, and require testers to have corresponding knowledge. At the same time, Python programs are executed sequentially. Once an error occurs, the program will terminate and the error point cannot be located. Summary of the invention

[0005] The present invention provides a test case automatic conversion method, device, electronic device and storage medium, which are used to solve the defects of the prior art that there is no interface interactivity and poor user experience, and realize simple, fast, easy-to-operate, interface-interactive, no operating environment requirements, and no corresponding technical requirements for test case automatic conversion.

[0006] The present invention provides a test case automatic conversion method, comprising:

[0007] Obtain the target mind map file according to the user's first input and generate a test case table;

[0008] Converting the target mind map file into a dictionary;

[0009] By throwing an exception, a first verification is performed on the dictionary to determine whether the mind map is abnormal;

[0010] When there is no abnormality in the first verification result, each branch content in the dictionary is read cyclically, and the branch content is written into the test case table.

[0011] According to the test case automatic conversion method provided by the present invention, the method of using an exception throwing method to first verify the dictionary to determine whether the mind map is abnormal includes:

[0012] In the case of failure in acquiring the branch of the dictionary, throwing a first exception to prompt the user to re-enter the target mind map file;

[0013] Looping and reading each branch in the dictionary for a preset number of times, and in the case of failure to read the content in the branch, throwing a second exception to prompt the user that the use case design in the target mind map file is incomplete;

[0014] The content of the first preset level in the dictionary is obtained, and when the content of the first preset level does not conform to the first format, a third exception is thrown to prompt the user to modify the content of the canvas corresponding to the content of the first preset level in the target mind map file.

[0015] According to the test case automatic conversion method provided by the present invention, the loop reads each branch content in the dictionary and writes the branch content into the test case table, including:

[0016] Determine, based on the number of branches at the first level in the dictionary, a sub-dictionary in the dictionary corresponding to the canvas;

[0017] Circularly read the content of each branch of the sub-dictionary, and store the content of each branch in the test case table until the content of all branches in a sub-dictionary is read;

[0018] Continue to read the content of each branch of the next sub-dictionary until the contents of the branches of all sub-dictionaries are read.

[0019] According to the test case automatic conversion method provided by the present invention, the loop reads the content of each branch of the sub-dictionary and stores the content of each branch in the test case table, including:

[0020] According to the content of the first level in the sub-dictionary, obtain the module name variable and the use case number variable;

[0021] According to the number of branches at the first level in the sub-dictionary, a second-level loop is performed, and the content of the second level is saved in the use case input variable;

[0022] According to the number of branches at the second level in the sub-dictionary, a third-level loop is performed, and the content at the third level is saved in a temporary use case name variable;

[0023] Concatenate the temporary use case name variables to obtain a use case name variable;

[0024] Save the contents of the last level in the sub-dictionary to the expected output variable;

[0025] The contents of the module name variable, the use case number variable, the use case input variable, the use case name variable and the expected output variable are written into the test case table.

[0026] According to the test case automatic conversion method provided by the present invention, before obtaining the target mind map file according to the first input of the user and generating the test case table, it also includes:

[0027] When receiving a first input from a user, performing a second verification on the first input by throwing an exception;

[0028] If the second verification fails, an exception is thrown to prompt the user of the reason for the exception, and the user's first input is received again until the second verification passes.

[0029] According to the test case automatic conversion method provided by the present invention, when the second verification fails, throwing an exception and prompting the user the cause of the exception includes:

[0030] In the case where the first input does not include the target path, a fourth exception is thrown to prompt the user to re-enter the target path;

[0031] In the case where the first input does not include the name of the test case form, throwing a fifth exception to prompt the user to re-enter the name of the test case form;

[0032] The target data table is created according to the name of the test case table in the first input. When the creation of the target data table fails, a sixth exception is thrown to prompt the user that the name format of the test case table is incorrect.

[0033] The present invention also provides a test case automatic conversion device, comprising:

[0034] An information acquisition module, used to acquire a target mind map file according to a first input of a user and generate a test case table;

[0035] A dictionary conversion module, used for converting the target mind map file into a dictionary;

[0036] A dictionary verification module, used to determine whether the mind map is abnormal by performing a first verification on the dictionary in a manner of throwing an exception;

[0037] The test case table content writing module is used to cyclically read each branch content in the dictionary and write the branch content into the test case table when there is no abnormality in the first verification result.

[0038] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned test case automatic conversion methods are implemented.

[0039] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned test case automatic conversion methods are implemented.

[0040] The present invention provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the test case automatic conversion method are implemented.

[0041] The test case automatic conversion method, device, electronic device and storage medium provided by the present invention convert the target mind map file into a dictionary, verify the dictionary, and use exception throwing to achieve simple, fast, easy-to-operate, interface interactive, no operating environment requirements, and no corresponding technical requirements for test case automatic conversion, thereby improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 It is a flow chart of the test case automatic conversion method provided by the present invention;

[0044] Figure 2 It is a flowchart provided by the present invention for cyclically reading each branch content in the dictionary and writing the branch content into the test case table;

[0045] Figure 3 It is a flowchart provided by the present invention for cyclically reading the content of each branch of the sub-dictionary and storing the content of each branch in a test case table;

[0046] Figure 4 It is a structural schematic diagram of the test case automatic conversion device provided by the present invention;

[0047] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Figure 1 is a flow chart of a test case automatic conversion method provided by an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0050] Step 100: Obtain a target mind map file according to a first input from a user and generate a test case table.

[0051] Optionally, the developer packages the program to generate an executable file. After the user executes the executable file, a human-computer interaction interface, such as a window developed by the developer, is displayed, and input is performed through the human-computer interaction interface.

[0052] The program receives the first input from the user, which includes the local storage path of the target mind map file and the name of the test case table. The target mind map file can be determined according to the local storage path of the target mind map file in the first input of the user, and a new test case table can be created according to the name of the test case table. It can be understood that the test case table generated at this time is an empty table, and the content of the table needs to be filled in through subsequent steps.

[0053] The target mind map file includes at least one canvas, and the canvas contains a mind map in a preset format. For example, the mind map is divided into five parts: module name, use case number, use case input, use case name, and expected result, where the module name and use case number jointly occupy the first level of the mind map, the module name and use case number are separated by a carriage return, the use case input is the second level of the mind map, the use case name occupies at least one level, and the expected result occupies the last level of the mind map. It can be understood that at this time, the mind map has at least four levels.

[0054] Step 101: Convert the target mind map file into a dictionary.

[0055] Optionally, based on the Python-based Xmindparser module, the target mind map file is converted into a dictionary.

[0056] As you can understand, the dictionary is in the form of a multi-layer nested array, reflecting the level of each key-value pair in the dictionary. The highest level key-value pair in the dictionary corresponds to the canvas in the target mind map, the second level key-value pair corresponds to the highest level node of the mind map in the canvas, such as the module name, the third level key-value pair corresponds to the second level node of the mind map, such as the use case input, and so on, until the last level.

[0057] Step 102: Determine whether the mind map is abnormal by first verifying the dictionary by throwing an exception.

[0058] Optionally, the target mind map file is determined based on user input, and the user may enter incorrect content, resulting in the inability to convert the content of the target mind map file and store it in the test case table. Therefore, an exception is thrown to perform a first verification on the dictionary to determine whether the mind map is abnormal. If an exception exists, in order to eliminate the corresponding exception, it is necessary to determine the abnormal position and cause of the mind map based on the abnormal position in the dictionary, and prompt the user with the cause of the abnormality or the abnormal position for the user's reference.

[0059] Step 103: When there is no abnormality in the first verification result, read each branch content in the dictionary in a loop and write the branch content into the test case table.

[0060] Optionally, in the event of an exception, an exception will be thrown to prompt the user to modify or re-enter the information. The user will modify and re-enter the information until the first verification result is normal, and then proceed to the next step.

[0061] When there is no abnormality in the first verification result, a loop reading is performed according to the key-value pairs included in the dictionary and the levels of the key-value pairs, and the read results are written into the test case table in a preset manner. In addition, the user's second input can be obtained, and the information based on the second input is stored in the test case table. In addition, based on the Datetime module in python, the use case design time is determined according to the automatically obtained date of today.

[0062] For example, the user's second input includes the importance level of the test case and the test case designer. Each row in the test case table is a test case. Each test case in the test case table includes the following information: module name, case number, case name, importance level, case input, expected results, test case designer, and case design time.

[0063] The embodiment of the present invention aims at the problem that the existing technology does not have interface interactivity and provides a simple, fast, easy-to-operate test case automatic conversion method with interface interactivity and no corresponding technical requirements. The main idea of ​​the method is to use the exception throwing method to realize interface interaction and read data, which solves the problem that the existing technology needs to be implemented in a Python environment, realizes automatic conversion of test cases without environmental requirements, and improves user experience.

[0064] In one embodiment, the method of throwing an exception to determine whether the mind map is abnormal by first verifying the dictionary includes:

[0065] In the case of failure in acquiring the branch of the dictionary, a first exception is thrown to prompt the user to re-input the target mind map file.

[0066] Optionally, if the branch of obtaining the dictionary fails, that is, there is no hierarchical structure in the dictionary converted from the target mind map file, it means that the file type of the target mind map file input by the user is wrong. At this time, a first exception is thrown to prompt the user to re-enter the target mind map file.

[0067] Each branch in the dictionary is read in a loop for a preset number of times. In the case of failure to read the content in the branch, a second exception is thrown to prompt the user that the use case design in the target mind map file is incomplete.

[0068] Optionally, there is a mind map in a preset format in the canvas of the target mind map file. The mind map is hierarchical, and each mind map has at least a preset number minus one level. Each branch in the dictionary is read in a loop for a preset number of times. In the event of a failure to read the content of the variable in the dictionary, it indicates that the use case design is incomplete, and a second exception is thrown to prompt the user that the use case design in the target mind map file is incomplete, and the user is prompted to modify the content of the nth canvas.

[0069] For example, there are 2 canvases in the target mind map, and the mind map in each canvas has at least 4 levels. At this time, the branches in the dictionary have at least 5 levels, that is, the preset number is 5. It can be understood that the first level in the dictionary is the canvas, and the remaining four levels correspond to the four levels of the mind map in the canvas. Each branch in the dictionary is read 5 times in a loop. If the content of the variable in the branch fails to be read, it means that the test case design in the canvas is incomplete. According to the value of the variable at the first level in the branch that cannot be read 5 times in a loop, the problem canvas is determined, and the user is prompted to modify the problem canvas.

[0070] The content of the first preset level in the dictionary is obtained, and when the content of the first preset level does not conform to the first format, a third exception is thrown to prompt the user to modify the content of the canvas corresponding to the content of the first preset level in the target mind map file.

[0071] Optionally, the module name and the use case number jointly occupy the first level of the mind map, and the module name and the use case number are separated by a carriage return character. The module name and the use case number correspond to the content of the first preset level in the generated dictionary. Since the module name and the use case number need to be determined by separation with a carriage return character, it is necessary to check whether the format of the content of the first preset level is consistent with the first format. If the format does not match, a third exception is thrown to prompt the user to modify the content of the canvas corresponding to the content of the first preset level in the target mind map file. For example, based on the position of the content of the first preset level in the dictionary, the canvas corresponding to the content of the first preset level is determined, and the user is prompted to modify the content of the canvas.

[0072] In the embodiment of the present invention, when the acquisition of the branch of the dictionary fails, the reading of the content in the branch of the dictionary fails, and the content of the first preset level in the dictionary does not conform to the first format, an exception is thrown to prompt the user the cause and location of the mind map abnormality, the interface has interactivity, accurately locates the abnormal point, and improves the user experience.

[0073] Figure 2 is a flow chart of cyclically reading each branch content in the dictionary and writing the branch content into the test case table provided by an embodiment of the present invention, such as Figure 2 As shown, in one embodiment, the loop reads each branch content in the dictionary and writes the branch content into the test case table, including the following sub-steps:

[0074] Step 200: Determine a sub-dictionary corresponding to a canvas in the dictionary based on the number of branches at the first level in the dictionary.

[0075] Optionally, the dictionary uses a multi-layer array nesting method to store multiple key-value pairs. The number of branches at the first level in the dictionary is the number of canvases in the target mind map file. Each branch can determine a sub-dictionary, and each sub-dictionary corresponds to a canvas in the target mind map.

[0076] Step 201 , cyclically read the content of each branch of the sub-dictionary, and store the content of each branch in a test case table until the content of all branches in a sub-dictionary is read.

[0077] Optionally, the sub-dictionary includes multiple branches, each branch corresponds to a complete test case, the content of each branch is read, the content of the branch is stored in a variable, and then the content of the variable is written into the test case table until the content of all branches in a sub-dictionary is read.

[0078] Step 202: Continue to read the content of each branch of the next sub-dictionary until the content of the branches of all sub-dictionaries is read.

[0079] Optionally, continue to read the content of each branch of the next sub-dictionary until the content of all branches of the sub-dictionary is read. At this time, the content in the dictionary is read cyclically, and the content of the target mind map is all written into the test case table.

[0080] The embodiment of the present invention determines a sub-dictionary corresponding to each canvas in a dictionary, cyclically reads the content of a branch in each sub-dictionary until the content of the branches of all sub-dictionaries is read, writes the read content into a test case table, and converts the test case content in a target mind map file into a table form, thereby realizing automatic conversion of test cases and improving the conversion efficiency of test cases.

[0081] Figure 3 is a flow chart of cyclically reading the content of each branch of the sub-dictionary and storing the content of each branch in the test case table provided by an embodiment of the present invention, such as Figure 3 As shown, in one embodiment, the loop reads the content of each branch of the sub-dictionary and stores the content of each branch in the test case table, including the following sub-steps:

[0082] Step 300: Obtain a module name variable and a use case number variable according to the first level content in the sub-dictionary.

[0083] Optionally, the first level content in the sub-dictionary includes module name and use case number, and the module name and use case number are separated by a carriage return character. The module name and use case number are determined based on the position of the carriage return character, and the module name is stored in a module name variable, and the use case number is stored in a use case number variable.

[0084] Step 301: perform a second-level loop according to the number of first-level branches in the sub-dictionary, and save the second-level content into the use case input variable.

[0085] Optionally, the second level content in the sub-dictionary is use case input. It can be understood that there are multiple use case inputs corresponding to a module name at the first level. The number of branches at the first level is the number of use case inputs corresponding to the first level. Based on this number, the second level loop is performed and the second level content is saved in the use case input variable.

[0086] Step 302: Perform a third-level loop according to the number of second-level branches in the sub-dictionary, and save the third-level content into a temporary use case name variable.

[0087] Optionally, the contents from the third level to the penultimate level in the sub-dictionary are use case names. It can be understood that there are multiple use case names corresponding to one use case input of the second level, and the number of branches at the second level is the number of use case names corresponding to the second level. Based on this number, the third level is looped and the contents from the third level to the penultimate level are saved in a temporary use case name variable.

[0088] Step 303: concatenate the temporary use case name variables to obtain a use case name variable.

[0089] Optionally, the use case name occupies one or more levels, and the contents of each level are concatenated to obtain a complete use case name. Therefore, the contents of each level are first stored in a temporary use case name variable, and then the temporary use case name variables are concatenated to obtain a complete use case name and stored in the use case name variable.

[0090] Step 304: Save the content of the last level in the sub-dictionary into the expected output variable.

[0091] Optionally, the content of the last level in the sub-dictionary is the expected output, and the content of the last level is saved in the expected output variable.

[0092] Step 305: Write the contents of the module name variable, the use case number variable, the use case input variable, the use case name variable and the expected output variable into the test case table.

[0093] Optionally, the contents of the module name variable, the use case number variable, the use case input variable, the use case name variable and the expected output variable obtained in steps 300 to 304 are written into the test case table in a fixed order.

[0094] In an embodiment of the present invention, in the process of cyclically reading the content of each branch of the sub-dictionary, the first level content is first read to obtain the module name variable and the use case number variable, and then the second level loop is performed to obtain the use case input variable, followed by the third level loop to obtain a temporary use case name variable, and the temporary use case name variables are spliced ​​to obtain the use case name variable, and finally the expected output variable is obtained according to the content of the last level in the sub-dictionary, and the content of the variable is written into the test case table, thereby realizing the automatic conversion of the test case and improving the conversion efficiency of the test case.

[0095] In one embodiment, before obtaining the target mind map file according to the first input of the user and generating the test case table, the method further includes:

[0096] When receiving a first input from a user, performing a second verification on the first input by throwing an exception;

[0097] If the second verification fails, an exception is thrown to prompt the user of the reason for the exception, and the user's first input is received again until the second verification passes.

[0098] Optionally, based on the tkinter module in Python, an interactive window is developed for the user to make a first input. The user makes the first input in the window and clicks the submit button in the window. After the system receives the user's first input, it uses an exception throwing method to perform a second verification on the content of the first input. If the second verification fails, an exception is thrown according to the result of the second verification, and the user is prompted with the reason for the exception. The user can make the first input again in the window until the first input passes the second verification. This means that the target mind map file can be obtained according to the user's first input and a test case table can be generated. At this time, the system continues with subsequent test case conversion steps.

[0099] The embodiment of the present invention, before obtaining the target mind map file according to the user's first input and generating a test case table, also includes performing a second verification on the first input by throwing an exception, has interface interactivity, accurately locates the cause of the error, and improves the user experience.

[0100] In one embodiment, when the second verification fails, throwing an exception and prompting the user the cause of the exception includes:

[0101] In the case where the first input does not include the target path, a fourth exception is thrown to prompt the user to re-enter the target path;

[0102] In the case where the first input does not include the name of the test case form, throwing a fifth exception to prompt the user to re-enter the name of the test case form;

[0103] The target data table is created according to the name of the test case table in the first input. When the creation of the target data table fails, a sixth exception is thrown to prompt the user that the name format of the test case table is incorrect.

[0104] Optionally, the target path can be prompted in the window as a required option. The target path is the local storage path of the target mind map file. The system determines the location of the target mind map file based on the target path. If the target path is not included in the first input, a fourth exception is thrown to prompt the user to re-enter the target path.

[0105] The system creates a new test case form according to the name of the test case form. If the name of the test case form is not included in the first input, a fifth exception is thrown to prompt the user to re-enter the name of the test case form.

[0106] The system creates a new test case table according to the name of the test case table. The test case table can be an Excel file. If the name of the test case table includes special symbols, it will cause failure to create the target data table. Therefore, when the creation of the target data table fails, the sixth exception is thrown to prompt the user that the name format of the test case table is incorrect.

[0107] In the embodiment of the present invention, when the target path is not included in the first input, the name of the test case table is not included in the first input, and the creation of the target data table fails, the corresponding exception reasons are thrown out respectively, and the user is prompted. The interface has interactivity, accurately locates the cause of the error, and improves the user experience.

[0108] The test case automatic conversion device provided by the present invention is described below. The test case automatic conversion device described below and the test case automatic conversion method described above can be referenced to each other.

[0109] Figure 4 is a schematic diagram of the structure of the test case automatic conversion device provided by an embodiment of the present invention, such as Figure 4 As shown, the test case automatic conversion device includes an information acquisition module 410, a dictionary conversion module 420, a dictionary verification module 430 and a test case table content writing module 440, wherein:

[0110] The information acquisition module 410 is used to acquire the target mind map file according to the first input of the user and generate a test case table;

[0111] A dictionary conversion module 420, used to convert the target mind map file into a dictionary;

[0112] A dictionary verification module 430 is used to determine whether the mind map is abnormal by performing a first verification on the dictionary in a manner of throwing an exception;

[0113] The test case table content writing module 440 is used to cyclically read each branch content in the dictionary and write the branch content into the test case table when there is no abnormality in the first verification result.

[0114] Optionally, the dictionary verification module 430 is specifically configured to, when the branch of obtaining the dictionary fails, throw a first exception to prompt the user to re-enter the target mind map file;

[0115] Looping and reading each branch in the dictionary for a preset number of times, and in the case of failure to read the content in the branch, throwing a second exception to prompt the user that the use case design in the target mind map file is incomplete;

[0116] The content of the first preset level in the dictionary is obtained, and when the content of the first preset level does not conform to the first format, a third exception is thrown to prompt the user to modify the content of the canvas corresponding to the content of the first preset level in the target mind map file.

[0117] Optionally, the test case table content writing module 440 is specifically used to determine the sub-dictionary corresponding to the canvas in the dictionary based on the number of branches at the first level in the dictionary;

[0118] Circularly read the content of each branch of the sub-dictionary, and store the content of each branch in the test case table until the content of all branches in a sub-dictionary is read;

[0119] Continue to read the content of each branch of the next sub-dictionary until the contents of the branches of all sub-dictionaries are read.

[0120] Optionally, the loop reads the content of each branch of the sub-dictionary and stores the content of each branch in a test case table, including:

[0121] According to the content of the first level in the sub-dictionary, obtain the module name variable and the use case number variable;

[0122] According to the number of branches at the first level in the sub-dictionary, a second-level loop is performed, and the content of the second level is saved into the use case input variable;

[0123] According to the number of branches at the second level in the sub-dictionary, a third-level loop is performed, and the content at the third level is saved in a temporary use case name variable;

[0124] Concatenate the temporary use case name variables to obtain a use case name variable;

[0125] Save the contents of the last level in the sub-dictionary to the expected output variable;

[0126] The contents of the module name variable, the use case number variable, the use case input variable, the use case name variable and the expected output variable are written into the test case table.

[0127] Optionally, the test case automatic conversion device further comprises an input verification module, which is used to perform a second verification on the first input by throwing an exception when receiving the first input from the user;

[0128] If the second verification fails, an exception is thrown to prompt the user of the reason for the exception, and the user's first input is received again until the second verification passes.

[0129] Optionally, when the second verification fails, throwing an exception and prompting the user with the cause of the exception includes:

[0130] In the case where the first input does not include the target path, a fourth exception is thrown to prompt the user to re-enter the target path;

[0131] In the case where the first input does not include the name of the test case form, throwing a fifth exception to prompt the user to re-enter the name of the test case form;

[0132] The target data table is created according to the name of the test case table in the first input. When the creation of the target data table fails, a sixth exception is thrown to prompt the user that the name format of the test case table is incorrect.

[0133] The test case automatic conversion device provided by the present invention can realize Figures 1 to 3 The various processes implemented by the method embodiment and achieving the same technical effect are not described here to avoid repetition.

[0134] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the test case automatic conversion method, which includes:

[0135] Obtain the target mind map file according to the user's first input and generate a test case table;

[0136] Converting the target mind map file into a dictionary;

[0137] By throwing an exception, a first verification is performed on the dictionary to determine whether the mind map is abnormal;

[0138] When there is no abnormality in the first verification result, each branch content in the dictionary is read cyclically, and the branch content is written into the test case table.

[0139] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0140] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the test case automatic conversion method provided by the above methods, the method comprising:

[0141] Obtain the target mind map file according to the user's first input and generate a test case table;

[0142] Converting the target mind map file into a dictionary;

[0143] By throwing an exception, a first verification is performed on the dictionary to determine whether the mind map is abnormal;

[0144] When there is no abnormality in the first verification result, each branch content in the dictionary is read cyclically, and the branch content is written into the test case table.

[0145] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the above-mentioned test case automatic conversion method, the method comprising:

[0146] Obtain the target mind map file according to the user's first input and generate a test case table;

[0147] Converting the target mind map file into a dictionary;

[0148] By throwing an exception, a first verification is performed on the dictionary to determine whether the mind map is abnormal;

[0149] When there is no abnormality in the first verification result, each branch content in the dictionary is read cyclically, and the branch content is written into the test case table.

[0150] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0151] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A test case automatic conversion method, It is characterized in that include: Obtain the target mind map file according to the user's first input and generate a test case table; Converting the target mind map file into a dictionary; By throwing an exception, a first verification is performed on the dictionary to determine whether the mind map is abnormal; When the first verification result is normal, cyclically reading each branch content in the dictionary and writing the branch content into the test case table; The method of using an exception throwing method to first verify the dictionary to determine whether the mind map is abnormal includes: In the case of failure in acquiring the branch of the dictionary, throwing a first exception to prompt the user to re-enter the target mind map file; Looping and reading each branch in the dictionary for a preset number of times, and in the case of failure to read the content in the branch, throwing a second exception to prompt the user that the use case design in the target mind map file is incomplete; Obtaining content of a first preset level in the dictionary, and in the case where the content of the first preset level does not conform to a first format, throwing a third exception to prompt a user to modify content of a canvas corresponding to the content of the first preset level in the target mind map file; The loop reads each branch content in the dictionary and writes the branch content into the test case table, including: Determine, based on the number of branches at the first level in the dictionary, a sub-dictionary in the dictionary corresponding to the canvas; Circularly read the content of each branch of the sub-dictionary, and store the content of each branch in the test case table until the content of all branches in a sub-dictionary is read; Continue reading the contents of each branch of the next sub-dictionary until the contents of all branches of the sub-dictionary are read; The loop reads the content of each branch of the sub-dictionary and stores the content of each branch in the test case table, including: According to the content of the first level in the sub-dictionary, obtain the module name variable and the use case number variable; According to the number of branches at the first level in the sub-dictionary, a second-level loop is performed, and the content of the second level is saved into the use case input variable; According to the number of branches at the second level in the sub-dictionary, a third-level loop is performed, and the content at the third level is saved in a temporary use case name variable; Concatenate the temporary use case name variables to obtain a use case name variable; Save the contents of the last level in the sub-dictionary to the expected output variable; The contents of the module name variable, the use case number variable, the use case input variable, the use case name variable and the expected output variable are written into the test case table.

2. The test case automatic conversion method according to claim 1, It is characterized in that Before obtaining the target mind map file according to the first input of the user and generating the test case table, the method further includes: When receiving a first input from a user, performing a second verification on the first input by throwing an exception; If the second verification fails, an exception is thrown to prompt the user of the reason for the exception, and the user's first input is received again until the second verification passes.

3. The test case automatic conversion method according to claim 2, It is characterized in that When the second verification fails, throwing an exception and prompting the user the reason for the exception includes: In the case where the first input does not include the target path, a fourth exception is thrown to prompt the user to re-enter the target path; In the case where the first input does not include the name of the test case form, throwing a fifth exception to prompt the user to re-enter the name of the test case form; A target data table is created according to the name of the test case table in the first input. If the creation of the target data table fails, a sixth exception is thrown to prompt the user that the name format of the test case table is incorrect.

4. A test case automatic conversion device, It is characterized in that include: An information acquisition module, used to acquire a target mind map file according to a first input of a user and generate a test case table; A dictionary conversion module, used for converting the target mind map file into a dictionary; A dictionary verification module, used to determine whether the mind map is abnormal by performing a first verification on the dictionary in a manner of throwing an exception; A test case table content writing module, used for cyclically reading each branch content in the dictionary and writing the branch content into the test case table when there is no abnormality in the first verification result; The method of using an exception throwing method to first verify the dictionary to determine whether the mind map is abnormal includes: In the case of failure in acquiring the branch of the dictionary, throwing a first exception to prompt the user to re-enter the target mind map file; Looping and reading each branch in the dictionary for a preset number of times, and in the case of failure to read the content in the branch, throwing a second exception to prompt the user that the use case design in the target mind map file is incomplete; Obtaining content of a first preset level in the dictionary, and in the case where the content of the first preset level does not conform to a first format, throwing a third exception to prompt a user to modify content of a canvas corresponding to the content of the first preset level in the target mind map file; The loop reads each branch content in the dictionary and writes the branch content into the test case table, including: Determine, based on the number of branches at the first level in the dictionary, a sub-dictionary in the dictionary corresponding to the canvas; Circularly read the content of each branch of the sub-dictionary, and store the content of each branch in the test case table until the content of all branches in a sub-dictionary is read; Continue reading the contents of each branch of the next sub-dictionary until the contents of all branches of the sub-dictionary are read; The loop reads the content of each branch of the sub-dictionary and stores the content of each branch in the test case table, including: According to the content of the first level in the sub-dictionary, obtain the module name variable and the use case number variable; According to the number of branches at the first level in the sub-dictionary, a second-level loop is performed, and the content of the second level is saved into the use case input variable; According to the number of branches at the second level in the sub-dictionary, a third-level loop is performed, and the content at the third level is saved in a temporary use case name variable; Concatenate the temporary use case name variables to obtain a use case name variable; Save the contents of the last level in the sub-dictionary to the expected output variable; The contents of the module name variable, the use case number variable, the use case input variable, the use case name variable and the expected output variable are written into the test case table.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps of the test case automatic conversion method as described in any one of claims 1 to 3 are implemented.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the test case automatic conversion method as claimed in any one of claims 1 to 3 are implemented.

7. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the test case automatic conversion method as claimed in any one of claims 1 to 3 are implemented.