Bidirectional conversion method and storage medium between script and use case

Through the two-way conversion method between scripts and use cases, the problem of inefficient writing of test cases and test scripts is solved, automatic conversion and batch association between use cases and scripts is realized, and writing efficiency is improved.

CN114328239BActive Publication Date: 2025-02-07ZHEJIANG LIANYUN ZHIHUI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111646759.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-02-07
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the prior art, the writing efficiency of test cases and test scripts is inefficient, and they need to be written separately and related, which affects the overall writing efficiency.

Method used

Provides a two-way conversion method between scripts and use cases, enters the use case conversion mode or script conversion mode through operation instructions, obtains and converts use case information or script code snippets, and realizes automatic conversion and batch association between use cases and scripts.

Benefits of technology

It realizes two-way automatic conversion between test cases and test scripts, simplifies the writing process, improves writing efficiency, and supports batch association, improving overall efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328239B_ABST
    Figure CN114328239B_ABST
Patent Text Reader

Abstract

The present application discloses a bidirectional conversion method and storage medium between scripts and use cases, and relates to the technical field of software programming, including the following steps: entering a use case conversion mode or a script conversion mode based on an operation instruction; in the use case conversion mode: determining a first type of script function according to a description type name, and forming a first type of code snippet according to the corresponding first type of script function and the corresponding description content; determining a second type of script function according to an execution type name, and forming a script code string according to the execution content and the corresponding second type of script function, and forming a second type of code snippet with the script code string corresponding to the same step sequence number, and each second type of code snippet has a sequence number information corresponding to the step sequence number. Test cases and scripts can be automatically converted in both directions, simplifying the writing of test cases or scripts, and being able to realize batch association between test cases and test scripts, so that the writing efficiency of test cases and scripts is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software programming, and in particular to a method for bidirectional conversion between scripts and use cases. Background Art

[0002] A test case is a description of a test task for a specific software product. A test script is a computer-readable instruction that automatically executes the test process (or part of the test process).

[0003] The common method of writing test cases and test scripts now is to first create, edit and archive the test cases in text form, and then use specific software to complete the writing of automated test scripts.

[0004] This common approach separates the use case and the script, and requires the association between the use case and the script to be established after the script is written, which affects the overall writing efficiency. Summary of the invention

[0005] In order to improve writing efficiency, the present application provides a bidirectional conversion method and storage medium for scripts and use cases.

[0006] In the first aspect, the present application provides a method for bidirectional conversion between scripts and use cases, which adopts the following technical solution:

[0007] A bidirectional conversion method between a script and a use case includes the following steps:

[0008] Enter the use case conversion mode or script conversion mode based on the operation instructions;

[0009] In use case conversion mode:

[0010] Acquire use case information, wherein the use case information includes a description type name, description content corresponding to the description type name, and a step number, each step number corresponds to a number of execution type names; each execution type name corresponds to an execution content;

[0011] Determine a first-class script function according to the description type name, and form a class of code snippets according to the corresponding first-class script function and the corresponding description content;

[0012] Determine the second-class script function according to the execution type name, and form a script code string according to the execution content and the corresponding second-class script function, and form the script code string corresponding to the same step number into two-class code fragments, and each second-class code fragment has serial number information corresponding to the step number;

[0013] In script conversion mode:

[0014] Get the script code snippet;

[0015] Identify the first-class script function, description content, second-class script function, execution content and sequence number information from the script code snippet;

[0016] A corresponding use case is formed based on the first-category script function, description content, second-category script function, execution content and serial number information.

[0017] By adopting the above technical solution, test cases and scripts can be automatically converted in both directions, simplifying the writing of test cases or scripts, and can achieve batch association between test cases and test scripts, thereby improving the writing efficiency of test cases and scripts.

[0018] Optionally, the second type of script functions includes step functions and result functions;

[0019] The execution content includes the control ID, execution action, result ID and result content;

[0020] The step function corresponds to the control ID and the execution action, and the result function corresponds to the result ID and the result content;

[0021] The script code string is formed according to the execution content and the corresponding second-type script function, including the following steps:

[0022] If the second type of script function is a step function, a script code string is generated according to the control corresponding to the control ID triggered by the execution action;

[0023] If the second type of script function is a result function, a script code string is generated to display the corresponding result content according to the control corresponding to the result ID;

[0024] Arrange the script code string corresponding to the step function before the script code string corresponding to the result function of the same step number.

[0025] Optionally, if the second type of script function is a step function, before generating a script code string of a control corresponding to the control ID triggered by the execution action, the following steps are included:

[0026] Determine whether the control ID and execution action of the same step number correspond;

[0027] If the control ID and execution action of the same step number do not correspond, the corresponding description segment is extracted from the description content according to the step number, and it is determined whether there is a description word corresponding to the control ID or execution action in the description segment;

[0028] If there are description words corresponding to the control ID or the execution action in the description fragment, the preset execution content is determined according to the description words in the description fragment, and the use case is corrected according to the preset execution content.

[0029] Optionally, before determining whether the control ID and the execution action of the same step number correspond, the following steps are included:

[0030] Determine whether the information in the specified area corresponding to the test step can be matched to the corresponding control ID or execution action from the preset control database;

[0031] If the information in the designated area corresponding to the test step can be matched to the corresponding control ID or execution action from the preset control database, then determine whether the control ID and execution action of the same step number correspond;

[0032] If the information in the designated area corresponding to the test step cannot be completely matched to the corresponding control ID or execution action from the preset control database, the information in the designated area that cannot be matched is corrected.

[0033] Optionally, the information of the specified area that cannot be matched is corrected, including the following steps:

[0034] Determine whether the information of the designated area that cannot be matched currently can be matched to error-prone words from a preset correction database;

[0035] If the information in the designated area can be matched to an error-prone word from a preset correction database, the control ID or execution action corresponding to the error-prone word will replace the information in the current designated area.

[0036] Optionally, the conversion method further includes the following steps:

[0037] Whenever you enter the use case conversion mode or script conversion mode, the current use case or script is automatically stored;

[0038] When entering the use case conversion mode or the script conversion mode, determine whether there are any stored use cases / scripts.

[0039] If there is a stored use case / script, the current use case / script is matched with the stored use case / script to determine the difference information, and the script / use case is modified only according to the difference information;

[0040] If there is no stored use case / script, the complete use case / script is converted into the corresponding script / use case.

[0041] Optionally, identifying serial number information from the script code includes the following steps:

[0042] Determine whether all the identified serial number information is continuous.

[0043] If the serial number information is not continuous, a virtual serial number is generated based on the missing serial number information; when forming the corresponding use case, the corresponding designated area is generated based on the step serial number and the virtual serial number and the designated area is sorted in serial number order, wherein the designated area corresponding to the virtual serial number has no content, and the designated area corresponding to the step serial number is filled with the corresponding execution content.

[0044] In a second aspect, the present application provides a computer-readable storage medium storing a computer program that can be loaded by a processor and execute any of the above-mentioned methods for bidirectional conversion between scripts and use cases.

[0045] To summarize, the present application includes at least one of the following beneficial technical effects: test cases and scripts can be automatically converted in both directions, simplifying the writing of test cases or scripts, and being able to achieve batch association between test cases and test scripts, thereby improving the efficiency of writing test cases and scripts. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is an overall flow chart of the conversion method of the embodiment of the present application.

[0047] Figure 2 It is a flowchart in the use case conversion mode of an embodiment of the present application.

[0048] Figure 3 It is a schematic diagram of a use case table of an embodiment of the present application.

[0049] Figure 4 It is a schematic diagram of a partial use case table filled with descriptive content of an embodiment of the present application.

[0050] Figure 5 It is a schematic diagram of a partial use case table filled with execution content in an embodiment of the present application.

[0051] Figure 6 It is a flowchart in the script conversion mode of an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following is combined with Figures 1 to 6 This application is described in further detail.

[0053] The present application embodiment discloses a bidirectional conversion method between scripts and use cases. Figure 1 , including the following steps:

[0054] S100: Entering a use case conversion mode or a script conversion mode based on an operation instruction.

[0055] The operation instruction is generated by triggering the preset "use case conversion" virtual key or "script conversion" virtual key in the program for writing scripts and use cases. Depending on the trigger key, the operation instruction generated by the program is also different.

[0056] The use case conversion mode and the script conversion mode are both working modes of the server for automatically converting scripts and use cases.

[0057] When the "Use Case Conversion" virtual button is clicked, the program generates a first operation instruction, the server enters the use case conversion mode according to the first operation instruction, and executes steps S200 to S400 to automatically create a corresponding script according to the use case.

[0058] When the "Script Conversion" virtual button is clicked, the program generates a second operation instruction. The server enters the script conversion mode according to the second operation instruction and executes steps S500 to S700 to automatically create a corresponding use case according to the script.

[0059] In the use case conversion mode, see Figure 2 , automatically creating the corresponding script according to the use case includes the following steps:

[0060] S200. Obtain use case information.

[0061] The use case information includes a description type name, description content corresponding to the description type name, and a step number. Each step number corresponds to a number of execution type names; each execution type name corresponds to an execution content.

[0062] In order to automatically convert use cases into scripts, the writing of use cases is regulated and a use case table is developed, such as Figure 3 When writing a use case, the user needs to fill in the corresponding use case content in the designated area of ​​the use case table.

[0063] See also Figure 3 ,The objects that need to be filled in the use case table include the use case number, title, description, test steps, waiting time and expected results.

[0064] Among them, the use case number, title and description correspond to a designated area respectively. When any information is filled in the corresponding designated area, in the use case conversion mode, the server will extract the corresponding name as the description type name, and the filled content is the corresponding description content.

[0065] The designated areas corresponding to the test steps, waiting times, and expected results are related to the step numbers. The more step numbers there are, the more designated areas corresponding to the test steps, waiting times, and expected results there are. For example, when there are 3 step numbers, the test steps, waiting times, and expected results correspond to three rows of designated areas, respectively, and the designated areas in the same row correspond to the same step number by default. In addition, in this embodiment, the designated area in the first row corresponds to step number 1 by default, the designated area in the second row corresponds to step number 2, and so on, so there is no need to additionally indicate the step number in the use case table.

[0066] When any information is filled in any designated area corresponding to the test step, waiting time and expected result, in the use case conversion mode, the server will extract the name corresponding to the designated area where the information is located as the execution type name, the row number of the designated area where the information is located as the step number, and the information itself as the execution content.

[0067] The use case number can be the time information automatically captured when the use case table is created, or it can be the information filled in by the user. As long as the use case number is unique, it can correspond to the script one by one.

[0068] It should be noted that when writing the use case first and then converting the script, in addition to the use case number, which can automatically generate information, the title, description, test steps, waiting time and expected results all need to be filled in by the user. However, if there is no information in the designated area corresponding to the waiting time, that is, the user has not filled in the waiting time, the server will use the preset waiting time as the execution content, and if there is no information in the designated areas corresponding to the other names, the server will not extract the corresponding information and corresponding names. For example, assuming that the preset waiting time is 5s, when there is no information in the designated areas corresponding to the waiting time and the title, the use case information extracted by the server includes the execution type name "waiting time" and the execution content "5", and of course the step number corresponding to the execution content "5"; but it will not include the description type name "title".

[0069] S300. Determine a first-class script function according to the description type name, and form a class of code snippets according to the corresponding first-class script function and the corresponding description content.

[0070] Each description type name corresponds to a first-class script function, and the corresponding relationship between the description type name and the first-class script function is pre-stored in the database.

[0071] Specifically, when the description type name is number, the corresponding first-class script function is @testcase id; when the description type name is title, the corresponding first-class script function is @testcase.title; when the description type name is description, the corresponding first-class script function is @testcase.description.

[0072] The format of a code snippet is: first-class script function ('description content').

[0073] by Figure 4 Take the use case in as an example, the converted script is:

[0074] @testcase.id( '20211001101059' )

[0075] @testcase.title('Transfer station 001 product confirmed for shipment')

[0076] @testcase.description('Click the button for item 001 in the transfer station, then click the confirmation button in the pop-up window. The text "Item 001 has been shipped" will appear within 5 seconds').

[0077] S400. Determine the second-category script function according to the execution type name, and form a script code string according to the execution content and the corresponding second-category script function, and organize the script code strings corresponding to the same step number into two-category code fragments, and each of the second-category code fragments has serial number information corresponding to the step number.

[0078] Each execution type name corresponds to a second-class script function, and the corresponding relationship between the execution type name and the second-class script function is pre-stored in the database.

[0079] The second type of script functions includes step functions, duration functions and result functions, wherein the step functions correspond to test steps, the duration functions correspond to waiting time, and the result functions correspond to expected results.

[0080] Specifically, the step function is @testcase.step; the duration function is @testcase.timeout; and the result function is @testcase.assert.

[0081] In addition, different execution type names correspond to different ways of generating the second type of code snippets.

[0082] When the execution type name is waiting time, the corresponding second-category code snippet format is:

[0083] @testcase.timeout('wait time').

[0084] When the execution type name is test step, there are three corresponding execution contents, which are the sequence number value representing the step sequence number, the control ID representing the execution control, and the execution action corresponding to the execution control. Different control IDs correspond to different buttons, texts or radio buttons, and correspondingly, the execution actions correspond to click, input and check. The corresponding second type of code snippet format is:

[0085] @testcase.step('serial value')

[0086] self.agent.ExecuteAction('ControlID').

[0087] When the execution type name is expected result, there are two corresponding execution contents, namely, result ID representing text format and result content corresponding to text. Result ID can be a preset text name in various forms, such as bidirectional conversion method t_A between Te script and use case, bidirectional conversion method t_B between Te script and use case, etc. The corresponding second type of code snippet format is:

[0088] @testcase.assert(id='result ID', bidirectional conversion method between te script and use case t='result content').

[0089] by Figure 5 Take the use case in as an example, the converted script is:

[0090] @testcase.step('1')

[0091] self.agent.click('Button001')

[0092] @testcase.step('2')

[0093] self.agent.click('Button002')

[0094] testcase.timeout('5')

[0095] self.agent.assert(id='Bidirectional conversion method between Te script and use case t_B', Bidirectional conversion method between te script and use case t='Product No. 001 has been shipped').

[0096] In one embodiment, forming a script code string according to the execution content and the corresponding second-type script function includes the following steps:

[0097] S410: If the second type of script function is a step function, generate a script code string for triggering a control corresponding to the control ID according to the execution action.

[0098] S420: If the second type of script function is a result function, generate a script code string for displaying corresponding result content according to the control corresponding to the result ID.

[0099] S430: If the second type of script function is a duration function, generate a script code string for delaying code execution according to the waiting duration.

[0100] S440. Arrange the script code string corresponding to the step function before the script code string corresponding to the duration function under the same step number, and arrange the script code string corresponding to the duration function before the script code string corresponding to the result function under the same step number.

[0101] In one embodiment, if the second type of script function is a step function, before generating a script code string for triggering a control corresponding to a control ID according to an execution action, the following steps are included:

[0102] S411. Determine whether the control ID and execution action of the same step number correspond.

[0103] The control corresponding to each control ID is preset with a corresponding execution action. To determine whether the control ID and execution action of the same step number correspond, refers to comparing whether the execution action preset for the current control ID is consistent with the current execution action.

[0104] S412: If the control ID and the execution action of the same step number correspond, a script code string is generated for triggering the control corresponding to the control ID according to the execution action.

[0105] S413. If the control ID and execution action of the same step number do not correspond, extract the corresponding description segment from the description content according to the step number, and determine whether there is a description word corresponding to the control ID or execution action in the description segment.

[0106] When writing a use case, the user should try to write the description in a positive order, and use punctuation marks such as commas, periods, and semicolons to distinguish each step. Select the corresponding short sentence in the description according to the step number to form a description fragment.

[0107] The reason for judging whether there are description words corresponding to the control ID or execution action in the description segment is that each control ID and execution action has a number of preset natural language words. For example, when the control ID is Button, the corresponding natural language words include key and button; when the execution action is click, the corresponding natural language words are click, press, and touch. As long as there are preset natural language words in the description words, the server can identify these words to determine the corresponding control ID and / or execution action.

[0108] S414: If there are description words corresponding to the control ID or the execution action in the description segment, the preset execution content is determined according to the description words in the description segment, and the use case is modified according to the preset execution content.

[0109] If there is no description word corresponding to the control ID or the execution action in the description segment, a reminder message is issued to prompt the user to pay attention to the description word, control ID and execution action.

[0110] If there are description words corresponding to the control ID or execution action in the description segment, and the description words in the description segment can correspond to each other, the corresponding execution content is modified, and step S500 is executed. The modification method is to replace the current execution content with the preset execution content.

[0111] For example, the control ID is textbox, the execution action is click, and the corresponding description fragment is "Click the button of product No. 001 at the transfer station". Based on the description fragment, the server recognizes "click" and "button", among which "click" corresponds to the execution action, while "button" does not correspond to the control ID, and "click" and "button" correspond to each other. Therefore, it is determined that the current control ID is incorrect, and the Button corresponding to "button" replaces textbox.

[0112] It should be noted that the premise for determining whether the control ID and execution action of the same step number correspond is that the information in the corresponding designated area can be confirmed as the control ID and execution action.

[0113] Therefore, before determining whether the control ID and execution action of the same step number correspond, first make the following determination:

[0114] S415, respectively determining whether the information in the designated area corresponding to the test step can be matched to a corresponding control ID or execution action from a preset control database.

[0115] S416: If the information in the designated area corresponding to the test step can be matched to the corresponding control ID or execution action from the preset control database, execute step S410.

[0116] S417. If the information in the designated area corresponding to the test step cannot be completely matched to the corresponding control ID or execution action from the preset control database, it is further determined whether the information in the designated area that cannot be matched can be matched to error-prone words from the preset correction database.

[0117] The control database stores various control IDs and names of actions, such as Button, textbox, click, etc. The correction database stores correct control IDs, names of actions, and multiple easy-to-make mistakes words. Each space ID and action corresponds to several easy-to-make mistakes words, for example, Button corresponds to Buton, Buttion, Buutton, etc.

[0118] S418: If the information in the designated area can be matched to an error-prone word from the preset correction database, the control ID or execution action determined by the error-prone word replaces the information in the current designated area, and step S410 is executed.

[0119] If the information in the designated area cannot be matched to error-prone words in the preset correction database, a prompt is issued to remind the user to manually check.

[0120] In script conversion mode, see Figure 6 , automatically creating the corresponding use case according to the script includes the following steps:

[0121] S500: Obtain a script code snippet.

[0122] S600, identifying a first-category script function, description content, a second-category script function, execution content, and sequence number information from a script code fragment.

[0123] In addition to the serial number information, the first-category script function, description content, second-category script function, and execution content can be obtained based on the generation format of the script code string.

[0124] Identifying serial number information from script code includes the following steps: determining whether all identified serial number information are continuous, determining whether the serial number information are continuous; if the serial number information are not continuous, generating a virtual serial number based on the missing serial number information; when forming a corresponding use case, generating a corresponding designated area based on the step serial number and the virtual serial number, and sorting the designated area in serial number order, wherein the designated area corresponding to the virtual serial number has no content, and the designated area corresponding to the step serial number is filled with corresponding execution content.

[0125] For example, if only @testcase.step('1') and @testcase.step('3') exist in the script, a virtual sequence number "2" is generated.

[0126] S700. Form a corresponding use case based on the first-type script function, description content, second-type script function, execution content and serial number information.

[0127] After obtaining the sequence number information (including virtual sequence numbers), the server automatically creates a use case table with the corresponding number of rows based on the number of sequence number information.

[0128] Then, the designated area that needs to be filled in with the corresponding description content is determined through the first type of script function, and the designated area that needs to be filled in with the corresponding execution content is determined through the second type of script function and the serial number information.

[0129] The above steps S200 to S700 all introduce the conversion method from the perspective of converting a use case into a script for the first time, or converting a script into a use case for the first time. When part of the content in a use case or script is modified, added or deleted, but the rest of the content remains unchanged, if the entire use case or script is still converted, it will take more time and computing power once the overall content of the use case or script is large. Therefore, after completing the first conversion, if part of the content is modified, added or deleted again, only the part of the content should be converted synchronously. The specific method is as follows:

[0130] Whenever you enter the use case conversion mode or script conversion mode, the current use case or script is automatically stored.

[0131] When entering the use case conversion mode, determine whether there is a stored use case. If there is a stored use case, match the current use case with the stored use case to determine the difference information, and modify the script only based on the difference information.

[0132] Accordingly, when entering the script conversion mode, it is determined whether there is a stored script. If there is a stored script, the current script is matched with the stored script to determine the difference information, and the use case is modified only according to the difference information.

[0133] Difference information includes added information, deleted information and replaced information.

[0134] Since the use case uses a relatively fixed use case table to record information, the number of rows in the use case table will only change when the sequence number information increases or decreases. As for the addition, modification or deletion of information in other specified areas, it will not affect the overall format of the use case table. Modifying the script is more complicated.

[0135] Modify the script according to the difference information, including the following steps:

[0136] If the difference information is added information, then directly add the script code string corresponding to the added information at the end of the script, and according to the current line number of the script code string.

[0137] If the difference information is replacement information, the original script code string is replaced with the script code string generated by the difference information.

[0138] If the difference information is deleted information, a blank line is used to replace the script code string corresponding to the deleted information to retain the number of blank lines in the corresponding area.

[0139] The reason for adopting the above modification method is to reduce the changes in the number of script code lines. The reason for changing the number of code lines as little as possible is that when each script code string is generated, its area is recorded by recording the starting line and the ending line, so as to quickly query the corresponding script code string.

[0140] When the number of lines of the script code string generated by the replacement information is less than the number of lines of the original script code string, the difference in lines is replaced by blank lines.

[0141] When the number of lines of the script code string generated by the replacement information is more than the number of lines of the original script code string, only the area where the current script code string and other subsequent script code strings are located can be re-recorded.

[0142] An embodiment of the present application also provides a computer-readable storage medium storing a computer program that can be loaded by a processor and execute any of the above-mentioned methods for bidirectional conversion between scripts and use cases.

[0143] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A bidirectional conversion method between scripts and use cases, characterized in that: The following steps are involved: Enter the use case conversion mode or script conversion mode based on the operation instructions; In use case conversion mode: Acquire use case information, wherein the use case information includes a description type name, description content corresponding to the description type name, and a step number, each step number corresponds to a number of execution type names; each execution type name corresponds to an execution content; Determine a first-class script function according to the description type name, and form a class of code snippets according to the corresponding first-class script function and the corresponding description content; Determine the second-class script function according to the execution type name, and form a script code string according to the execution content and the corresponding second-class script function, and form the script code string corresponding to the same step number into two-class code fragments, and each second-class code fragment has serial number information corresponding to the step number; In script conversion mode: Get the script code snippet; Identify the first-class script function, description content, second-class script function, execution content and sequence number information from the script code snippet; According to the first-class script function, description content, the second-class script function, execution content and sequence number information, a corresponding use case is formed; The second type of script functions includes step functions and result functions; The execution content includes the control ID, execution action, result ID and result content; The step function corresponds to the control ID and the execution action, and the result function corresponds to the result ID and the result content; The script code string is formed according to the execution content and the corresponding second-type script function, including the following steps: If the second type of script function is a step function, a script code string is generated according to the control corresponding to the control ID triggered by the execution action; If the second type of script function is a result function, a script code string is generated to display the corresponding result content according to the control corresponding to the result ID; Arrange the script code string corresponding to the step function before the script code string corresponding to the result function of the same step number.

2. The method for bidirectional conversion between scripts and use cases according to claim 1, characterized in that: If the second type of script function is a step function, before generating a script code string for the control corresponding to the control ID triggered by the execution action, the following steps are included: Determine whether the control ID and execution action of the same step number correspond; If the control ID and execution action of the same step number do not correspond, the corresponding description segment is extracted from the description content according to the step number, and it is determined whether there is a description word corresponding to the control ID or execution action in the description segment; If there are description words corresponding to the control ID or the execution action in the description fragment, the preset execution content is determined according to the description words in the description fragment, and the use case is corrected according to the preset execution content.

3. The method for bidirectional conversion between scripts and use cases according to claim 2, characterized in that: Before determining whether the control ID and execution action of the same step number correspond, the following steps are included: Determine whether the information in the specified area corresponding to the test step can be matched to the corresponding control ID or execution action from the preset control database; If the information in the designated area corresponding to the test step can be matched to the corresponding control ID or execution action from the preset control database, then determine whether the control ID and execution action of the same step number correspond; If the information in the designated area corresponding to the test step cannot be completely matched to the corresponding control ID or execution action from the preset control database, the information in the designated area that cannot be matched is corrected.

4. The method for bidirectional conversion between scripts and use cases according to claim 3, characterized in that: Correcting the information of the specified area that cannot be matched currently includes the following steps: Determine whether the information of the designated area that cannot be matched currently can be matched to error-prone words from a preset correction database; If the information in the designated area can be matched to an error-prone word from a preset correction database, the control ID or execution action corresponding to the error-prone word will replace the information in the current designated area.

5. The method for bidirectional conversion between scripts and use cases according to claim 1, characterized in that: The conversion method further comprises the following steps: Whenever you enter the use case conversion mode or script conversion mode, the current use case or script is automatically stored; When entering the use case conversion mode or the script conversion mode, determine whether there are any stored use cases / scripts. If there is a stored use case / script, the current use case / script is matched with the stored use case / script to determine the difference information, and the script / use case is modified only according to the difference information; If there is no stored use case / script, the complete use case / script is converted into the corresponding script / use case.

6. The method for bidirectional conversion between scripts and use cases according to claim 1, characterized in that: Identifying serial number information from the script code includes the following steps: Determine whether all the identified serial number information is continuous. If the serial number information is not continuous, a virtual serial number is generated based on the missing serial number information; when forming the corresponding use case, the corresponding designated area is generated based on the step serial number and the virtual serial number and the designated area is sorted in serial number order, wherein the designated area corresponding to the virtual serial number has no content, and the designated area corresponding to the step serial number is filled with the corresponding execution content.

7. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and executes the method for bidirectional conversion between a script and a use case as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automatic script conversion method and device, computer equipment and storage medium

    CN109815127A

  • Generating executable test automation code automatically according to a test case

    US20200019492A1