Test execution method and device, equipment and storage medium

By generating task sequences directly from test cases using a pre-trained task generation model, the problem of errors caused by writing test scripts is solved, and efficient and accurate test execution is achieved.

CN120994552APending Publication Date: 2025-11-21BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511101409.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In software testing, writing a large number of test scripts can easily lead to syntax errors, logical loopholes, or element location errors caused by human negligence, which can affect the accuracy of test results.

Method used

By using a pre-trained task generation model, task sequences can be generated directly from test case statements without writing test scripts. The text recognition, generation, and sorting modules identify keywords and generate task sequences, and test operations are executed based on the task sequences.

Benefits of technology

It significantly improves the accuracy of test results, avoids syntax errors and element location deviations that may occur when manually writing scripts, and improves testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994552A_ABST
    Figure CN120994552A_ABST
Patent Text Reader

Abstract

The invention relates to a test execution method and device, equipment and a storage medium, and the method comprises the steps: obtaining a target statement corresponding to a target test case, and the target statement is determined according to the test steps of the target test case; calling a pre-trained task generation model, and inputting the target statement into the task generation model, so that the task generation model outputs a task sequence comprising at least one task; and according to the task sequence, executing a test operation corresponding to the target test case. According to the method, the test can be executed based on the test case without writing a test script, the problems of grammar errors, logic vulnerabilities or element positioning deviation and the like possibly occurring during manual script writing are fundamentally avoided, and the accuracy of a test result is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a test execution method, apparatus, device, and storage medium. Background Technology

[0002] In the software testing process, test cases and test scripts are indispensable and important parts. Test cases are detailed plans of test objectives, operation steps, input data, and expected results, like a blueprint for test actions; test scripts are code written based on programming languages ​​or automation tools to automatically execute the operations in the test cases, thereby automating the testing process.

[0003] In related technologies, test scripts are written by technicians using coding tools based on test cases.

[0004] However, when there are a large number of test cases, technical personnel need to write a large number of test scripts. However, technical personnel have limited energy and are prone to code logic errors due to human negligence, which affects the test results. Summary of the Invention

[0005] This application provides a test execution method, apparatus, device, and storage medium. This method can execute tests based on test cases without writing test scripts, fundamentally avoiding problems such as syntax errors, logical loopholes, or element location deviations that may occur when manually writing scripts, and significantly improving the accuracy of test results.

[0006] Firstly, this application provides a test execution method, the method comprising:

[0007] Obtain the target statement corresponding to the target test case, wherein the target statement is determined based on the test steps of the target test case;

[0008] Invoke a pre-trained task generation model, input the target statement into the task generation model, so that the task generation model outputs a task sequence including at least one task;

[0009] According to the task sequence, execute the test operations corresponding to the target test case.

[0010] Optionally, the task generation model includes a text recognition module, a generation module, and a sorting module. The step of calling a pre-trained task generation model and inputting the target sentence into the task generation model, so that the task generation model outputs a task sequence including at least one task, includes:

[0011] The target sentence is identified by the text recognition module to obtain a keyword sequence including at least one keyword;

[0012] The generation module analyzes each keyword in the keyword sequence to obtain a task corresponding to each keyword.

[0013] The sorting module sorts the tasks according to positions of the corresponding keywords in the keyword sequence to obtain a task sequence including at least one task.

[0014] Optionally, the executing the test operation corresponding to the target test case according to the task sequence includes:

[0015] determining a category to which a task in the task sequence belongs;

[0016] when the category is a first category, executing a corresponding test operation according to the task;

[0017] when the category is a second category, obtaining document object model data of a test page to be used, calling the task generation model, determining an index number of a page element to be operated according to the task and the document object model data, determining the page element to be operated in the test page to be used according to the index number, and executing a corresponding test operation on the page element to be operated according to the task.

[0018] Optionally, the determining the category to which the task belongs includes:

[0019] obtaining a keyword corresponding to the task;

[0020] determining whether a target vocabulary exists in the keyword, the target vocabulary being a vocabulary related to a page element;

[0021] when the target vocabulary does not exist in the keyword, determining the category of the task as the first category;

[0022] when the target vocabulary exists in the keyword, determining the category of the task as the second category.

[0023] Optionally, the task generation model includes a probability determination module and a selection module, and the calling the task generation model and the determining the index number of the page element to be operated according to the task and the document object model data include:

[0024] processing the task and the document object model data by the probability determination module to obtain a probability corresponding to each index number;

[0025] determining, by the selection module, an index number corresponding to a maximum probability as the index number of the page element to be operated.

[0026] Optionally, the method further includes:

[0027] acquire script data generated in a test process;

[0028] obtain target script data according to a preset template and the script data;

[0029] store the target test case and the target script data in the script database.

[0030] Optionally, the method further comprises:

[0031] detecting whether target script data corresponding to the target test case exists in the script database;

[0032] when the target script data corresponding to the target test case exists, performing a corresponding test operation based on the target script data;

[0033] when the target script data corresponding to the target test case does not exist, acquiring target statements of the target test case and performing a corresponding test operation based on the target statements.

[0034] In a second aspect, the present application provides a test execution device, the device comprising:

[0035] an acquisition unit configured to acquire target statements corresponding to a target test case, the target statements being determined according to test steps of the target test case;

[0036] a calling unit configured to call a pre-trained task generation model, input the target statements into the task generation model, so that the task generation model outputs a task sequence comprising at least one task;

[0037] an execution unit configured to execute a test operation corresponding to the target test case according to the task sequence.

[0038] Optionally, the task generation model comprises a character recognition module, a generation module and a sorting module, and the calling unit is configured to:

[0039] recognize the target statements through the character recognition module to obtain a keyword sequence comprising at least one keyword;

[0040] analyze each keyword in the keyword sequence through the generation module to obtain a task corresponding to each keyword;

[0041] sort the tasks according to the positions of the corresponding keywords in the keyword sequence through the sorting module to obtain a task sequence comprising at least one task.

[0042] Optionally, the execution unit is configured to:

[0043] determine a category to which a task in the task sequence belongs;

[0044] when the category is a first category, perform a corresponding test operation according to the task;

[0045] when the category is a second category, obtain document object model data of a test page to be used, call the task generation model, determine an index number of a page element to be operated according to the task and the document object model data, determine the page element to be operated in the test page to be used according to the index number, and perform a corresponding test operation on the page element to be operated according to the task.

[0046] Optionally, the execution unit is configured to:

[0047] obtain a keyword corresponding to the task;

[0048] determine whether a target vocabulary exists in the keyword, the target vocabulary being a vocabulary related to a page element;

[0049] when the target vocabulary does not exist in the keyword, determine the category of the task as the first category;

[0050] when the target vocabulary exists in the keyword, determine the category of the task as the second category.

[0051] Optionally, the task generation model comprises a probability determination module and a selection module, and the execution unit is configured to:

[0052] process the task and the document object model data through the probability determination module to obtain a probability corresponding to each index number;

[0053] determine, through the selection module, an index number corresponding to the maximum probability as the index number of the page element to be operated.

[0054] Optionally, the apparatus further comprises a storage unit, and the storage unit is configured to:

[0055] obtain script data generated in a test process;

[0056] obtain target script data according to a preset template and the script data;

[0057] store the target test case and the target script data in the script database correspondingly.

[0058] Optionally, the apparatus further comprises a detection unit, and the detection unit is configured to:

[0059] detect, in the script database, whether target script data corresponding to the target test case exists;

[0060] when the target script data corresponding to the target test case exists, performing a corresponding test operation based on the target script data;

[0061] when the target script data corresponding to the target test case does not exist, obtaining a target statement of the target test case, and performing a corresponding test operation based on the target statement.

[0062] In a third aspect, the present application provides a test execution device, comprising: at least one communication interface; at least one bus connected with the at least one communication interface; at least one processor connected with the at least one bus; and at least one memory connected with the at least one bus, wherein the processor is configured to:

[0063] obtain a target statement corresponding to a target test case, the target statement being determined according to a test step of the target test case;

[0064] invoke a pre-trained task generation model, input the target statement into the task generation model, so that the task generation model outputs a task sequence comprising at least one task;

[0065] perform a test operation corresponding to the target test case according to the task sequence.

[0066] In a fourth aspect, the present application provides a computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the test execution method described above.

[0067] Compared with the prior art, the above technical solution provided by the embodiments of the present application has the following advantages: in the embodiments of the present application, a target statement corresponding to a target test case is obtained, the target statement being determined according to a test step of the target test case; a pre-trained task generation model is invoked, the target statement is input into the task generation model, so that the task generation model outputs a task sequence comprising at least one task; and a test operation corresponding to the target test case is performed according to the task sequence. As can be seen, the present application can execute a test based on a test case without writing a test script, thereby fundamentally avoiding problems such as syntax errors, logical loopholes or element positioning deviations that may occur when a script is manually written, and significantly improving the accuracy of test results. BRIEF DESCRIPTION OF DRAWINGS

[0068] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0069] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0070] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0071] Figure 1 A flowchart illustrating a test execution method provided in an embodiment of this application;

[0072] Figure 2 A flowchart illustrating a task sequence determination method provided in an embodiment of this application;

[0073] Figure 3 A flowchart illustrating a test operation execution method provided in an embodiment of this application;

[0074] Figure 4 A flowchart illustrating a task category determination method provided in an embodiment of this application;

[0075] Figure 5 A flowchart illustrating an index number determination method provided in an embodiment of this application;

[0076] Figure 6 A flowchart illustrating a script data storage method provided in an embodiment of this application;

[0077] Figure 7 A flowchart illustrating a script data detection method provided in an embodiment of this application;

[0078] Figure 8 A schematic diagram illustrating a test execution method provided in an embodiment of this application;

[0079] Figure 9 This is a schematic flowchart of a test execution device provided in an embodiment of this application;

[0080] Figure 10 This is a schematic diagram of a test execution device provided in an embodiment of this application. Detailed Implementation

[0081] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0082] The following disclosure provides many different embodiments, or examples, for implementing different structures of the present application. For the purpose of simplifying the present application, components and arrangements of specific examples are described below. Of course, they are merely examples and are not intended to limit the present application. In addition, reference numbers and / or letters can be repeated in different examples. Such repetition is for the purpose of simplification and clarity, and does not indicate a relationship between the various embodiments and / or arrangements discussed.

[0083] In the software test process, test cases and test scripts are indispensable important parts. The test case is a detailed plan for the test target, operation steps, input data and expected results, like a blueprint of test action; the test script is a code written based on a programming language or an automation tool, used to automatically execute the operations in the test case, to realize test process automation. In the related art, the test script is written by a technician on a code tool according to the test case. However, when there are a large number of test cases, a large number of test scripts need to be written by the technician, however, the energy of the technician is limited, and human negligence may cause code logic errors, affecting the test results.

[0084] In order to solve the above problems, the embodiments of the present application provide a test execution method, which can execute tests based on test cases without writing test scripts, fundamentally avoiding syntax errors, logical loopholes or element positioning deviations that may occur when scripts are manually written, and significantly improving the accuracy of test results. As shown in Figure 1 The specific steps include:

[0085] Step 101, a target statement corresponding to a target test case is obtained.

[0086] The target statement is determined according to the test steps of the target test case, and is a descriptive statement of the test steps.

[0087] In this step, the skilled person can pre-configure a test case table containing serial numbers, test cases and corresponding statements, and import it into the test system. After importing it into the test system, the system will start execution from the first test case in order: determine the current test case as the target test case, extract its corresponding statement as the target statement, and then start the test method described in this application based on the statement. After completing the execution of a single test case, the system will automatically flow to the next test case according to the same logic, parse and execute the corresponding statement one by one, until all entries in the test case table are traversed, and the automatic execution of full-amount test operation is completed.

[0088] Step 102, calling a pre-trained task generation model, inputting the target statement into the task generation model, so that the task generation model outputs a task sequence including at least one task.

[0089] The task sequence is an ordered set composed of at least one task, and each task is used to instruct the test system to perform a corresponding test operation. Each task can correspond to a single or multiple operation instructions: when it corresponds to only one operation instruction, the task behaves as a single action; if it corresponds to multiple operation instructions, the task constitutes an ordered operation instruction sequence. The pre-trained task generation model can use a large model or other machine learning model architecture, and the specific type is not limited. Its training method is consistent with the prior art system, which will not be described in detail here.

[0090] In this step, a preset interface is obtained, and the pre-trained task generation model is called through the preset interface to input the target statement into the task generation model to obtain a task sequence including at least one task.

[0091] Step 103, according to the task sequence, executing the test operation corresponding to the target test case.

[0092] In this step, the test system will execute the tasks in the preset order of the task sequence to execute the test operation corresponding to the target test case.

[0093] In the embodiments of the present application, the target statement corresponding to the target test case is obtained, the target statement is determined according to the test steps of the target test case; a pre-trained task generation model is called, and the target statement is input into the task generation model, so that the task generation model outputs a task sequence including at least one task; according to the task sequence, the test operation corresponding to the target test case is executed. It can be seen that the present application can execute tests based on test cases without writing test scripts, which fundamentally avoids syntax errors, logical loopholes or element positioning deviations that may occur when scripts are manually written, and significantly improves the accuracy of test results.

[0094] In the embodiments of the present application, the pre-trained task generation model can be a single neural network model or a hybrid architecture including multiple algorithm modules and neural network modules. By synergistically invoking these algorithm modules and neural network modules, multi-dimensional and multi-strategy comprehensive decision-making can be achieved, thereby more accurately generating test cases that meet the requirements. When the task generation model is a hybrid architecture, the task generation model includes a text recognition module, a generation module, and a sorting module. The text recognition module can identify keywords in the target sentence and sort the keywords according to their positions in the target sentence to obtain a keyword sequence. The generation module can generate corresponding tasks according to the keywords to obtain a task sequence. Therefore, the embodiments of the present application provide a task sequence determination method, as shown in Figure 2

[0095] Step 201: identifying a target sentence by a text recognition module to obtain a keyword sequence including at least one keyword.

[0096] The text recognition module can be a machine learning module or not. When the text recognition module is not a machine learning module, the text recognition module can use keywords in a keyword library to identify keywords in the target sentence and sort the keywords to obtain a keyword sequence.

[0097] In this step, the target sentence is input into the text recognition module to enable the text recognition module to identify the target sentence, identify keywords in the target sentence, and sort the keywords to obtain a keyword sequence.

[0098] Step 202: analyzing each keyword in the keyword sequence by a generation module to obtain a task corresponding to each keyword.

[0099] The generation module is a machine learning module, and its input is a keyword and its output is a task corresponding to the keyword.

[0100] In this step, each keyword in the keyword sequence is obtained, and these keywords are input into the generation module in sequence to obtain tasks corresponding to these keywords.

[0101] Step 203: sorting tasks by a sorting module according to the positions of corresponding keywords in the keyword sequence to obtain a task sequence including at least one task.

[0102] In this step, after obtaining a task corresponding to each keyword, the sorting module sorts these tasks according to the positions of corresponding keywords in the keyword sequence to obtain a task sequence.

[0103] ​For example, the target sentence is to open XX page, enter username and password 123 in the page, and click the login button. The target sentence is input into the character recognition module to obtain a plurality of keywords, keyword 1 is to open XX page, keyword 2 is to enter username, keyword 3 is to enter password 123, and keyword 4 is to click the login button. Keyword 1 is input into the generation module to obtain task 1 corresponding to keyword 1, where task 1 indicates opening XX page. Keyword 2 is input into the generation module to obtain task 2 corresponding to keyword 2, where task 2 indicates entering username in the username input box. Keyword 3 is input into the generation module to obtain task 3 corresponding to keyword 3, where task 3 indicates entering password in the password input box. Keyword 4 is input into the generation module to obtain task 4 corresponding to keyword 4, where task 4 indicates clicking the login button. Finally, the sorting module is used to sort task 1, task 2, task 3, and task 4 to obtain the task sequence {task 1, task 2, task 3, and task 4}.

[0104] In the embodiment of the present application, when the task does not need to operate the page element, the task can be directly executed, for example, when the operation of "opening a specified page" or "closing the current page" is executed, the system can directly respond to the switching or closing of the page. When the task involves page element processing, the specific page element to be operated needs to be determined first, and then the test operation is performed on the page element. Therefore, the present application provides a test operation execution method, as shown in Figure 3

[0105] Step 301, determine the category of the task in the task sequence.

[0106] In this step, generally speaking, the first task in the task sequence is generally to open a page, and the last task is generally to close the webpage. These two tasks do not need to operate the specific page element, so the category of these two tasks can be determined as the first category, and the category of the other tasks can be determined as the second category. Although this category setting method is simple, it has certain errors. In order to avoid such errors, the task corresponding keywords can be identified to determine whether the specific page element needs to be operated. When the specific page element does not need to be operated, the category of the task is determined as the first category, and when the specific page element needs to be operated, the category of the task is determined as the second category. Of course, other methods can also be used to determine the category of the task, which is not limited here.

[0107] Step 302, when the category is the first category, performing the corresponding test operation according to the task.

[0108] The first category indicates that the corresponding task does not need to operate the page element. ​

[0109] In this step, when the category of the task is the first category, the task is directly returned to the test system, so that the test system performs a corresponding test operation based on the task.

[0110] Step 303, when the category is the second category, obtaining the document object model data of the current test page, calling the task generation model, determining the index number of the page element to be operated according to the task and the document object model data, determining the page element to be operated in the current test page according to the index number, and performing a corresponding test operation on the page element to be operated according to the task.

[0111] The document object model data is the DOM data of the test page, which includes all page elements of the test page, attribute information corresponding to each page element, and an index number. The attribute information includes tag name, ID, etc. The second category indicates that the corresponding task needs to operate the page element. The task generation model is a large model based on a large amount of training, which can generate a task sequence according to a target sentence, and can also determine the index number of the page element used by the task according to the task and the document object model data.

[0112] In this step, when the category is the second category, the document object model data of the current test page is obtained in the test system, and the data and the task are input into the task generation model to output the index number of the page element to be operated. Then, the page element corresponding to the index number is found on the current test page, and then a corresponding test operation is performed on the page element to be operated according to the task.

[0113] In the embodiments of the present application, each task is generated based on a keyword, that is, the keyword reflects the content of the task, so when it is determined whether a task processes a page element, the keyword corresponding to the task can be obtained, the keyword is analyzed to determine whether there is a vocabulary related to the page element, if there is, it is determined that the task processes the page element, and the category is determined as the first category, if not, it is determined that the task does not process the page element, and the category is determined as the second category. Therefore, the present application provides a task category determination method, as shown in Figure 4 The specific steps include:

[0114] Step 401, obtaining the keyword corresponding to the task.

[0115] In this step, after obtaining the task, the task and the corresponding keyword can be stored for subsequent use. In the execution of this step, the corresponding keyword is obtained according to the task.

[0116] Step 402, determining whether the target vocabulary exists in the keyword.

[0117] wherein the target vocabulary is a vocabulary related to the page element.

[0118] In this step, the keyword can be input into the text recognition model, so that the text recognition model recognizes the keyword and detects whether the target vocabulary exists in the keyword.

[0119] For example, when the keyword is an input username, since the input operation is completed in the input box, the input is a vocabulary related to the input box element, i.e., the target vocabulary is input.

[0120] Step 403, when the target vocabulary does not exist in the keyword, the category of the task is determined as the first category.

[0121] In this step, when the target vocabulary does not exist in the keyword, it indicates that the task does not need to process the page element, and the category of the task can be determined as the first category.

[0122] Step 404, when the target vocabulary exists in the keyword, the category of the task is determined as the second category.

[0123] In this step, when the target vocabulary exists in the keyword, it indicates that the task needs to process the page element, and the category of the task can be determined as the second category.

[0124] In the embodiment of the present application, the task generation model further includes a probability determination module and a selection module, wherein the probability determination module can determine the similarity of each page element in the page element used by the task and the document object model data, and then obtain the probability corresponding to each page element according to the similarities. The selection module can filter out the page element corresponding to the maximum probability from the probabilities corresponding to each page element, and then determine the index number corresponding to the page element as the index number corresponding to the page element to be operated. Therefore, the present application provides an index number determination method, as shown in Figure 5 The specific steps include:

[0125] Step 501, the probability determination module processes the task and the document object model data to obtain the probability corresponding to each index number.

[0126] The probability determination module is a machine learning module, and can also be a non-machine learning module, which is not limited here. When the probability determination module is a non-machine learning module, the probability determination module can recognize the attribute information corresponding to each index number in the document object model data. For each index number, the similarity of the attribute information and the attribute information of the element involved in the task is calculated, and the similarity is determined as the probability corresponding thereto.

[0127] Step 502: By selecting a module, the index number corresponding to the highest probability is determined as the index number of the page element to be operated.

[0128] In this step, by selecting a module, the index number with the highest probability is chosen from the probabilities corresponding to these index numbers, and this index number is determined as the index number of the page element to be operated on.

[0129] In this embodiment, to optimize the reusability of the test process, script data generated during the test can be captured in real time and stored in a script database. When the test needs to be repeated later, it does not need to be rerun. Figure 1 The complete test process shown allows for direct access to stored script data from the database to start the test, significantly reducing computational resource consumption and time costs. This data persistence mechanism not only enables efficient reuse of test scripts but also improves the execution efficiency of automated tests by avoiding repetitive calculations, providing a resource optimization solution for large-scale testing scenarios. Therefore, this application embodiment provides a script data storage method, which is as follows: Figure 6 As shown, the specific steps include:

[0130] Step 601: Obtain the script data generated during the test.

[0131] Step 602: Obtain the target script data based on the preset template and script data.

[0132] In this step, to ensure that the script data is stored in a preset format, technicians can create a template in advance. After obtaining the script data, they can fill it into the preset template to generate the target script data.

[0133] Step 603: Store the target test cases and target script data in the script database.

[0134] In this step, the target test identifier corresponding to the target test case is obtained, and the target test identifier and target script data are stored in the script database.

[0135] The target test identifier is used to uniquely indicate the test case. It can be the sequence number corresponding to the target test case or other data that uniquely indicates the test case. There is no limitation here.

[0136] In this embodiment, when testing needs to be performed based on a target test case, the system can first search the script database to see if there is target script data corresponding to the test case. If matching data is found, the target script data can be directly called to start the test operation, avoiding the time-consuming process of repeatedly generating scripts; if no corresponding data is found in the database, then it is necessary to follow the steps outlined in the application. Figure 1The method re-executes a test operation. The database-based intelligent retrieval mechanism effectively improves test execution efficiency by preferentially reusing historical script data, and is particularly suitable for test scenarios that require repeated verification, thereby reducing the consumption of computing resources while ensuring test accuracy. Therefore, the embodiments of the present application provide a script data detection method, which comprises the following steps as shown in Figure 7 The specific steps include:

[0137] Step 701, in the script database, detecting whether there is target script data corresponding to a target test case.

[0138] In this step, when the target test case needs to be executed, the target test identifier corresponding to the target test case is obtained, and then in the script database, it is detected whether there is script data corresponding to the target test identifier. When the script data exists, the script data is the target script data, otherwise, there is no target script data.

[0139] Step 702, when there is target script data corresponding to the target test case, executing corresponding test operations based on the target script data.

[0140] In this step, when there is target script data corresponding to the target test case, the target script data is executed to execute the test operation corresponding to the target test case.

[0141] Step 703, when there is no target script data corresponding to the target test case, obtaining a target statement of the target test case, and executing corresponding test operations based on the target statement.

[0142] In this step, when there is no target script data corresponding to the target test case, the method is used to process the target statement and execute the corresponding test operation. Figure 1

[0143] In addition, as shown in Figure 8 ​As shown in the diagram, this application provides a schematic of a test execution method. The schematic includes a browser testing system, a proxy, and a large model. The testing system can send prompts corresponding to test cases to the large model via the proxy, allowing the large model to process the prompts and generate multiple tasks. Generally, the first task is to open a test page. Therefore, the first task can be sent to the testing system via the proxy to execute the opening of the test page. Then, the DOM data of the test page is sent to the large model via the proxy, allowing the large model to input the DOM data and the second task to obtain the index of the page element to be operated on. This index, along with the second task, is then returned to the testing system. Since the returned data may be unrecognizable and unprocessable by the testing system, the proxy can also be used to convert the data returned by the large model to obtain data in a preset format before sending it to the testing system.

[0144] The proxy includes interface methods written using the FastAPI library and format conversion methods. The interface methods can send data to a private large model, and the format conversion methods can convert the format of the data returned by the large model into JSON format so that the test system can process the converted data.

[0145] Alternatively, you can combine the pytest+allure library to write a method for generating test reports in HTML format, and then use this method to generate test reports.

[0146] like Figure 9 As shown, this application provides a test execution apparatus, which corresponds to the method embodiment, and specifically includes:

[0147] The acquisition unit 901 is used to acquire the target statement corresponding to the target test case, wherein the target statement is determined according to the test steps of the target test case;

[0148] Calling unit 902 is used to call a pre-trained task generation model, input the target statement into the task generation model, so that the task generation model outputs a task sequence including at least one task;

[0149] The execution unit 903 is used to execute the test operation corresponding to the target test case according to the task sequence.

[0150] Optionally, the task generation model includes a text recognition module, a generation module, and a sorting module, and the calling unit 902 is used for:

[0151] The target sentence is identified by the text recognition module to obtain a keyword sequence including at least one keyword;

[0152] The generation module analyzes each keyword in the keyword sequence to obtain a task corresponding to each keyword.

[0153] The sorting module sorts the tasks according to positions of the corresponding keywords in the keyword sequence to obtain a task sequence including at least one task.

[0154] Optionally, the execution unit 903 is configured to:

[0155] determine a category of a task in the task sequence;

[0156] when the category is a first category, perform a corresponding test operation according to the task;

[0157] when the category is a second category, obtain document object model data of a test page to be used, call the task generation model, determine an index number of a page element to be operated according to the task and the document object model data, determine the page element to be operated in the test page to be used according to the index number, and perform a corresponding test operation on the page element to be operated according to the task.

[0158] Optionally, the execution unit 903 is configured to:

[0159] obtain a keyword corresponding to the task;

[0160] determine whether a target vocabulary exists in the keyword, the target vocabulary being a vocabulary related to a page element;

[0161] when the target vocabulary does not exist in the keyword, determine the category of the task as the first category;

[0162] when the target vocabulary exists in the keyword, determine the category of the task as the second category.

[0163] Optionally, the task generation model includes a probability determination module and a selection module, and the execution unit 903 is configured to:

[0164] the probability determination module processes the task and the document object model data to obtain a probability corresponding to each index number;

[0165] the selection module determines an index number corresponding to a maximum probability as the index number of the page element to be operated.

[0166] Optionally, the apparatus further includes a storage unit 904, and the storage unit 904 is configured to:

[0167] obtain script data generated in a test process;

[0168] obtaining target script data according to the preset template and the script data;

[0169] storing the target test case and the target script data into the script database correspondingly.

[0170] Optionally, the apparatus further includes a detection unit 905, configured to:

[0171] detect whether the target script data corresponding to the target test case exists in the script database;

[0172] when the target script data corresponding to the target test case exists, perform a corresponding test operation based on the target script data;

[0173] when the target script data corresponding to the target test case does not exist, obtain a target statement of the target test case, and perform a corresponding test operation based on the target statement.

[0174] As shown in Figure 10 The embodiment of the present application provides a test execution device, which comprises a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete mutual communication through the communication bus 1004.

[0175] The memory 1003 is used for storing a computer program.

[0176] In an embodiment of the present application, the processor 1001 is used for executing the program stored in the memory 1003, and realizes the test execution method provided by any one of the preceding method embodiments, which comprises the following steps:

[0177] obtaining a target statement corresponding to a target test case, wherein the target statement is determined according to a test step of the target test case;

[0178] calling a pre-trained task generation model, inputting the target statement into the task generation model, so that the task generation model outputs a task sequence comprising at least one task;

[0179] performing a test operation corresponding to the target test case according to the task sequence.

[0180] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the test execution provided by any one of the preceding method embodiments.

[0181] The apparatus embodiments described above are only illustrative, and the units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.

[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, and the computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in the embodiments or some parts of the embodiments.

[0183] It should be understood that the terms used herein are for the purpose of describing particular example embodiments only and are not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order in which they are described, unless specifically indicated as such. It is also to be understood that additional or alternative steps can be employed.

[0184] The above description is merely illustrative of the application and should not be taken as limiting. Numerous modifications and variations underlying the general principles of the applications can be made by those of ordinary skill in the art without departing from the spirit or scope of the application. Therefore, the application is not to be limited to the embodiments described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A test execution method, characterized in that, The method includes: Obtain the target statement corresponding to the target test case, wherein the target statement is determined based on the test steps of the target test case; Invoke a pre-trained task generation model, input the target statement into the task generation model, so that the task generation model outputs a task sequence including at least one task; According to the task sequence, execute the test operations corresponding to the target test case.

2. The method according to claim 1, characterized in that, The task generation model includes a text recognition module, a generation module, and a sorting module. The step of calling a pre-trained task generation model and inputting the target sentence into the model, causing the model to output a task sequence including at least one task, includes: The target sentence is identified by the text recognition module to obtain a keyword sequence including at least one keyword; The generation module analyzes each keyword in the keyword sequence to obtain the task corresponding to each keyword. The sorting module sorts the tasks according to the position of the corresponding keywords in the keyword sequence to obtain a task sequence that includes at least one task.

3. The method according to claim 1, characterized in that, The step of executing the test operation corresponding to the target test case according to the task sequence includes: Determine the category to which the tasks in the task sequence belong; When the category is the first category, the corresponding test operation is executed according to the task; When the category is the second category, obtain the document object model data of the test page to be used; call the task generation model, and determine the index number of the page element to be operated on based on the task and the document object model data; determine the page element to be operated on in the test page to be used based on the index number; and perform the corresponding test operation on the page element to be operated on based on the task.

4. The method according to claim 3, characterized in that, Determining the category to which the task belongs includes: Obtain the keywords corresponding to the task; Determine whether the keywords contain target words, where the target words are words related to page elements; When the target word is not found in the keywords, the task category is determined as the first category; When the target word is present in the keywords, the task category is determined as the second category.

5. The method according to claim 3, characterized in that, The task generation model includes a probability determination module and a selection module. The step of invoking the task generation model, and determining the index number of the page element to be operated on based on the task and the document object model data, includes: The probability determination module processes the task and document object model data to obtain the probability corresponding to each index number. The selection module determines the index number of the page element to be operated on by identifying the index number corresponding to the highest probability.

6. The method according to claim 1, characterized in that, The method further includes: Retrieve script data generated during the test; Based on the preset template and the script data, the target script data is obtained; The target test cases and the target script data are stored in the script database accordingly.

7. The method according to claim 6, characterized in that, The method further includes: In the script database, check whether target script data corresponding to the target test case exists; When target script data corresponding to the target test case exists, the corresponding test operation is executed based on the target script data. When the target script data corresponding to the target test case does not exist, the target statement of the target test case is obtained, and the corresponding test operation is executed based on the target statement.

8. A test execution device, characterized in that, The device includes: The acquisition unit is used to acquire the target statement corresponding to the target test case, wherein the target statement is determined according to the test steps of the target test case; The calling unit is used to call a pre-trained task generation model, input the target statement into the task generation model, and make the task generation model output a task sequence including at least one task. An execution unit is used to execute the test operations corresponding to the target test case according to the task sequence.

9. A test execution device, characterized in that, include: At least one communication interface; At least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to: Obtain the target statement corresponding to the target test case, wherein the target statement is determined based on the test steps of the target test case; Invoke a pre-trained task generation model, input the target statement into the task generation model, so that the task generation model outputs a task sequence including at least one task; According to the task sequence, execute the test operations corresponding to the target test case.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the test execution method according to any one of claims 1 to 7.