Standardized test script generation method and device, electronic equipment and storage medium
Through semantic analysis and template matching automation generating standardized test script, the traditional test script is time -consuming and vulnerable to human errors, and a more efficient and reliable test script generation is realized.
Patent Information
- Application Number
- CN202411214789.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-01-28
AI Technical Summary
The traditional test scripting process relies on the expertise of test engineers, is time-consuming and susceptible to human errors, resulting in incomplete test coverage or inconsistency in test execution.
By obtaining the test requirements of software products, a semantic analysis is performed to determine the test script type, match the target script template and prototype template, and automatically generate standardized test script.
It reduces human error interference, improves the accuracy and efficiency of the test script, and ensures the efficiency and reliability of the test script standardization process.
Smart Images

Figure CN119377101A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for generating a standardized test script. Background Art
[0002] In the field of software testing, ensuring the quality of software products is crucial. Test scripts are documents that guide the testing process. They describe the steps and expected results of the test cases in detail.
[0003] The traditional test script writing process relies on the expertise of test engineers and requires converting informal, spoken test requirements into formal, standardized scripts. This process is not only time-consuming, but also prone to human errors, resulting in incomplete test coverage or inconsistent test execution. Summary of the invention
[0004] The present invention provides a method, device, electronic device and storage medium for generating a standardized test script, which can automatically generate a standardized test script, reduce interference caused by human errors and improve the accuracy of the test script.
[0005] In a first aspect, a method for generating a standardized test script is provided, comprising: Obtain testing requirement information for software products; By performing semantic analysis on the test requirement information, the test script type corresponding to the test requirement information is determined; Determine the target script template and target sample template that match the test script type; Based on the target sample template and the target script template, a standardized test script corresponding to the test requirement information is generated.
[0006] In a second aspect, a device for generating a standardized test script is provided, comprising: An acquisition module is used to obtain the test requirement information of the software product; An analysis module, used to determine the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information; A determination module, used for determining a target script template and a target sample template matching a test script type; The generation module is used to generate a standardized test script corresponding to the test requirement information based on the target sample template and the target script template.
[0007] According to a third aspect, an electronic device is provided, comprising: a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect or its various implementations.
[0008] According to a fourth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method according to the first aspect or its various implementations.
[0009] Through the technical solution provided by the present invention, after obtaining the test requirement information of the software product, the test script type corresponding to the test requirement information can be determined by performing semantic analysis on the test requirement information; then the target script template and the target sample template that match the test script type are determined; finally, based on the target sample template and the target script template, the standardized test script corresponding to the test requirement information is automatically generated. The technical solution in this application determines the test script type through semantic analysis, which can provide accurate type information for subsequent script standardization conversion, thereby enhancing the accuracy and efficiency of the entire test script processing flow. In addition, based on the target sample template and the target script template, the standardized test script corresponding to the test requirement information is automatically generated, which can reduce the interference of human errors while ensuring the efficiency and reliability of the test script standardization process.
[0010] It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present invention. Other features and advantages of the present invention will be described in detail in the following specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 A system architecture diagram of a standardized test script generation system provided in an embodiment of the present application; Figure 2 A flowchart of a method for generating a standardized test script provided in an embodiment of the present application; Figure 3 A flowchart of a method for generating a standardized test script provided in another embodiment of the present application; Figure 4 A schematic diagram of the structure of a device for generating a standardized test script provided in an embodiment of the present application; Figure 5 A schematic diagram of the structure of a device for generating a standardized test script provided in another embodiment of the present application; Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0013] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0014] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0015] In the field of software testing, ensuring the quality of software products is crucial. Test scripts are documents that guide the testing process. They describe the steps and expected results of the test cases in detail.
[0016] The traditional test script writing process relies on the expertise of test engineers and requires converting informal, spoken test requirements into formal, standardized scripts. This process is not only time-consuming, but also prone to human errors, resulting in incomplete test coverage or inconsistent test execution.
[0017] In order to solve the above technical problems, the present invention is to propose a method as follows Figure 1The standardized test script generation system shown in the figure is internally configured with a test script classifier 11, a test script standardization processing engine 12, and a script correction and intelligent optimization engine 13. The standardized test script generation system aims to automate and optimize the software testing process. By integrating the test script classifier 11 and the test script standardization processing engine 12, the test script automation and standardization are realized. The system first uses the test script classifier 11 to perform in-depth analysis and precise classification of the input test script using a large language model (LLM), and intelligently identifies and outputs the type of each script based on predefined entity rules and script classification sample libraries. The test script standardization processing engine 12 is deployed with a script template library and a sample template library. The test script standardization processing engine 12 can search for matching items (i.e., semantic mapping) in the script template library of the standard test based on the sample template library according to the type information provided by the classifier. Once a suitable template is found, the LLM automatically converts the colloquial expressions in the script into a structured standardized test script through script standardization processing, thereby generating an expected, machine-readable test script document. Manually verify each test script. When a script error occurs, the script correction and intelligent optimization engine 13 will self-learn the thinking process from script to classification based on the problem script and the results of manual verification, and automatically expand the script classification sample library of the first result, greatly reducing the probability of similar script errors, thereby reducing manual intervention and improving the efficiency of the automated testing process.
[0018] After introducing the application scenarios of the embodiments of the present invention, the technical solutions of the present invention will be described in detail below: Figure 2 A flowchart of a method for generating a standardized test script provided by an embodiment of the present invention, the method can be performed as follows Figure 1 The standardized test script generation system shown in Figure 1 is executed. Figure 2 As shown, the method may include the following steps: Step 210: Obtain test requirement information of the software product.
[0019] The test requirement information may include the test object, test scope, test content, and test time of the software product. By obtaining the test requirement information and automatically generating standardized test scripts based on the test requirement information, it is possible to convert informal and colloquial test requirements into formal and standardized scripts.
[0020] Step 220: Determine the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information.
[0021] For the embodiments of the present disclosure, a semantic analysis algorithm is used to perform semantic analysis on the test requirement information, and the test script type is determined through semantic analysis, which can provide accurate type information for the subsequent script standardization conversion, thereby enhancing the accuracy and efficiency of the entire test script processing flow. Among them, the semantic analysis algorithm can be a large language model (LLM), etc., which is not specifically limited here. In the following embodiment steps in the present disclosure, the technical solution in this application is explained by taking the use of LLM to perform in-depth analysis and precise classification of the input test requirement information, and intelligently identifying and outputting the test script type based on predefined entity rules and script classification sample libraries as an example, but it does not constitute a specific limitation.
[0022] In a specific application scenario, after determining the test script type corresponding to the test requirement information based on LLM, the matching result can be formatted as a JSON object to ensure that its structure is in the form of "Question", "Thought", and "Type". Then verify whether the generated JSON object meets the format requirements and can be correctly parsed by json.loads. After the verification is passed, the JSON object can be used as input, and first determine whether the Type value in the JSON object is in the pre-defined script category table. If it is in the script category table, the subsequent implementation steps are triggered. By determining whether the Type value in the JSON object is in the pre-defined script category table, the determined test script type can be avoided from being non-standard, further reducing the possibility of classification errors and improving the accuracy of classification.
[0023] Step 230: Determine a target script template and a target sample template that match the test script type.
[0024] In a specific application scenario, corresponding script templates and sample templates can be constructed in advance for different test script types, and the constructed multiple script templates can be stored in a script template library, and the constructed multiple sample templates can be stored in a sample template library. For the disclosed embodiment, after determining the test script type corresponding to the test requirement information, the target script template that matches the test script type can be directly extracted from the script template library, and the target sample template that matches the test script type can be extracted from the sample template library. By directly extracting the target script template and the target sample template in the library, the efficiency and reliability of the test script standardization process can be improved.
[0025] Step 240: Generate a standardized test script corresponding to the test requirement information based on the target sample template and the target script template.
[0026] For the embodiments of the present disclosure, after determining the target sample template and the target script template, based on the target script template and with reference to the target sample template, the corresponding fields in the test requirement information can be imported into the corresponding positions in the target script template to further generate a standardized test script corresponding to the test requirement information.
[0027] In summary, according to the method for generating standardized test scripts provided by the present invention, after obtaining the test requirement information of the software product, the test requirement information can be semantically analyzed to determine the test script type corresponding to the test requirement information; then determine the target script template and the target sample template that match the test script type; finally, based on the target sample template and the target script template, automatically generate the standardized test script corresponding to the test requirement information. The technical solution in the present application determines the test script type through semantic analysis, which can provide accurate type information for the subsequent script standardization conversion, thereby enhancing the accuracy and efficiency of the entire test script processing flow. In addition, based on the target sample template and the target script template, the standardized test script corresponding to the test requirement information is automatically generated, which can reduce the interference of human errors while ensuring the efficiency and reliability of the test script standardization process.
[0028] based on Figure 2 The embodiment shown is a refinement and extension of the above embodiment. In order to fully illustrate the specific implementation process of the method of this embodiment, this embodiment provides the following Figure 3 The specific method shown. Figure 3 based on Figure 2 As shown in 3, the method comprises the following steps: Step 310: Obtain test requirement information of the software product.
[0029] Step 320: input the test requirement information into the first language model, and use the first language model to determine the test script type corresponding to the test requirement information in the script category table based on the first preset model rule and preset script classification examples in the script classification sample library.
[0030] Among them, the first language model can be LLM, which is used to perform preliminary analysis and classification of the input test requirement information. In LLM, the test requirement information is identified according to the defined entity rules (i.e., the first preset model rules) and the preset script classification examples, and the identified test script type is used as output to provide a basis for the next step of standardization processing. The first preset model rule is to identify the first action keyword in the test requirement information, and select the preset test script type that matches the first action keyword from multiple preset test script types as the test script type corresponding to the test requirement information.
[0031] In a specific application scenario, multiple preset test script types may be pre-stored in the script category table, which may be customized according to actual business needs. For example, the script category table may include the following preset test script types: [click, input, check, return, slide, loop, wait, other].
[0032] In this stage, the first language model is instructed to play the role of a senior test engineer through role instructions. Its task is to classify the colloquial test requirement information according to semantics and output the type of the script, that is, the test script type, for subsequent use by automated testing tools. In order to enable the first language model to better complete the script classification task, some first preset model rules are added to the prompt word part of the first language model in this stage: First preset model rule 1: Below is a list of all script types. Note that for each input, only one type that best matches the current input can be selected. At this stage, the script category table only includes the following types (defined by the test group of the specific test task): [click, input, check, return, slide, loop, wait, other].
[0033] First preset model rule 2: Please find the key actions in the input script and think about the type of action to be performed. Make sure your answer must be in the correct json format and can be parsed by the `json.loads` library of the python language. The format is as follows: { "Question": "Description of test steps in script", "Thought": "Description of the thinking or decision logic in the identification and matching process", "Type": "Matched script type" } The two rules jointly restrict and determine the execution process of the first language model at this stage, namely: By providing a clear list of script types, the first language model can more accurately understand the scope of each input script should be classified. Requiring the first language model to select the most appropriate type from the predefined list of script types limits the scope of the output. In order to further reduce the possibility of classification errors, the accuracy of classification is improved. In this phase, a script classification sample library that meets the format requirements is also designed. Some examples of the script classification sample library are as follows: [ { "Question":"Enter my assets page", "Thought":"You need to click a button or menu to enter a certain page", "Type":"Click" }, { "Question":"Fill in wsy in the user name box", "Thought":"Filling in information requires input operations", "Type":"Input" }, { "Question":"Check the latest net worth", "Thought":"Viewing information requires checking behavior", "Type":"Inspection" } ] Question is the input for receiving the test script, which is a test step described in natural language. LLM is used to analyze the input script, extract key actions, match them with the predefined script type list (click, input, check, return, slide, loop, wait, and other), and determine the most suitable type for each key action as the test script type identified according to the test requirement information.
[0034] For the embodiment of the present disclosure, determining the test script type corresponding to the test requirement information in the script category table based on the first preset model rule and the preset script classification examples in the script classification sample library in step 320 may include the following steps: Step 320 - 1 : Based on preset script classification examples in a script classification sample library, determine at least one preset action keyword corresponding to each preset test script type in a plurality of preset test script types.
[0035] Among them, the preset script classification sample is a script classification sample generated for a certain test requirement information in the historical stage, which includes the input test requirement information "Question", the LLM thinking process "Thought" and the output test script type "Type".
[0036] The preset script classification samples in the script classification sample library may cover various preset test script types. For the disclosed embodiment, the preset action keywords corresponding to the test script type "Type" may be extracted based on the test requirement information "Question" in the preset script classification sample. Furthermore, for each preset test script type, at least one preset action keyword may be obtained.
[0037] For example, according to the preset script classification example {"Question":"Fill in wsy in the user name box", "Thought":"Filling in information requires input operation", "Type":"Input", it can be determined that the preset action keywords corresponding to the preset test script type "input" include "fill in"; according to the preset script classification example {"Question":"Write zp in the user name box", "Thought":"Writing information requires input operation", "Type":"Input", it can be determined that the preset action keywords corresponding to the preset test script type "input" also include "write".
[0038] Step 320 - 2 : Identify the first action keyword in the test requirement information.
[0039] For the disclosed embodiments, when the test requirement information is a test requirement text, the test requirement text can be directly segmented to obtain multiple words. After that, each word obtained by the segmentation can be analyzed for a part of speech, and a first action keyword with a corresponding part of speech of a verb can be extracted from the multiple words. When the test requirement information is other information types other than the test requirement text, the other information types can be first converted to a text type, and the above-mentioned processing can be further performed on the test requirement text under the text type to obtain the first action keyword in the test requirement information. Exemplarily, when the test requirement text is "fill in wer in the user name box", the first keyword that can be extracted is "fill in"; when the test requirement text is "open my asset page", the first keyword that can be extracted is "open"; when the test requirement text is "enter my asset page", the first keyword that can be extracted is "enter".
[0040] When converting other information types into text types, for example, when the other information type is a picture type, text extraction technology can be used to perform text extraction in the picture type test requirement information to obtain the test requirement text; when the other information type is a voice type, speech-to-text technology can be used to convert the voice type test requirement information into a text form of test requirement text.
[0041] Step 320 - 3 : Calculate the semantic similarity between the first action keyword and the preset action keyword.
[0042] For the disclosed embodiments, the first action keyword can be matched one by one with the preset action keyword of each preset test script type, and the semantic similarity can be calculated. When calculating the semantic similarity, the feature distance between the first action keyword and the preset action keyword can be calculated based on the preset distance calculation formula. The larger the feature distance, the smaller the semantic similarity; the smaller the feature distance, the greater the semantic similarity. The preset distance calculation formula may include but is not limited to the Euclidean distance calculation formula, the Ming distance calculation formula, the Mahalanobis distance calculation formula, etc.; in addition, the semantic similarity between the first action keyword and the preset action keyword can also be calculated based on the preset similarity calculation formula. The preset similarity calculation formula may include but is not limited to the cosine similarity calculation formula, the correlation coefficient calculation formula, etc.
[0043] Step 320 - 4 : Based on the semantic similarity, select a preset test script type from multiple preset test script types as the test script type corresponding to the test requirement information.
[0044] After traversing and calculating multiple semantic similarities between the first action keyword and multiple preset action keywords, a preset test script type with the maximum semantic similarity and / or a semantic similarity greater than a preset threshold among the multiple semantic similarities can be used as the test script type corresponding to the test requirement information. The preset threshold is a value between 0 and 1, and the specific value can be set according to the actual application scenario.
[0045] For example, when the test requirement text is "Open my asset page", the first keyword extracted is "Open". After calculating the semantic similarity between "Open" and the preset action keyword, the semantic similarity between "Open" and the preset action keyword "Click" is the highest, so it can be determined that the test script type corresponding to the test requirement information is "Click".
[0046] In a specific application scenario, as a possible implementation method, after obtaining the test script type corresponding to the test requirement information, the test script type can be formatted as a JSON object to ensure that its structure is in the form of "Question", "Thought", and "Type". Afterwards, it can be verified whether the generated JSON object meets the format requirements and can be correctly parsed by json.loads. If it is determined that the generated JSON object meets the format requirements and can be correctly parsed by json.loads, the subsequent embodiment step 330 can be executed based on the JSON object.
[0047] Step 330: Determine a target script template and a target sample template that match the test script type.
[0048] For the embodiment of the present disclosure, the target script template and the target sample template that match the test script type can be determined through semantic mapping. Accordingly, the determination of the target script template and the target sample template that match the test script type in step 330 can include the following steps: Step 330 - 1 : Determine a preset action keyword corresponding to the test script type as a second action keyword.
[0049] Step 330 - 2 : extract the target script template corresponding to the second action keyword from the script template library.
[0050] The script template library stores multiple script templates, and each of the multiple script templates matches a different preset action keyword. For example, the script templates in the script template library may be: { "Click": [ "[Click【】]", "[Click the nth []]", "[Click【】up / down / left / right【】]" ], "enter":[ "[Enter [ ] to the nth up / down / left / right]", "[Enter []] up / down / left / right", "[Enter [] to []]" ], "examine":[ "[Check【】nth【】upper / lower / left / right object]", "[Check【】n【】]", "[Check the nth【】upper / lower / left / right content【】【】]", "[examine【】【】]" ], "return":[ "[Return to Home Screen]", "[return]" ], "slide":[ "[Slide towards [] n times]", "[Slide towards [] to []]" ], "cycle":[ "[Loop starts n times]", "[if 【】【】jump out of loop]", "[If the []th []upper / lower / left / right content [] [] jumps out of the loop]", "[End of loop]" ], "wait":[ "[Wait for [] to appear]", "[wait n seconds]" ], "other":[ "[Gesture password【】]", "[Secure Keyboard【】]", "[Scroll box search【】]", "[Date scroll box【】]" ], } The target script template includes multiple script information corresponding to the second action keyword. For example, when the second action keyword is "click", the target script template corresponding to "click" can be extracted from the script template library: [ "[Click【】]", "[Click the nth []]", "[Click【】up / down / left / right【】]", ] Step 330 - 3 : extract the target sample template corresponding to the second action keyword from the sample template library.
[0051] The sample template library stores multiple sample templates, and each of the multiple sample templates matches a different preset action keyword. For example, the sample templates in the sample template library may be: "Click": [ { "Question": "Enter xxx page", "Answer": "Click xxx" }, { "Question": "Press the nth xxx", "Answer": "Click the nth xxx" }, { "Question": "a chooses b on the right", "Answer": "Click b on the right side of a" } ], "enter":[ { "Question": "Enter password xxx", "Answer": "Enter xxx for the password" }, { "Question": "aFill in xx", "Answer": "Enter xx into a" } ], "examine":[ { "Question": "View xxx", "Answer": "Pick up xxx" }, { "Question": "View a's xxx", "Answer": "Check a" }, ], The target sample template includes multiple sample scripts corresponding to the second action keyword. For example, when the second action keyword is "click", the target sample template corresponding to "click" can be extracted from the sample template library: { "Question": "Enter xxx page", "Answer": "Click xxx" }, { "Question": "Press the nth xxx", "Answer": "Click on the nth xxx" }, { "Question": "a chooses b on the right", "Answer": "Click b on the right side of a" } Step 340: input the test requirement information, the target sample template and the target script template into the second largest language model, and generate a standardized test script corresponding to the test requirement information based on the target script template using the second largest language model based on the second preset model rules and with reference to the script format in the target sample template.
[0052] The second largest language model can be LLM. In this embodiment, the second largest language model can be used as a senior test engineer to standardize the spoken test script description for subsequent automated test tools. The addition of specific prompt word requirements is to improve the accuracy and efficiency of the second largest language model in the test script standardization task, that is, the second preset model rule.
[0053] Second preset model rule 1: There is the following standard test script template, in which [] is the business keyword to be retained and n is the number. The standard test script template is Template, and only the converted test script description is output.
[0054] Second preset model rule 2: Please select the appropriate template for conversion based on the keywords in the input script, and make sure your answer is in the correct json format and can be parsed by the "json.loads" library of the python language. For example: Example. The format is as follows: { "Question": "Spoken test script" "Answer": "Result after conversion" } Among them, Template is the [target script template] obtained in the previous semantic mapping stage, and Example is the [target sample template] obtained. The second largest language model performs the operation of standardizing the test script according to the second preset model rule 1 and the second preset model rule 2. Assuming that the colloquial test script input by the user is: "Enter my asset page", after the standardization engine of this stage acts, the output is: { "Question": "Enter my assets page", "Answer": "Click [My Assets Button]", } In a specific application scenario, after a standardized test script is generated based on the target sample template and the target script template, as a possible implementation method, special character processing can be performed on the standardized test script: In the second preset model rule 1, it is stipulated that [ ] is a business keyword that needs to be retained. This processing is performed in the previous step to minimize the impact of business keywords on script standardization. However, during output, [ ] will affect the script, so a post-processing is performed. When [ ] or [ ] exists in the Answer, it is replaced with empty, and finally the result is output. Correspondingly, the standardized test script after special character processing can be: { "Question": "Enter my assets page", "Answer": "Click the My Assets button", } For the embodiment of the present disclosure, in step 340, based on the second preset model rule and with reference to the script format in the target sample template, generating a standardized test script corresponding to the test requirement information on the basis of the target script template may include the following steps: Step 340 - 1 : Select a target sample script containing a first action keyword from multiple sample scripts, and select target script information matching the target sample script from multiple script information.
[0055] Correspondingly, when the test requirement text is "enter my asset page", the first keyword extracted is "enter". A target sample script containing the first action keyword can be selected from multiple sample scripts: { "Question": "Enter xxx page", "Answer": "Click xxx" } Correspondingly, the target script information that matches the target sample script can be selected from multiple script information: "[Click [ ]]".
[0056] Step 340 - 2 : Based on the target script information, generate a standardized test script corresponding to the test requirement information in a preset script generation format, where the preset script generation format is a script generation format corresponding to the target sample script.
[0057] For example, when the test requirement text included in the test requirement information is "enter my asset page", the first action keyword is determined to be "enter", the test script type matching the first action keyword is determined, and the preset action keyword corresponding to the test script type, that is, the "second action keyword" is "click". Further, the target sample template corresponding to the second action keyword "click" can be determined, and multiple sample scripts corresponding to the second action keyword "click" are included in the target sample template: "Click": [ { "Question": "Enter xxx page", "Answer": "Click xxx" }, { "Question": "Press the nth xxx", "Answer": "Click the nth xxx" }, { "Question": "a chooses b on the right", "Answer": "Click b on the right side of a" } ] Then, a target sample script containing the first action keyword "enter" may be selected from the multiple sample scripts: { "Question": "Enter xxx page", "Answer": "Click xxx" } Similarly, a target script template corresponding to the second action keyword "click" can be determined, and the target script template contains multiple script information corresponding to the second action keyword: [ "[Click【】]", "[Click the nth []]", "[Click【】up / down / left / right【】]", ] Furthermore, the target script information that matches the target sample script can be extracted from the multiple script information corresponding to the second action keyword, which is "[click【】]".
[0058] For the embodiment of the present disclosure, based on the target script information and the target sample script, the standardized test script finally generated is: { "Question": "Enter my assets page", "Answer": "Click the My Assets button" } In specific application scenarios, in order to ensure the accuracy of the generated test script, the standardized test script can be verified after it is generated. Assuming that the input colloquial test script is: payment method selection [given bank card], the output result should be: click [given bank card], but the final output script is: scroll box to find [given bank card]. The reason for the analysis is that the test script classifier did not identify it as "click", but identified it as the default "other" type, which led to the script generation with the wrong script template and sample when the test script was standardized in the second phase. To address this problem, the tester will send the colloquial script and the correct script type to the script correction and intelligent optimization engine, aiming to perform quality control and error correction on the output of the test script classifier and the test script standardization processing engine. In this phase, the self-learning of the classified script samples is completed, and the generated samples are filled into the script sample library of the first phase, so as to minimize manual intervention and improve the efficiency of the automated testing process.
[0059] Correspondingly, as a preferred method, the implementation steps may also include: performing script type verification on the standardized test script; when it is determined that the standardized test script fails the script type verification, determining that the test requirement information corresponds to the correct test script type; based on the test requirement information and the correct test script type, performing script sample self-learning training on the first language model; and / or, based on the test requirement information and the correct test script type, generating a script classification sample, and updating the script classification sample to the script classification sample library.
[0060] Script sample self-learning training means that in this stage, the first language model is used as a senior tester to give its thinking process for a given script and type, and output a structure similar to the script classification sample library to facilitate the expansion of the script classification sample library. In order to allow the first language model to better complete the task, the prompt word part is made as required by the first preset model rule 3 in this stage.
[0061] First preset model rule 3: Please give your thoughts on finding the key actions based on the input script and the type of action to be performed, and make sure your answer must be in the correct JSON format and can be parsed by the `json.loads` library of the Python language. The format is as follows: { "Question": "Description of test steps in script", "Thought": "Description of the thinking or decision logic in the identification and matching process", "Type": "Matched script type" } Here, the first language model will give a description of the thinking or decision logic in the recognition and matching process based on the script description and the script type that should be matched, such as: The tester will first check the output Type type, because the script type contains the "other" type, such as the error script mentioned above: the payment method is selected [given bank card], LLM will give the output as: { "Question": "Payment method selection [given bank card]", "Thought": "The selection process needs to be performed by clicking a button or menu", "Type": "Click" } In addition, in this stage, the test script classification samples output by LLM will be automatically filled into the script classification sample library of the test script classifier, so that next time there is a similar spoken script, the correct standardized test script will be given after the entire process is executed.
[0062] In summary, the technical solution in this application can determine the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information after obtaining the test requirement information of the software product; then determine the target script template and target sample template that match the test script type; finally, based on the target sample template and the target script template, automatically generate the standardized test script corresponding to the test requirement information. The technical solution in this application determines the test script type through semantic analysis, which can provide accurate type information for subsequent script standardization conversion, thereby enhancing the accuracy and efficiency of the entire test script processing flow. In addition, based on the target sample template and the target script template, the standardized test script corresponding to the test requirement information is automatically generated, which can reduce the interference of human errors while ensuring the efficiency and reliability of the test script standardization process.
[0063] Based on the above Figure 2 , Figure 3 A detailed description of the method for generating standardized test scripts is provided, such as Figure 4 As shown, Figure 4 FIG. 1 is a block diagram of a device for generating a standardized test script according to an exemplary embodiment. Figure 4 As shown, the device comprises: The acquisition module 41 can be used to obtain the test requirement information of the software product; The analysis module 42 may be used to determine the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information; A determination module 43, which can be used to determine a target script template and a target sample template that match the test script type; The generating module 44 may be used to generate a standardized test script corresponding to the test requirement information based on the target sample template and the target script template.
[0064] In some embodiments of the present application, the analysis module 42 can be specifically used to input the test requirement information into the first large language model, and use the first large language model to determine the test script type corresponding to the test requirement information in the script category table based on the first preset model rules and preset script classification examples in the script classification sample library.
[0065] In some embodiments of the present application, a plurality of preset test script types are stored in a script category table; when determining the test script type corresponding to the test requirement information in the script category table based on the first preset model rule and the preset script classification examples in the script classification sample library, the analysis module 42 can be specifically used to determine at least one preset action keyword corresponding to each preset test script type in the plurality of preset test script types based on the preset script classification examples in the script classification sample library; identify the first action keyword in the test requirement information; calculate the semantic similarity between the first action keyword and the preset action keyword; and based on the semantic similarity, select a preset test script type from the plurality of preset test script types as the test script type corresponding to the test requirement information.
[0066] In some embodiments of the present application, the determination module 43 can be specifically used to determine the preset action keyword corresponding to the test script type as the second action keyword; extract the target script template corresponding to the second action keyword from the script template library, wherein the script template library stores multiple script templates, and each of the multiple script templates is matched with a different preset action keyword; extract the target sample template corresponding to the second action keyword from the sample template library, wherein the sample template library stores multiple sample templates, and each of the multiple sample templates is matched with a different preset action keyword.
[0067] In some embodiments of the present application, the generation module 44 can be specifically used to input the test requirement information, the target sample template and the target script template into the second largest language model, and use the second largest language model to generate a standardized test script corresponding to the test requirement information based on the target script template based on the second preset model rules and with reference to the script format in the target sample template.
[0068] In some embodiments of the present application, the target script template contains multiple script information corresponding to the second action keyword, and the target sample template contains multiple sample scripts corresponding to the second action keyword; when generating a standardized test script corresponding to the test requirement information based on the target script template based on the second preset model rule and with reference to the script format in the target sample template, the generation module 44 can be specifically used to select a target sample script containing the first action keyword from multiple sample scripts, and to select target script information matching the target sample script from multiple script information; based on the target script information, generate a standardized test script corresponding to the test requirement information in a preset script generation format, and the preset script generation format is the script generation format corresponding to the target sample script.
[0069] In some embodiments of the present application, Figure 5 As shown, the device also includes: A verification module 45, which can be used to perform script type verification on the standardized test script; A determination module 46, which can be used to determine that the test requirement information corresponds to a correct test script type when it is determined that the standardized test script fails the script type verification; The training module 47 can be used to perform script sample self-learning training on the first language model based on the test requirement information and the correct test script type; and / or, The updating module 48 may be used to generate a script classification sample based on the test requirement information and the correct test script type, and update the script classification sample to the script classification sample library.
[0070] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0071] The embodiments of the present application and the technical solutions disclosed in the present invention can determine the test script type corresponding to the test requirement information by semantically analyzing the test requirement information after obtaining the test requirement information of the software product; then determine the target script template and the target sample template that match the test script type; and finally, automatically generate the standardized test script corresponding to the test requirement information based on the target sample template and the target script template. The technical solutions in the present application can provide accurate type information for the subsequent script standardization conversion by determining the test script type through semantic analysis, thereby enhancing the accuracy and efficiency of the entire test script processing flow. In addition, based on the target sample template and the target script template, the standardized test script corresponding to the test requirement information is automatically generated, which can reduce the interference of human errors while ensuring the efficiency and reliability of the test script standardization process.
[0072] In the above text, the device for generating a standardized test script according to an embodiment of the present invention is described from the perspective of a functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in the form of hardware, can be implemented in the form of software instructions, or can be implemented in the form of a combination of hardware and software modules. Specifically, the steps of the method for generating a standardized test script in the embodiment of the present invention can be completed by the hardware integrated logic circuit and / or software instructions in the processor, and the steps of the method for generating a standardized test script in conjunction with the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or can be completed by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above-mentioned method for generating a standardized test script in conjunction with its hardware.
[0073] Figure 6 is a schematic block diagram of an electronic device 600 according to an embodiment of the present invention.
[0074] like Figure 6 As shown, the electronic device 600 may include: The memory 610 and the processor 620, the memory 610 is used to store the computer program and transmit the program code to the processor 620. In other words, the processor 620 can call and run the computer program from the memory 610 to implement the method in the embodiment of the present invention.
[0075] For example, the processor 620 may be configured to execute the above method embodiments according to instructions in the computer program.
[0076] In some embodiments of the present invention, the processor 620 may include but is not limited to: General-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0077] In some embodiments of the present invention, the memory 610 includes but is not limited to: Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
[0078] In some embodiments of the present invention, the computer program may be divided into one or more modules, which are stored in the memory 610 and executed by the processor 620 to complete the method provided by the present invention. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the controller.
[0079] like Figure 6 As shown, the electronic device 600 may further include: The transceiver 630 may be connected to the processor 620 or the memory 610 .
[0080] The processor 620 may control the transceiver 630 to communicate with other devices, specifically, to send data to other devices or receive data sent by other devices. The transceiver 630 may include a transmitter and a receiver. The transceiver 630 may further include an antenna, and the number of antennas may be one or more.
[0081] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0082] The present invention also provides a computer storage medium having a computer program stored thereon, which, when executed by a computer, enables the computer to perform the method of the above method embodiment. In other words, an embodiment of the present invention also provides a computer program product containing instructions, which, when executed by a computer, enables the computer to perform the method of the above method embodiment.
[0083] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (Digital Video Disc, DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0084] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments applied herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0085] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or modules, which can be electrical, mechanical or other forms.
[0086] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0087] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this application, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for generating a standardized test script, characterized in that: include: Obtain testing requirement information for software products; Determine the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information; Determine a target script template and a target sample template that match the test script type; Based on the target sample template and the target script template, a standardized test script corresponding to the test requirement information is generated.
2. The method according to claim 1, characterized in that The determining the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information includes: The test requirement information is input into a first large language model, and the test script type corresponding to the test requirement information is determined in a script category table using the first large language model based on a first preset model rule and preset script classification examples in a script classification sample library.
3. The method according to claim 2, characterized in that The script category table stores a plurality of preset test script types; The step of determining the test script type corresponding to the test requirement information in the script category table based on the first preset model rule and the preset script classification examples in the script classification sample library includes: Determine at least one preset action keyword corresponding to each preset test script type in the plurality of preset test script types based on preset script classification samples in the script classification sample library; Identifying a first action keyword in the test requirement information; Calculating the semantic similarity between the first action keyword and the preset action keyword; Based on the semantic similarity, a preset test script type is selected from the multiple preset test script types as the test script type corresponding to the test requirement information.
4. The method according to claim 3, characterized in that The step of determining a target script template and a target sample template that match the test script type includes: Determine a preset action keyword corresponding to the test script type as a second action keyword; Extracting a target script template corresponding to the second action keyword from a script template library, wherein the script template library stores a plurality of script templates, and each of the plurality of script templates matches a different preset action keyword; A target sample template corresponding to the second action keyword is extracted from a sample template library, wherein the sample template library stores a plurality of sample templates, and each of the plurality of sample templates matches a different preset action keyword.
5. The method according to claim 4, characterized in that The step of generating the standardized test script based on the target sample template and the target script template includes: The test requirement information, the target sample template and the target script template are input into a second language model, and the second language model is used to generate a standardized test script corresponding to the test requirement information based on the target script template based on a second preset model rule and with reference to the script format in the target sample template.
6. The method according to claim 5, characterized in that The target script template includes a plurality of script information corresponding to the second action keyword, and the target sample template includes a plurality of sample scripts corresponding to the second action keyword; The step of generating a standardized test script corresponding to the test requirement information based on the target script template based on the second preset model rule and with reference to the script format in the target sample template includes: Selecting a target sample script containing the first action keyword from the multiple sample scripts, and selecting target script information matching the target sample script from the multiple script information; Based on the target script information, a standardized test script corresponding to the test requirement information in a preset script generation format is generated, and the preset script generation format is a script generation format corresponding to the target sample script.
7. The method according to claim 2, characterized in that The method further comprises: Performing script type verification on the standardized test script; When it is determined that the standardized test script fails to pass the script type verification, determining that the test requirement information corresponds to a correct test script type; Based on the test requirement information and the correct test script type, performing script sample self-learning training on the first language model; and / or, Based on the test requirement information and the correct test script type, a script classification sample is generated, and the script classification sample is updated to the script classification sample library.
8. A device for generating a standardized test script, characterized in that: include: An acquisition module is used to obtain the test requirement information of the software product; An analysis module, configured to determine the test script type corresponding to the test requirement information by performing semantic analysis on the test requirement information; A determination module, used to determine a target script template and a target sample template that match the test script type; A generation module is used to generate a standardized test script corresponding to the test requirement information based on the target sample template and the target script template.
9. An electronic device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Functional security auxiliary authentication method and system based on large language model
CN121234904A