Test script automatic generation method and device, electronic equipment and storage medium

By obtaining test configuration information and using AI model to parse the html linked to the page, generating test scripts, the existing automated test script generation tools are solved, and more efficient and accurate test script generation is achieved.

CN119512940APending Publication Date: 2025-02-25PEOPLE'S INSURANCE COMPANY OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411521067.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Existing automated test script generation tools are inefficient and error-prone, especially when page element positioning changes, they require manual maintenance.

Method used

By obtaining test configuration information, using the AI ​​model to parse the html linked to the page, determine the positioning information of the operation object, and convert the operation object, operation type, and input value into the test dictionary, and add the preset script framework to generate the test script.

Benefits of technology

It improves the accuracy and efficiency of testing script generation, reduces the need for manual intervention, and can automatically adapt to changes in operating object positioning information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512940A_ABST
    Figure CN119512940A_ABST
Patent Text Reader

Abstract

The invention provides a test script automatic generation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining test configuration information which comprises a page link, a test tool, an execution mode, an execution frequency, an operation object, an operation type and an input value, and analyzing an html corresponding to the page link by using an AI model to obtain a test script; the method comprises the following steps: determining positioning information of an operation object in an html (Hypertext Markup Language), then converting the operation object, an operation type and an input value into a test dictionary, and adding the test dictionary, a page link, a test tool, an execution mode, an execution frequency and a target operation position into a preset script framework to generate a test script, the preset script framework executes different test programs on the operation objects based on different operation types corresponding to the operation objects. Therefore, the accuracy and efficiency of test script generation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a method, device, electronic device and storage medium for automatically generating a test script. Background Art

[0002] In the current software testing field, the generation of automated test scripts usually relies on manual writing, which requires testers to convert manual test cases into executable test scripts. This method not only places high demands on the technical level of testers, but also has low efficiency and is prone to human errors.

[0003] Low-code automated testing tools generate test scripts based on manual test cases entered by users in a specific format or rules. However, such tools have not completely solved the problems of inefficiency and error-proneness, and when the positioning of page elements changes, manual intervention is still required for maintenance. Summary of the invention

[0004] The present application aims to solve one of the technical problems in the related art at least to some extent.

[0005] To this end, the first objective of the present application is to propose a method for automatically generating test scripts to improve the accuracy and efficiency of test script generation.

[0006] The second objective of the present application is to provide a device for automatically generating test scripts.

[0007] The third objective of the present application is to provide an electronic device.

[0008] A fourth objective of the present application is to provide a computer-readable storage medium.

[0009] A fifth object of the present application is to provide a computer program product.

[0010] To achieve the above-mentioned purpose, the first embodiment of the present application proposes a method for automatically generating a test script, comprising:

[0011] Obtain test configuration information, wherein the test configuration information includes page links, test tools, execution methods, execution frequencies, operation objects, operation types, and input values;

[0012] Use the AI ​​model to parse the HTML corresponding to the page link and determine the location information of the operation object in the HTML;

[0013] Convert the operation object, operation type, and input value into a test dictionary;

[0014] The test dictionary, page link, test tool, execution method, execution frequency, and target operation position are added to the preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation objects based on the different operation types corresponding to each operation object.

[0015] To achieve the above-mentioned purpose, the second embodiment of the present application proposes a test script automatic generation device, including:

[0016] An acquisition module is used to acquire test configuration information, wherein the test configuration information includes a page link, a test tool, an execution mode, an execution frequency, an operation object, an operation type, and an input value;

[0017] The positioning module is used to parse the HTML corresponding to the page link using the AI ​​model to determine the positioning information of the operation object in the HTML;

[0018] Parsing module, used to convert operation objects, operation types, and input values ​​into test dictionaries;

[0019] A generation module is used to add a test dictionary, page link, test tool, execution method, execution frequency, and target operation position into a preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation object based on the different operation types corresponding to each operation object.

[0020] To achieve the above-mentioned purpose, the third aspect of the present application provides an electronic device, including:

[0021] at least one processor; and

[0022] a memory communicatively connected to at least one processor; wherein,

[0023] The memory stores instructions that can be executed by at least one processor. The instructions are executed by the at least one processor so that the at least one processor can execute the method of the above embodiment.

[0024] To achieve the above objectives, the fourth aspect of the present application proposes a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method according to the above embodiment.

[0025] To achieve the above objectives, the fifth aspect of the present application proposes a computer program product, including a computer program, which implements the method of the above embodiment when executed by a processor.

[0026] The test script automatic generation method, device, electronic device and storage medium provided in this application are

[0027] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0029] Figure 1 A flowchart of a method for automatically generating a test script provided in an embodiment of the present application;

[0030] Figure 2 A flowchart of another method for automatically generating test scripts provided in an embodiment of the present application;

[0031] Figure 3 A schematic diagram of the structure of a test script automatic generation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0033] The following describes the test script automatic generation method and device of the embodiments of the present application with reference to the accompanying drawings.

[0034] The test script automatic generation method of the embodiment of the present application is executed by the test script automatic generation device provided in the embodiment of the present application. The device can be configured in a computer device or a terminal device to improve the accuracy and efficiency of test script generation.

[0035] Low-code automated testing tools require users to generate test scripts based on manual test cases by dragging components, entering page element positioning, operations, configuring parameters and other low-code operations on the tool. This requires a lot of manual participation and fails to solve problems such as low efficiency and manual error. At the same time, when the positioning of page elements changes, manual maintenance is required.

[0036] Figure 1 A flowchart of a method for automatically generating test scripts provided in an embodiment of the present application.

[0037] like Figure 1 As shown, the test script automatic generation method includes the following steps:

[0038] Step 101, obtaining test configuration information, wherein the test configuration information includes page links, test tools, execution methods, execution frequencies, operation objects, operation types, and input values.

[0039] In this application, the test configuration information may be pre-set in the system. Alternatively, the test case text may be identified and the test configuration information may be obtained from the test case text. This application does not limit this.

[0040] Optionally, the test case text is identified to generate a test case standard table, wherein the test case standard table includes test configuration information. Thus, the test case text is analyzed and understood in depth and comprehensively with the help of AI technology, thereby avoiding omission and mismatch of test configuration information and improving the accuracy of test configuration information.

[0041] For example, the test case text of a system login module is as follows:

[0042] “[This case is executed using the Chrome browser and is executed once every day at 0:00 a.m.]

[0043] Open the system login address URL, enter username = username, enter password = password, and click the login button. "

[0044] The above test text is parsed using the pre-trained AI recognition model to obtain the following test case standard table:

[0045] Test case standard table

[0046]

[0047] The operation types include click, input and comparison. Click can be further divided into button, pop-up window, etc.; input type can be further divided into text, drop-down box, radio button, multiple-choice box, etc.; comparison type can be further divided into text comparison and database comparison. After that, the system automatically determines the subdivision type of the operation object based on the class or tag attribute by obtaining the HTML of the div corresponding to the operation object. The specific contents are shown in the following table:

[0048] Segment Type Table

[0049]

[0050]

[0051] Among them, the specific training method of the AI ​​recognition model is as follows:

[0052] 1) Obtain test case sample data. These sample data cover the commonly used regression test cases of each test system to ensure that the model can learn a rich variety of patterns and features.

[0053] 2) Preprocess and annotate the test case sample data. Preprocessing includes unifying the data format. For example, the test case uses a standard format, which first describes the system address corresponding to the case, the execution browser (supports common browsers such as Chrome, IE, Firefox, etc., and can be used for compatibility testing), the execution method and frequency of the case, and then writes one step for each operation. Professional testers annotate the test case sample data and generate the annotated test configuration information corresponding to each test case sample data.

[0054] 3) Apply general machine learning algorithms or deep learning architectures to train AI recognition models. During the training process, continuously adjust parameters to minimize the difference between the predicted test configuration information and the labeled test configuration information.

[0055] 4) After training is completed, the AI ​​recognition model is verified and manually inspected and evaluated by professional testers to assess its accuracy and completeness.

[0056] Step 102: parse the HTML corresponding to the page link using the AI ​​model to determine the location information of the operation object in the HTML.

[0057] In the present application, the positioning information of the operation object can be obtained from the html according to the name of the operation object using a pre-trained AI positioning model.

[0058] For example, suppose the HTML of the login page username is as follows:

[0059] “ <input type="text"autocomplete="off"placeholder="用户名"id="username"maxlength="120"class="el-input_inner"> ”

[0060] Input the html of the page and the name of the operation object into the AI ​​positioning model. The AI ​​positioning model automatically extracts the location information of the operation object from the html according to the name of the operation object: “ / / *[@id="username"]”

[0061] In addition, multiple different types of operation objects can be obtained, and the location information of the operation objects can be annotated to determine the annotated location information corresponding to each operation object. Then, the AI ​​positioning model is trained based on the obtained operation objects, the HTML to which the operation objects belong, and the annotated location information corresponding to the operation objects, thereby improving the accuracy of the AI ​​positioning model.

[0062] Step 103, converting the operation object, operation type, and input value into a test dictionary.

[0063] Among them, the test dictionary can be determined based on the programming language used by the test script, such as a python dictionary, etc., and this application does not impose any restrictions on this.

[0064] In this application, the test configuration information is obtained and parsed line by line to extract the three key information of "operation object", "operation type" and "input value", and combine them into a Python dictionary.

[0065] For example, for the system login module test case in step 101, it can be converted into a test dictionary: {{"operation object":"username","operation type":"input","input value":"username"}, {"operation object":"password","operation type":"input","input value":"password"}, {"operation object":"login button","operation type":"click","input value":""}}.

[0066] Step 104, adding the test dictionary, page link, test tool, execution mode, execution frequency, and target operation position into a preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation objects based on the different operation types corresponding to each operation object.

[0067] In this application, a script framework can be pre-set in the system, and the preset script framework can contain test execution logic code, such as initialization, opening a browser, connecting to a database, loading a configuration file, and other operations. Afterwards, the test dictionary, page link, test tool, execution method, execution frequency, and target operation position are added to their corresponding positions in the preset script framework to generate an executable test script. Afterwards, when executing the test script, the test script first performs general operations such as script initialization, opening a browser, connecting to a database, and loading a configuration file, and then parses the test dictionary in the test script to obtain specific test steps and test data, and performs specific tests according to the steps. The efficiency and accuracy of the test are greatly improved, and the need for manual intervention is reduced.

[0068] In the case of many test scenarios, in order to distinguish the test scripts corresponding to each test scenario, the generated test script can be named based on the file name of the test configuration information. For example, if the file name of the test configuration information is "TestCases_Login.xlsx", then the file name of the corresponding test script is "TestCases_Login.py".

[0069] In addition, different test procedures are executed for operation objects of different operation types: when the operation type corresponding to the operation object is a click type, a click operation is performed at the target operation position corresponding to the operation object; when the operation type corresponding to the operation object is an input type, the input format of the operation object is determined to input content at the target operation position corresponding to the operation object based on the input format; when the operation type corresponding to the operation object is a comparison type, a subdivision comparison type is determined based on the input value corresponding to the operation object to determine the content to be compared based on the subdivision comparison type, and the content to be compared is compared with the reference content corresponding to the operation object.

[0070] For example, when the operation type corresponding to the operation object is a click type, determine the subdivided operation type to judge whether it is a button click or a pop-up click (the operation object of the pop-up click is separated by "->"), and trigger the corresponding click operation at the target operation position corresponding to the operation object.

[0071] When the operation type corresponding to the operation object is an input type, the corresponding html is searched from the page according to the name of the operation object to determine the subdivided operation type and judge whether it is an input box such as text, drop-down box, radio button, or multiple-choice box. When the subdivided operation type is text, the input mode is determined to be a text input mode. When the subdivided operation type is a drop-down box, radio button, or multiple-choice box, the input mode is determined to be a selection input mode. Afterwards, input content at the target operation position corresponding to the operation object based on the input mode. When the input mode of the operation object is a text input mode, input the input value corresponding to the operation object at the target operation position corresponding to the operation object. When the input mode of the operation object is a selection input mode, select the element corresponding to the input value at the target operation position corresponding to the operation object, such as the option corresponding to the input value in the drop-down box, or the checkbox corresponding to the input value selection in the radio button or multiple-choice box.

[0072] When the operation type corresponding to the operation object is a comparison type, the subdivision comparison type is determined according to the input value, and it is determined whether it is a text comparison type or a database comparison type (the input value is a sql statement, which is determined as a database comparison type, and other input values ​​are determined as text comparison types). In the case of the database comparison type, the sql statement is executed to obtain the content to be compared. In the case of the text comparison type, the input value is directly determined as the content to be compared. After that, the content to be compared is compared with the reference content corresponding to the operation object.

[0073] In this application, test configuration information is obtained, wherein the test configuration information includes page links, test tools, execution methods, execution frequencies, operation objects, operation types, and input values, and the html corresponding to the page links is parsed using an AI model to determine the location information of the operation object in the html, after which the operation object, operation type, and input value are converted into a test dictionary, and the test dictionary, page links, test tools, execution methods, execution frequencies, and target operation positions are added to a preset script framework to generate a test script, wherein the preset script framework executes different test programs on the operation object based on the different operation types corresponding to each operation object. Thus, the location information of the operation object in the html is determined by the AI ​​model, which overcomes the problem in the prior art that when the location information of the operation object changes, the location information of the operation object needs to be manually determined and maintained, resulting in low efficiency of automated testing. This improves the accuracy and efficiency of test script generation.

[0074] Figure 2 A flowchart of a method for automatically generating test scripts provided in an embodiment of the present application.

[0075] like Figure 2 As shown, the test script automatic generation method includes the following steps:

[0076] Step 201, obtaining test configuration information, wherein the test configuration information includes page links, test tools, execution methods, execution frequencies, operation objects, operation types, and input values.

[0077] Step 202: parse the HTML corresponding to the page link using the AI ​​model to determine the location information of the operation object in the HTML.

[0078] Step 203, convert the operation object, operation type, and input value into a test dictionary.

[0079] Step 204, adding the test dictionary, page link, test tool, execution mode, execution frequency, and target operation position into a preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation objects based on the different operation types corresponding to each operation object.

[0080] In the present application, the specific implementation process of steps 201 to 204 can be found in the detailed description of any embodiment of the present application and will not be repeated here.

[0081] Step 205: Generate a test log during the execution of the test script.

[0082] Step 206: When the test script fails to execute, the test log is parsed to determine the reason for the failure of the test script execution.

[0083] The test log includes error codes, error descriptions, and related context information, etc. The reasons for failure include test configuration information errors such as incorrect operation sequence, incorrect input data, test environment configuration errors, and script errors.

[0084] In this application, an AI analysis model can be pre-trained to parse the test logs and determine the reasons for the failure of the test script execution, so as to facilitate the maintenance of the test script.

[0085] Optionally, AI technology can be used to determine the fault-tolerant measures that need to be executed when the test script fails to execute. If the cause of the failure is determined to be a temporary problem (such as a timeout when clicking Submit), the retry mechanism will be automatically enabled after a preset time interval to ensure that the test script can be successfully executed. If the cause of the failure is determined to be a script or configuration error (including environment configuration, test configuration information, etc.), the error details will be recorded, and an alarm message will be generated, which will be sent to relevant personnel in a timely manner for processing and repair.

[0086] Optionally, the test log may be parsed based on a preset failure cause parsing script to determine the failure cause, wherein the failure cause parsing script contains key information corresponding to each failure cause, and the failure cause may be determined by matching the key information with the test log.

[0087] In addition, the fault-tolerant measures associated with each failure cause may be pre-set in the system, and then the fault-tolerant measures associated with the failure cause may be executed.

[0088] In this application, test configuration information is obtained, wherein the test configuration information includes page links, test tools, execution methods, execution frequencies, operation objects, operation types, and input values, and the html corresponding to the page links is parsed using an AI model to determine the location information of the operation object in the html, and then the operation object, operation type, and input value are converted into a test dictionary, and the test dictionary, page links, test tools, execution methods, execution frequencies, and target operation positions are added to a preset script framework to generate a test script, wherein the preset script framework performs different test programs on the operation object based on the different operation types corresponding to each operation object. A test log is generated during the execution of the test script. In the case of failure to execute the test script, the test log is parsed to determine the cause of failure to execute the test script. Thus, the location information of the operation object in the html is determined by the AI ​​model, which overcomes the problem that in the prior art, when the location information of the operation object changes, the location information of the operation object needs to be manually determined and maintained, resulting in low efficiency of automated testing. Thereby improving the accuracy and efficiency of test script generation.

[0089] In order to implement the above embodiment, the present application also proposes a test script automatic generation device.

[0090] Figure 3 A schematic diagram of the structure of a test script automatic generation device provided in an embodiment of the present application.

[0091] like Figure 3 As shown, the test script automatic generation device includes an acquisition module 310 , a positioning module 320 , a parsing module 330 , and a generation module 340 .

[0092] The acquisition module 310 is used to acquire test configuration information, wherein the test configuration information includes a page link, a test tool, an execution mode, an execution frequency, an operation object, an operation type, and an input value;

[0093] The positioning module 320 is used to parse the HTML corresponding to the page link using the AI ​​model to determine the positioning information of the operation object in the HTML;

[0094] The parsing module 330 is used to convert the operation object, operation type, and input value into a test dictionary;

[0095] The generation module 340 is used to add the test dictionary, page link, test tool, execution mode, execution frequency, and target operation position to the preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation object based on the different operation types corresponding to each operation object.

[0096] Furthermore, in a possible implementation manner of the embodiment of the present application, an execution module is also included, which is used to:

[0097] When the operation type corresponding to the operation object is a click type, a click operation is performed at a target operation position corresponding to the operation object;

[0098] In a case where the operation type corresponding to the operation object is an input type, determining an input mode of the operation object, so as to input content at a target operation position corresponding to the operation object based on the input mode;

[0099] When the operation type corresponding to the operation object is a comparison type, a subdivision comparison type is determined based on the input value corresponding to the operation object, and content to be compared is determined based on the subdivision comparison type, and the content to be compared is compared with the reference content corresponding to the operation object.

[0100] Furthermore, in a possible implementation of the embodiment of the present application, the execution module is further configured to:

[0101] Generate test logs during the execution of test scripts;

[0102] In the event of a test script execution failure, the test log is parsed to determine the cause of the test script execution failure.

[0103] Furthermore, in a possible implementation of the embodiment of the present application, a fault tolerance module is also included, which is used to:

[0104] If the failure is caused by a temporary problem, enable the retry mechanism;

[0105] If the failure is caused by a script or configuration error, an alarm message is generated.

[0106] Furthermore, in a possible implementation of the embodiment of the present application, the acquisition module 310 is used to:

[0107] The test case text is recognized to generate a test case standard table, wherein the test case standard table contains test configuration information.

[0108] It should be noted that the above explanation of the embodiment of the method for automatically generating test scripts is also applicable to the device for automatically generating test scripts of this embodiment, and will not be repeated here.

[0109] In this application, test configuration information is obtained, wherein the test configuration information includes page links, test tools, execution methods, execution frequencies, operation objects, operation types, and input values, and the html corresponding to the page links is parsed using an AI model to determine the location information of the operation object in the html, after which the operation object, operation type, and input value are converted into a test dictionary, and the test dictionary, page links, test tools, execution methods, execution frequencies, and target operation positions are added to a preset script framework to generate a test script, wherein the preset script framework executes different test programs on the operation object based on the different operation types corresponding to each operation object. Thus, the location information of the operation object in the html is determined by the AI ​​model, which overcomes the problem in the prior art that when the location information of the operation object changes, the location information of the operation object needs to be manually determined and maintained, resulting in low efficiency of automated testing. This improves the accuracy and efficiency of test script generation.

[0110] In order to implement the above embodiments, the present application also proposes an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method provided by the above embodiments.

[0111] In order to implement the above embodiments, the present application also proposes a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the methods provided by the above embodiments.

[0112] In order to implement the above embodiments, the present application also proposes a computer program product, including a computer program, which implements the methods provided by the above embodiments when executed by a processor.

[0113] The collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in this application are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0114] It should be noted that personal information from users should be collected for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. In addition, such collection / sharing should be carried out after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign the agreement / authorization including authorization of relevant user information before the user uses the function. In addition, any necessary steps should be taken to protect and safeguard access to such personal information data and ensure that others who have access to personal information data comply with its privacy policy and procedures.

[0115] This application is expected to provide an implementation scheme for users to selectively block the use or access of personal information data. That is, this application is expected to provide hardware and / or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, risks can be minimized by limiting data collection and deleting data. In addition, when applicable, personal identifiers are removed from such personal information to protect the privacy of users.

[0116] In the description of the aforementioned embodiments, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0117] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0118] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0119] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0120] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0121] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0122] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0123] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A method for automatically generating a test script, characterized in that: The method comprises: Acquire test configuration information, wherein the test configuration information includes a page link, a test tool, an execution mode, an execution frequency, an operation object, an operation type, and an input value; Parsing the HTML corresponding to the page link using an AI model to determine the location information of the operation object in the HTML; Convert the operation object, the operation type, and the input value into a test dictionary; The test dictionary, the page link, the test tool, the execution method, the execution frequency, and the target operation position are added to a preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation objects based on different operation types corresponding to each of the operation objects.

2. The method according to claim 1, characterized in that The preset script framework executes different test procedures on the operation objects based on different operation types corresponding to the operation objects, including: In a case where the operation type corresponding to the operation object is a click type, performing a click operation at a target operation position corresponding to the operation object; In a case where the operation type corresponding to the operation object is an input type, determining an input mode of the operation object, so as to input content at a target operation position corresponding to the operation object based on the input mode; When the operation type corresponding to the operation object is a comparison type, a subdivision comparison type is determined based on the input value corresponding to the operation object, content to be compared is determined based on the subdivision comparison type, and the content to be compared is compared with reference content corresponding to the operation object.

3. The method according to claim 1, characterized in that Also includes: generating a test log during the execution of the test script; In the case where the test script fails to execute, the test log is parsed to determine the cause of the failure of the test script execution.

4. The method according to claim 3, characterized in that Also includes: If the failure is caused by a temporary problem, a retry mechanism is enabled; In the case where the failure is caused by a script or configuration error, an alarm message is generated.

5. The method according to claim 1, characterized in that The obtaining of test configuration information includes: The test case text is identified to generate a test case standard table, wherein the test case standard table contains test configuration information.

6. A test script automatic generation device, characterized in that: The device comprises: An acquisition module is used to acquire test configuration information, wherein the test configuration information includes a page link, a test tool, an execution mode, an execution frequency, an operation object, an operation type, and an input value; A positioning module, used to parse the HTML corresponding to the page link using an AI model to determine the positioning information of the operation object in the HTML; A parsing module, used for converting the operation object, the operation type, and the input value into a test dictionary; A generation module is used to add the test dictionary, the page link, the test tool, the execution method, the execution frequency, and the target operation position into a preset script framework to generate a test script, wherein the preset script framework executes different test procedures on the operation objects based on the different operation types corresponding to each operation object.

7. The device according to claim 6, characterized in that Also included is an execution module for: In a case where the operation type corresponding to the operation object is a click type, performing a click operation at a target operation position corresponding to the operation object; In a case where the operation type corresponding to the operation object is an input type, determining an input mode of the operation object, so as to input content at a target operation position corresponding to the operation object based on the input mode; When the operation type corresponding to the operation object is a comparison type, a subdivision comparison type is determined based on the input value corresponding to the operation object, content to be compared is determined based on the subdivision comparison type, and the content to be compared is compared with reference content corresponding to the operation object.

8. The device according to claim 6, characterized in that The execution module is further used for: generating a test log during the execution of the test script; In the case where the test script fails to execute, the test log is parsed to determine the cause of the failure of the test script execution.

9. The device according to claim 8, characterized in that Also included are fault-tolerant modules for: If the failure is caused by a temporary problem, a retry mechanism is enabled; In the case where the failure is caused by a script or configuration error, an alarm message is generated.

10. The device according to claim 6, characterized in that The acquisition module is used to: The test case text is identified to generate a test case standard table, wherein the test case standard table contains test configuration information.

11. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.

13. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 5 when being executed by a processor.