Automatic script generation method and device, equipment, medium and program product

By determining key feature fields and labels in the automated testing framework, parsing the target map files in the Xmind tool and storing them in the database, and generating automated scripts, it solves the problem of inconsistent writing of test cases and low efficiency in generating automated scripts, and realizes efficient and accurate test case conversion and automated script generation.

CN119807023APending Publication Date: 2025-04-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411683182.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, the test case writing methods are not uniform, and the generation efficiency of automated scripts is low.

Method used

By determining the key element fields and labels of the automation script based on the automation testing framework in advance, obtain the target map file in the Xmind tool, parse and store it in the database, and generate the target automation script.

Benefits of technology

It realizes standardized test case writing, improves the efficiency of automated script generation, reduces manual input workload, and improves the accuracy and speed of test case conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807023A_ABST
    Figure CN119807023A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of automatic testing, and discloses an automatic script generation method and device, equipment, a medium and a program product. The method comprises the following steps: determining a key element field of an automatic script in advance according to an automatic test framework, and determining a key element tag corresponding to the key element field so as to determine a test case writing specification; obtaining a target mapping file obtained by inputting the key element data according to the key element label corresponding to the key element field in the Xmind tool; importing the target map file, analyzing the target map file to obtain target element data, and storing the target element data into a database; each piece of use case data in the database comprises a use case number, a conversion state and target element data corresponding to the use case number; and reading the target use case data in the database to generate a target automatic script. According to the method, the key element fields and the corresponding key element labels of the scripts are determined in advance, and a set of standardized test case writing specifications is established.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to an automated script generation method, device, equipment, medium and program product. Background Art

[0002] With the continuous development of software development, testing work plays a vital role in the software development process. Test cases are the core of testing work and are used to verify the functions, performance and stability of the software. As a powerful mind mapping tool, Xmind can help testers manage test cases more efficiently. Xmind has a wealth of graphical tools that make test case writing simple and intuitive, but there are also some problems in actual application scenarios. For example, when testers use Xmind to write test cases, the test cases written by different testers are usually different, lacking standardized writing formats and specifications. After testers finish writing test cases in Xmind, they need to further write scripts to convert test cases into executable automated scripts. There is a certain degree of duplication of work, and the efficiency of automated script writing is low.

[0003] Therefore, there is an urgent need for a standardized and unified way of writing test cases and a technical solution to improve the efficiency of generating automated scripts. Summary of the invention

[0004] Therefore, the technical problem to be solved by the present invention is to overcome the problems of inconsistent use case writing methods and low efficiency in generating automated scripts in related technologies.

[0005] In order to solve the above technical problems, the present invention provides an automated script generation method, which comprises:

[0006] Determine the key element fields of the automation script in advance according to the automation test framework, determine the key element tags corresponding to the key element fields, and determine the test case writing specifications; the key element fields include: use case name, use case tag, use case level, use case description, interface name, interface path, request method, input data and expected results;

[0007] Obtain a target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool;

[0008] Import the target map file, parse the target map file, obtain target element data, and store the target element data in a database; the target element data is key element data in a preset format; the database includes at least one use case data, each use case data includes a use case number, a conversion state and the target element data corresponding to the use case number; the conversion state includes a converted state, an unconverted state and a conversion failure state;

[0009] The target use case data in the database is read to generate a target automation script, wherein the conversion state of the target use case data is an unconverted state.

[0010] In an optional implementation, when the preset format is JSON format, parsing the target map file, obtaining target element data, and storing the target element data in a database includes:

[0011] Convert the target map file into a JSON data dictionary;

[0012] Parsing the JSON data dictionary to obtain the target element data;

[0013] The target element data is stored in a database according to the use case dimension.

[0014] In an optional implementation, the step of reading the target use case data in the database to generate a target automation script includes:

[0015] Determine the target file path of the target automation script;

[0016] The target use case data in the database is read to generate a target automation script in the target file path.

[0017] In an optional implementation, the step of reading the target use case data in the database and generating a target automation script in the target file path includes:

[0018] According to the input target interface name, the use case data whose conversion state is unconverted and whose interface name is the target interface name is read from the database is determined as the target use case data, and a target automation script is generated according to the target use case data based on preset script generation rules.

[0019] In an optional implementation, after reading the target use case data in the database to generate the target automation script, the method further includes:

[0020] The target automation script is executed to obtain actual test results, and the actual test results are stored in the database.

[0021] In an optional implementation, after storing the actual test results in the database, the method further includes: generating an automated test report.

[0022] In a second aspect, the present invention provides an automated script generation device, the automated script generation device comprising:

[0023] The first processing module is used to determine the key element fields of the automation script in advance according to the automation test framework, and determine the key element tags corresponding to the key element fields to determine the test case writing specifications; the key element fields include: use case name, use case tag, use case level, use case description, interface name, interface path, request method, input data and expected results;

[0024] The second processing module is used to obtain a target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool;

[0025] The third processing module is used to import the target map file, parse the target map file, obtain target element data, and store the target element data in a database; the target element data is key element data in a preset format; the database includes at least one use case data, each use case data includes a use case number, a conversion state and the target element data corresponding to the use case number; the conversion state includes a converted state, an unconverted state and a conversion failure state;

[0026] The fourth processing module is used to read the target use case data in the database to generate a target automation script, and the conversion state of the target use case data is an unconverted state.

[0027] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the automated script generation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0028] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a single computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the automated script generation method of the above-mentioned first aspect or any corresponding embodiment thereof.

[0029] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the automated script generation method of the first aspect or any corresponding embodiment thereof.

[0030] The technical solution provided by the present invention has the following technical effects:

[0031] The technical solution of the embodiment of the present invention determines the key element fields of the automation script according to the automation test framework in advance, determines the key element tags corresponding to the key element fields, and determines the test case writing specifications; establishes a set of standardized test case writing specifications, which helps to ensure the consistency and integrity of the test cases. The Xmind tool is used to input the key element data according to the key element tags to form a target map file. This method can intuitively organize and display test cases, which is convenient for management and maintenance. By importing and parsing the target map file, the target element data is automatically obtained and stored in the database. This process reduces the workload of manual input and improves the efficiency and accuracy of test case conversion. The conversion status (converted and unconverted) of the case data in the database makes the state management of the test case more flexible. The test team can quickly identify and process the test cases that have not been converted according to the status. The target automation script can be automatically generated according to the test case data in the unconverted state. This automated script generation mechanism improves the speed and efficiency of test script creation. The present invention mainly solves the problem that test cases and automation scripts need to be written separately in fast iteration projects, realizes the function of directly converting from test cases to automation scripts, solves the problem that the original test cases and automation scripts need to be written and maintained separately, and effectively improves the efficiency of automation script writing. The present invention realizes the direct association between test cases and automation scripts through the conversion between test cases and automation cases, which is convenient for the later statistics of script conversion rate, test pass rate, etc., making the test execution result more intuitive. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0033] Figure 1 is a flowchart of an automated script generation method according to an embodiment of the present invention;

[0034] Figure 2 is a schematic diagram of a target map file according to an embodiment of the present invention;

[0035] Figure 3 is a schematic diagram of an operation interface for file uploading and script generation according to an embodiment of the present invention;

[0036] Figure 4 is a schematic diagram of a target automation script according to an embodiment of the present invention;

[0037] Figure 5 is a schematic diagram of specific contents of a target automation script according to an embodiment of the present invention;

[0038] Figure 6 is a flowchart of another automatic script generation method according to an embodiment of the present invention;

[0039] Figure 7 is a schematic diagram of the structure of an automatic script generation device according to an embodiment of the present invention;

[0040] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0042] Xmind has a wealth of graphical tools that make test case writing simple and intuitive, but there are also some problems in actual application scenarios:

[0043] (1) Testers use Xmind to write test cases. Each person writes a different test case, lacking specific formats and specifications.

[0044] (2) When testers execute test cases, they usually mark them directly on the Xmind source files. There is a lack of detailed records of the execution of the test cases, and there is no specific basis or report output for the completion of the test.

[0045] (3) Test cases are disconnected from automation scripts. After writing test cases in Xmind, testers need to further write scripts to convert test cases into executable automation scripts. This involves a certain degree of duplication of work, and the automation conversion rate of test cases cannot be reasonably evaluated.

[0046] The embodiments of the present invention provide an automatic script generation method, device, equipment, medium and program product to solve the above problems.

[0047] According to an embodiment of the present invention, an embodiment of an automated script generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0048] Figure 1 It is a flowchart of the automatic script generation method according to an embodiment of the present invention.

[0049] like Figure 1 As shown, an embodiment of the present invention provides an automated script generation method, the automated script generation method comprising:

[0050] S101: Determine the key element fields of the automation script in advance according to the automation test framework, and determine the key element tags corresponding to the key element fields to determine the test case writing specifications.

[0051] In this embodiment, the key element fields include, but are not limited to: use case name, use case label, use case level, use case description, interface name, interface path, request method, input data and expected results.

[0052] The key element tags corresponding to the above key element fields may be: use case name (NAME), use case tag (TAG), use case level (LEVEL), use case description (DESCRIBE), interface name (APINAME), interface path (APIURI), request method (METHOD), input data (INPUT), and expected result (EXCEPT). Key element tags can mark key element fields and key element data.

[0053] As an example, the automated testing framework is the Pytest framework. The Pytest framework is a very mature, full-featured Python testing framework that is simple, flexible, and easy to use. It supports parameterization and can support simple unit tests and complex functional tests. It can also be used for selenium / appnium and other automated tests and interface automated tests.

[0054] Xmind is a very practical mind mapping software that is widely used. Now people are gradually shifting from writing test cases from Excel to Xmind.

[0055] Use Case: Test case is a set of documents designed and written for executing software system tests, mainly consisting of test input, execution conditions, expected results, etc. Test case is an important basis for executing tests, and has the characteristics of being effective, repeatable, easy to organize, clear and concise, and maintainable.

[0056] S102: Obtain the target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool.

[0057] In this embodiment, according to the predetermined test case writing specification, key element data is input, and the following can be obtained: Figure 2The target map file shown realizes the standardization of test case writing and unifies the writing format.

[0058] In this embodiment, the key elements in the automation script are mapped to the writing of test cases, and the Xmind test case writing specification is formulated: the writing format of each test case needs to be marked according to the key element label.

[0059] S103: Import the target map file, parse the target map file, obtain target element data, and store the target element data in a database.

[0060] In this embodiment, the target element data is key element data in a preset format. The database includes at least one use case data, each use case data includes a use case number, a conversion state and the target element data corresponding to the use case number, and also includes a test result. After executing the automation script, the test result field in the use case data in the database is backfilled according to the actual test result. The conversion state includes a converted state, an unconverted state and a conversion failure state. The use case number can be generated incrementally according to the interface name. As an example, the use case data corresponding to the interface names v1, v2, and v3 are numbered 001, 002, and 003.

[0061] When the conversion status in the database is the unconverted state, the field (conversion status) is empty, and when the conversion status is the converted state, the field (conversion status) is the converted flag, for example, 1. When the conversion status is the conversion failed state, the field (conversion status) is the conversion failed flag, for example, 0.

[0062] In this embodiment, when the preset format is JSON format, the target map file is parsed in S103 to obtain the target element data and store the target element data in the database, which specifically includes:

[0063] Convert the target map file into a JSON data dictionary. Specifically, the format conversion can be performed through a parser, for example, the target map file can be parsed into JSON format through the Xmind_to_dict function provided by the Xmind parser (XmindParser), and stored in a dictionary form to obtain a JSON data dictionary. The JSON data dictionary corresponds to multiple test cases.

[0064] Parse the JSON data dictionary to obtain the target feature data. Specifically, you can parse the JSON data dictionary root node and the corresponding child nodes, such as Figure 2As shown in the figure, the root node includes the interface name (API NAME), the interface path (API URI), and the request method (METHOD), and the corresponding child nodes include the use case tag (TAG), the use case level (LEVEL), the input data (INPUT), and the expected result (EXCEPT). The required target element data is identified through the key element tags.

[0065] Store the target element data in the database according to the use case dimension. Write the target element data corresponding to the root node and the corresponding child node into the database one by one according to the use case dimension, and the use case number can be generated incrementally according to the interface name. The KEY value of the database is the interface name and the use case number, which is used to uniquely identify a use case data. The use case dimension provides a structured way to store target element data. It makes the organization of target element data in the database more organized, which is convenient for subsequent query, update and management operations. For example, a database index, such as the use case number, can be constructed through the use case dimension to improve the efficiency of data retrieval. At the same time, the use case dimension also helps to associate the various key elements of the test case, grasp the overall picture of the test case, and better support the development of testing activities, such as the writing of automated test scripts.

[0066] In the present invention, the specific content of the use case dimension may include interface-related dimensions, use case attribute dimensions, data interaction dimensions, and the like.

[0067] Interface-related dimensions include: interface name (APINAME), interface path (APIURI), and request method (METHOD). These data are parsed from the root node, and they constitute the interface information dimension involved in the test case. The interface name is used to uniquely identify an interface, the interface path describes the location of the interface in the system, and the request method clarifies the method of calling this interface. Storing these data according to the use case dimension makes it easy to retrieve and manage test cases based on the interface. For example, when a specific interface needs to be functionally tested or performance tested, all test cases related to it can be quickly found by the interface name.

[0068] Use case attribute dimensions:

[0069] It covers use case tags (TAG) and use case levels (LEVEL). Use case tags can be used to classify test cases, such as marking test cases according to functional modules, business scenarios, and test types (functional testing, security testing, performance testing, etc.). Use case levels usually indicate the importance or priority of test cases. For example, high-level use cases may involve core business functions or scenarios that are prone to problems. These high-level use cases can be executed first when test resources are limited. By storing these use case attributes as use case dimensions, the execution order of test cases can be filtered and arranged according to tags and levels.

[0070] Data interaction dimensions:

[0071] Mainly input data (INPUT) and expected results (EXCEPT). Input data is the parameter that needs to be passed in when calling the interface, and expected results are the correct results pre-set according to business logic and interface functions. These two elements constitute the data interaction dimension of the test case, which is crucial for the actual execution of test cases and verification of test results. Storing them according to the use case dimension can easily obtain input data and send requests when executing the test. At the same time, after receiving the actual test results returned by the interface, compare them with the expected results to determine whether the test case has passed.

[0072] S104: Read the target use case data in the database to generate a target automation script.

[0073] In this embodiment, the conversion state of the target use case data is an unconverted state.

[0074] In this embodiment, the target use case data in the database is read to generate a target automation script in S104, which specifically includes:

[0075] S1041: Determine the target file path of the target automation script and the name of the target automation script to be generated. For example, in the Python test framework, the name of the target automation script to be generated may be: test_chongdie.py. The target file path is: E:\Autotest\open-api-test\testcases\test_chongdie.py.

[0076] S1042: Read the target use case data in the database and generate a target automation script in the target file path.

[0077] In this embodiment, S1042 reads the target use case data in the database and generates a target automation script in the target file path, specifically including:

[0078] According to the input target interface name, the use case data whose conversion state is unconverted and whose interface name is the target interface name is read from the database is determined as the target use case data, and the target automation script is generated according to the target use case data based on the preset script generation rules. The use case data whose conversion state is unconverted and whose interface name is the target interface name is obtained from the database through the target interface name and conversion state, and the above determined use case data is determined as the target use case data, and the target use case data is used to generate the target automation script.

[0079] In this embodiment, the operation interface for uploading files and generating target automation scripts corresponding to the technical solutions of S103 and S104 is as follows: Figure 3 The corresponding target automation script is as shown in Figure 4 As shown in the figure, the specific content of the target automation script is as follows Figure 5 shown.

[0080] In this embodiment, the target use case data can be formatted according to a preset script format. As an example, the preset script format is the format of the pytest script, and the preset script generation rules are the preset script generation rules under the pytest framework. For example, the use case name is assigned to @allure.story in the automation script, and the input data is assigned to the payload parameter. At the same time, the expected result is matched with the existing public return code file. If the match is successful, the data corresponding to the expected result field is converted into the number of the public return code and filled into the use case data, and the data corresponding to the expected result field is replaced with the number of the public return code. If there is no match, a new code value (the number of the public return code) is created according to the data corresponding to the expected result field and written into the public return code file. The successfully converted use case data is backfilled with the converted mark, and the conversion failure mark is backfilled with the failed conversion, thereby updating the conversion status of the use case data in the database.

[0081] Loop through the use case data in the database with empty conversion status, read the target use case data in the database, convert the target use case data according to the format of the pytest script, and determine whether the EXCEPT value in the use case data matches the return information in the public return code file yaml. If it matches, replace the EXCEPT value with the code value in the public return code file and write it into the script. If it does not match, you can create a new public return code number or output an error message, for example, the data does not meet the writing specifications, etc.

[0082] Figure 6 It is a flowchart of another automatic script generation method according to an embodiment of the present invention.

[0083] like Figure 6 As shown, an embodiment of the present invention provides an automated script generation method, the automated script generation method comprising:

[0084] S201: Determine the key element fields of the automation script in advance according to the automation test framework, determine the key element tags corresponding to the key element fields, and determine the test case writing specifications. For details, refer to the relevant description of S101 above, which will not be repeated here.

[0085] S202: Obtain the target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool. For details, please refer to the relevant description of S102 above, which will not be repeated here.

[0086] S203: Import the target map file, parse the target map file, obtain the target element data, and store the target element data in the database. For details, refer to the relevant description of S103 above, which will not be repeated here.

[0087] S204: Read the target use case data in the database to generate a target automation script. For details, please refer to the relevant description of S104 above, which will not be repeated here.

[0088] S205: Execute the target automation script, obtain actual test results, and store the actual test results in a database.

[0089] In this embodiment, automation is executed and the results of automation execution are backfilled. Each use case data in the database also includes: a test result (STATUS) field. After executing the target automation script and obtaining the actual test results, the actual test results are backfilled into the test result (STATUS) field under the database. Reverse regeneration of Xmind test cases allows the final test results of the test cases to be intuitively displayed.

[0090] S206: Generate an automated test report.

[0091] In this embodiment, the automated report directory is determined based on the generated automated test report. In this embodiment, the automated report directory can be traversed, the rusult.json file can be read, and the obtained NAM E (use case name) and STATUS (test results) can be backfilled into the results of the corresponding test case in the database.

[0092] The inventive concept of the technical solution of the present invention is to parse the test case format, map the format of the automated test framework to the Xmind test case writing format one by one, and thus formulate the Xmind map writing specification, that is, the test case writing specification. Parse the Xmind map file, read the specific key element tags on Xmind, and store the parsed results in the database. Read the use case parameter field in the database, convert it into an automated script in a specific format, trigger the execution of the automated script, backfill the test results into the corresponding use case in the database, and output the automated test report.

[0093] The present invention realizes the function of directly generating executable automation scripts from mind maps, so that testers can directly complete the writing of automation scripts from test case writing, thereby improving test efficiency and reducing labor costs.

[0094] The advantages of the technical solution of the present invention include:

[0095] Standardized test case management: By pre-defining key element fields and labels, standardized management of test cases is achieved, improving the consistency and maintainability of test cases.

[0096] Improve test case writing efficiency: Using the XMind tool combined with key element tags, you can quickly write and organize test cases, improving the efficiency of test case writing.

[0097] Automated test case conversion: Automatically extract test case data from XMind files and convert them into a preset format (such as JSON), reducing the workload of manual input and improving the accuracy and speed of conversion.

[0098] Database integration: Store test case data in the database for easy management and query, and track the conversion status of test cases.

[0099] Flexible test case status tracking: Through the management of conversion status (unconverted, converted, conversion failed), the status of test cases can be flexibly tracked to facilitate test progress control and problem diagnosis.

[0100] Automatic script generation: Automatically generate pytest scripts according to preset script generation rules, improving the implementation efficiency of automated testing.

[0101] Common return code management: By matching and replacing common return codes, the expected test results are standardized, making it easier to maintain and understand test expectations.

[0102] Error handling and feedback: An error handling mechanism is provided. For mismatches, a new code can be created or an error message can be output.

[0103] Integration with Allure testing framework: Using Allure framework annotations (such as @allure.story) enhances the readability and information content of test reports.

[0104] Easy to integrate and expand: The technical solution of the present invention is easy to integrate with other tools and frameworks, such as continuous integration (CI) / continuous delivery (CD) processes, and can also be expanded as needed.

[0105] Improve test quality: Improve the quality of testing by automating and standardizing the writing and management of test cases.

[0106] Reduce human errors: The automated process reduces the possibility of human errors and improves the accuracy of test cases and test scripts.

[0107] Improve test maintainability: Store test cases and expected results in a database to facilitate updating and maintenance of test cases.

[0108] In summary, the technical solution of the present invention improves the management efficiency of test cases and the implementation efficiency of automated testing through automation and standardization, while ensuring the quality and maintainability of the tests.

[0109] It should be noted that the contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.

[0110] In this embodiment, an automated script generation device is also provided, and a single device is used to implement the above-mentioned embodiment and optional implementation methods, which have been described and will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0111] Figure 7 It is a schematic diagram of the structure of an automatic script generation device according to an embodiment of the present invention.

[0112] The present invention provides an automatic script generation device, such as Figure 7 As shown, the automatic script generating device includes:

[0113] The first processing module 11 is used to determine the key element fields of the automation script according to the automation test framework in advance, determine the key element tags corresponding to the key element fields, and determine the test case writing specifications. The key element fields include: use case name, use case tag, use case level, use case description, interface name, interface path, request method, input data and expected results.

[0114] The second processing module 12 is used to obtain the target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool.

[0115] The third processing module 13 is used to import the target map file, parse the target map file, obtain the target element data, and store the target element data in the database. The target element data is the key element data in a preset format. The database includes at least one use case data, each use case data includes a use case number, a conversion state and the target element data corresponding to the use case number. The conversion state includes a converted state, an unconverted state and a conversion failure state.

[0116] The fourth processing module 14 is used to read the target use case data in the database to generate a target automation script, and the conversion state of the target use case data is an unconverted state.

[0117] In an optional implementation, when the preset format is JSON format, the third processing module 13 is specifically used to convert the target map file into a JSON data dictionary, parse the JSON data dictionary to obtain target element data, and store the target element data in a database according to the use case dimension.

[0118] In an optional implementation, the fourth processing module 14 is specifically configured to determine a target file path of a target automation script, read target use case data in a database, and generate a target automation script at the target file path.

[0119] In an optional embodiment, the fourth processing module 14 is specifically used to determine the use case data whose conversion state is an unconverted state and whose interface name is the target interface name in the read database as the target use case data according to the input target interface name, and generate a target automation script according to the target use case data based on preset script generation rules.

[0120] In an optional embodiment, the automated script generation device also includes: a fifth processing module, which is used to execute the target automated script after reading the target use case data in the database to generate the target script file, obtain the actual test results, and store the actual test results in the database.

[0121] In an optional implementation, the automatic script generation device further includes: a sixth processing module, the sixth processing module being configured to generate an automatic test report after storing the actual test results in the database.

[0122] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0123] The automated script generation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0124] The embodiment of the present invention also provides a computer device having the above Figure 7 The automated script generation device shown.

[0125] See also Figure 8 , Figure 8Schematic diagram of the hardware structure of the computer device according to the embodiment of the present invention. Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In an optional embodiment, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor device). Figure 8 A processor 10 is taken as an example.

[0126] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0127] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0128] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating device, an application required for at least one function. The data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In an optional embodiment, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0129] The memory 20 may include a volatile memory, such as a random access memory. The memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive. The memory 20 may also include a combination of the above types of memory.

[0130] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0131] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc. Further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0132] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0133] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. An automated script generation method, characterized in that: include: Determine the key element fields of the automation script in advance according to the automation test framework, determine the key element tags corresponding to the key element fields, and determine the test case writing specifications; The key element fields include: use case name, use case label, use case level, use case description, interface name, interface path, request method, input data and expected results; Obtain a target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool; Import the target map file, parse the target map file, obtain target element data, and store the target element data in a database; the target element data is key element data in a preset format; the database includes at least one use case data, each use case data includes a use case number, a conversion state and the target element data corresponding to the use case number; the conversion state includes a converted state, an unconverted state and a conversion failure state; The target use case data in the database is read to generate a target automation script, wherein the conversion state of the target use case data is an unconverted state.

2. The method according to claim 1, characterized in that When the preset format is JSON format, parsing the target map file, obtaining target element data, and storing the target element data in a database includes: Convert the target map file into a JSON data dictionary; Parsing the JSON data dictionary to obtain the target element data; The target element data is stored in a database according to the use case dimension.

3. The method according to claim 1, characterized in that The step of reading the target use case data in the database to generate a target automation script includes: Determine the target file path of the target automation script; The target use case data in the database is read to generate a target automation script in the target file path.

4. The method according to claim 3, characterized in that The step of reading the target use case data in the database and generating a target automation script in the target file path includes: According to the input target interface name, the use case data whose conversion state is unconverted and whose interface name is the target interface name is read from the database is determined as the target use case data, and a target automation script is generated according to the target use case data based on preset script generation rules.

5. The method according to claim 1, characterized in that After reading the target use case data in the database to generate a target automation script, the method further includes: The target automation script is executed to obtain actual test results, and the actual test results are stored in the database.

6. The method according to claim 5, characterized in that After storing the actual test results in the database, the method further includes: generating an automated test report.

7. An automatic script generation device, characterized in that: include: The first processing module is used to determine the key element fields of the automation script in advance according to the automation test framework, and determine the key element tags corresponding to the key element fields to determine the test case writing specifications; The key element fields include: use case name, use case label, use case level, use case description, interface name, interface path, request method, input data and expected results; The second processing module is used to obtain a target map file obtained by inputting key element data according to the key element tags corresponding to the key element fields in the Xmind tool; The third processing module is used to import the target map file, parse the target map file, obtain target element data, and store the target element data in a database; the target element data is key element data in a preset format; the database includes at least one use case data, each use case data includes a use case number, a conversion state and the target element data corresponding to the use case number; the conversion state includes a converted state, an unconverted state and a conversion failure state; The fourth processing module is used to read the target use case data in the database to generate a target automation script, and the conversion state of the target use case data is an unconverted state.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the automated script generation method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the automated script generation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the automatic script generation method according to any one of claims 1 to 6.