UI automatic test method, device, medium and system
Through large language model and literary graph model technology, business requirement description text is processed, business model diagrams are generated, and UI automated testing is realized, complex business demand testing problems are solved and testing efficiency is improved.
Patent Information
- Application Number
- CN202510141816.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2025-04-25
AI Technical Summary
The existing UI automation testing technology is difficult to directly conduct tests of complex business needs, and the maintenance cost of test scripts in traditional mode is high, and it lacks the flexible execution ability to simulate real user operations.
The business requirement description text is processed by large language model technology and literary graph model technology, the target business model diagram is generated, and the test step files and test scripts are generated based on this to realize UI automated testing.
By simplifying complex business needs and generating target business model diagrams that reflect business needs, we can automatically assemble and execute test scripts while generating test cases, improving the efficiency of automated testing.
Smart Images

Figure CN119883934A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of UI testing technology, and in particular to a UI automated testing method, device, medium and system. Background Art
[0002] During the software testing process, it is difficult to cover all functions, rules or processes by simply using manual testing, and the software quality assurance effect is not good. UI automation testing can effectively alleviate the above problems. However, when faced with the testing tasks of complex professional software, traditional UI automation testing technology has the following shortcomings: (1) UI automation testing of complex professional software requires testers to have high testing and programming skills, as well as a deep understanding of the business requirements to be achieved by the system, which makes implementation difficult; (2) The traditional UI automation testing model solidifies the functions, rules or processes of the business system in the test script, lacks the flexible execution ability to simulate real user operations, and has high script maintenance costs.
[0003] That is, the existing solution cannot directly perform UI automation testing for more complex business requirements. Summary of the invention
[0004] The main purpose of the present application is to provide a UI automation testing method, device, medium and system to at least solve the problem that the existing solutions cannot directly perform UI automation testing for more complex business needs.
[0005] In order to achieve the above object, according to one aspect of the present application, a UI automation testing method is provided, the method comprising:
[0006] Obtain a business requirement description text, and use a large language model technology and a text graph model technology to process the business requirement description text to obtain a target business model graph, wherein the business requirement description text represents the text content describing the business requirement;
[0007] Generate a test step file based on the target business model diagram, and read and assemble the test step file in sequence to obtain a test script;
[0008] Execute the test script to complete the UI automation test work.
[0009] Optionally, the business requirement description text is processed using a large language model technology and a text graph model technology to obtain a target business model graph, including:
[0010] The requirement description text is converted by using a large language model to obtain a pseudo code text, where the pseudo code text is used to represent the business requirement in the business requirement description text in the form of code;
[0011] The pseudocode text is processed using a text graph model to obtain the target business model graph.
[0012] Optionally, a large language model is used to convert the requirement description text to obtain a pseudo code text, including:
[0013] Using the large language model to perform word segmentation processing on the demand description text to obtain word segmentation data;
[0014] Performing entity recognition on the word segmentation data and marking parts of speech;
[0015] The relationship between the subject and the object in the annotated word segmentation data is extracted and converted into the pseudocode text according to preset rules.
[0016] Optionally, before using the large language model technology and the text graph model technology to process the business requirement description text to obtain the target business model graph, the method further includes:
[0017] Using a variety of instruction data to train the initial large language model to obtain a large language model, wherein the instruction data is instructions related to the financial test scenario;
[0018] The initial document graph model is trained using historical fine-tuning data to obtain a document graph model, wherein the historical fine-tuning data represents fine-tuning data for converting pseudocode into a business model graph to meet actual testing requirements.
[0019] Optionally, generating a test step file based on the target business model diagram includes:
[0020] A finite state machine model is used to traverse the target business model graph to generate test steps and target operation page components, wherein the target operation page components are operation page components when a user uses the system under test, and the test steps are steps for jumping between pages when the user uses the system under test;
[0021] Based on the test steps and the target operation page components, a key-value pair is generated for each node in each of the test steps and the target operation page component corresponding to the node;
[0022] Write the key-value pairs into a txt file to generate the test step file.
[0023] Optionally, the test step files are read and assembled in sequence to obtain a test script, including:
[0024] When the format of the test step file is not a txt file, generating first prompt information to prompt that the format of the test step file is not a txt file;
[0025] When the format of the test step file is in txt format, open the test step file;
[0026] Read the test step file line by line using a loop method, and assemble the key-value pairs into a Python dictionary;
[0027] The python dictionary is parsed to assemble the pages involved in each operation step in series according to the order of the key-value pairs in the python dictionary to obtain the test script.
[0028] Optionally, after executing the test script, the method further includes:
[0029] The test script is executed again at a preset time or according to a preset time period.
[0030] According to another aspect of the present application, a UI automation testing device is provided, the device comprising:
[0031] An acquisition unit is used to acquire a business requirement description text, and process the business requirement description text using a large language model technology and a text graph model technology to obtain a target business model graph, wherein the business requirement description text represents text content describing the business requirement;
[0032] A first processing unit, configured to generate a test step file based on the target business model diagram, and sequentially read and assemble the test step file to obtain a test script;
[0033] The second processing unit is used to execute the test script to complete the UI automation test work.
[0034] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0035] According to another aspect of the present application, a UI automation testing system is provided, which includes: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of the described methods.
[0036] By applying the technical solution of the present application, the business requirement description text is processed by using the large language model technology and the text graph model technology to obtain the target business model diagram, that is, the purpose of first generating pseudocode by using the large language model technology, and then processing the pseudocode by the text graph model technology to generate the target business model diagram is achieved. Compared with the existing solutions, complex business requirements can be simplified and a target business model diagram that can reflect the business requirements can be generated. At the same time, a test step file is generated based on the target business model diagram, and the test step file is read and assembled in sequence to obtain a test script, and the test script is executed to complete the UI automation test work, thereby achieving the purpose of automatically assembling and executing the test script while generating test cases, improving the efficiency of automated testing, and thus solving the problem that the existing solutions cannot directly perform UI automation testing for more complex business requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0038] Figure 1 A schematic diagram of a UI automation testing method according to an embodiment of the present application is shown;
[0039] Figure 2 A schematic diagram of a UI automation test architecture provided according to an embodiment of the present application is shown;
[0040] Figure 3 A schematic diagram showing a principle of a target business model diagram provided according to an embodiment of the present application is shown;
[0041] Figure 4 A schematic diagram of the structure of Script1 and Script2 provided according to an embodiment of the present application is shown;
[0042] Figure 5 A schematic diagram of another UI automation testing method provided according to an embodiment of the present application is shown;
[0043] Figure 6 A structural block diagram of a UI automation testing device provided according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0044] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0045] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 creative work should fall within the scope of protection of the present application.
[0046] 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 sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. 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 device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0047] The business functions in web application software or mobile App application software are usually composed of multiple pages, and each page is composed of multiple components. When users operate the software, the essence is to operate different components on the page and jump between the pages of the software. For example, for the online transfer function of a bank, the function can be composed of pages such as basic information, amount information, confirmation information, and transfer result information. The basic information page can be composed of components such as the payee account input box and the payer account input box. When a user uses the online transfer function of the bank, he will operate the aforementioned components and jump between the aforementioned pages. The current common UI automation testing mode is for the tester to analyze the business needs, identify the process steps of the user operating the software, and then write an automated test script for the user operating the page components and page jumps, run the script to simulate the user using the software, and verify the actual results after the operation at the set checkpoints and the expected results. If it meets the expected results, it means that the test has passed, otherwise it means that the test has failed.
[0048] As introduced in the background technology, in the software testing process, it is difficult to cover all functions, rules or processes by simply using manual testing, and the software quality assurance effect is not good. UI automated testing can effectively alleviate the above problems. However, when faced with the testing tasks of complex professional software, traditional UI automated testing technology has the following shortcomings: (1) UI automated testing of complex professional software requires testers to have high testing skills and programming skills, as well as a deeper understanding of the business requirements to be achieved by the system, which makes implementation difficult; (2) The traditional UI automated testing model solidifies the functions, rules or processes of the business system in the test script, lacks the flexible execution capability to simulate real user operations, and has high script maintenance costs. In order to solve the problem that the existing solutions cannot directly perform UI automated testing for more complex business requirements, the embodiments of the present application provide a UI automated testing method, device, medium and system.
[0049] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0050] In this embodiment, a UI automation testing method running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0051] Figure 1 FIG. 1 is a flow chart of a UI automation testing method provided according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0052] Step S101, obtaining a business requirement description text, and processing the business requirement description text using a large language model technology and a text graph model technology to obtain a target business model graph, wherein the business requirement description text represents the text content describing the business requirement;
[0053] UI automation testing architecture Figure 2 As shown, it mainly includes a business model generation module, a step generation module, an assembly scheduling module, a page object component library and a test case module.
[0054] The page object component library contains page components and pages involved in the functions, rules and processes of the system under test. The construction of the page object component library is based on the PageObject mode. Each page of the system under test and the methods of operating these pages are encapsulated in a page object class. Among them, the class attributes of the page object class are the interface elements on each page, such as buttons, input boxes, drop-down boxes, etc.; the class methods of the page object class are the operation methods of the aforementioned interface elements, such as clicking on buttons, entering text in input boxes, selecting drop-down boxes, etc.
[0055] The PageObject pattern is a design pattern that separates the test code from the location and operation of page elements. In the PageObject pattern, each page is encapsulated as an object that contains the elements and operation methods contained in the page. The test code operates the page by calling these objects without having to worry about the specific location and operation details of the page elements. The advantage of doing this is that it can improve the maintainability and reusability of the test code, while also reducing the coupling of the test code. Through the PageObject pattern, the test code can be clearer and easier to understand.
[0056] The current UI automation testing model relies on the experience and skills of testers, requiring testers to be familiar with business functions, rules, and processes while also having proficient testing and programming skills. However, in actual scenarios, there are very few people who are proficient in both. For this reason, this application introduces a large language model to solve the reliance on testing and programming skills.
[0057] The large language model technology and the text graph model technology are used to process the above business requirement description text to obtain the target business model diagram, including:
[0058] The requirement description text is converted by using a large language model to obtain a pseudo code text, where the pseudo code text is used to represent the business requirements in the business requirement description text in the form of code;
[0059] That is, the above-mentioned large language model is used to perform word segmentation processing on the above-mentioned demand description text to obtain word segmentation data; entity recognition is performed on the above-mentioned word segmentation data and parts of speech are marked; the relationship between the subject and object in the marked word segmentation data is extracted, and converted into the above-mentioned pseudocode text according to preset rules.
[0060] The pseudo code text is processed using a text graph model to obtain the target business model graph.
[0061] Specifically, for example, the business requirement is "the user enters the payment amount and the payee account number, enters the password and clicks the OK button. If the password is correct and the account balance is greater than or equal to the payment amount, the payment is successful, otherwise, the payment fails." The business model generation module reads the above business requirement, decomposes it into words such as "user", "input", "payment amount", "account number", etc., and identifies the logical concepts in the statements by analyzing the semantics of statements such as "... and...", "if... then... otherwise", "... and...", etc., and generates the following pseudo code (i.e., showing the preset rules):
[0062] Given payment amount p_am, account number ac, password pw, user database D;
[0063] if ac∈D;
[0064] co_am<--D.get_amount(ac);
[0065] co_pw<--D.get_password(ac);
[0066] if co_pw=pw and co_am>=p_am:
[0067] return True;
[0068] else:
[0069] return False;
[0070] return False.
[0071] Then the pseudo code is processed using the Wensheng graph model to obtain Figure 3 As shown in the target business model diagram, payment will be successful only when the password is correct and the account balance is greater than or equal to the payment amount.
[0072] In one embodiment of the present application, before using the large language model technology and the text graph model technology to process the above-mentioned business requirement description text to obtain the target business model graph, the above-mentioned method also includes:
[0073] The initial large language model is trained using a variety of instruction data to obtain a large language model, wherein the instruction data are instructions related to the financial test scenario;
[0074] The initial document graph model is trained using historical fine-tuning data to obtain a document graph model. The historical fine-tuning data represents fine-tuning data that converts pseudocode into a business model graph to meet actual testing requirements.
[0075] Among them, the financial big language model is pre-trained, and text data related to various financial fields is collected. Pre-training is continued on the open source Chinese pre-training model to inject strong field-related financial knowledge into the big language model; the big language model is supervised fine-tuned for bank test scenarios, and multiple high-quality instruction data are collected from real business scenarios, covering financial test scenarios, including from colloquial business descriptions to standardized business demand expressions. Limited by the multimodal processing capabilities of the current big language model, the model cannot directly generate a business model diagram. This application further introduces pseudocode to express the specific process of the business model diagram and constructs a text conversion path from business requirements to pseudocode; in addition, regarding the prompt (i.e., prompt word) enhanced with linguistic information, it is indicated that the big language model has hallucination problems, and sometimes it is not possible to capture accurate semantic information for real test requirements. In order to avoid this problem, this application further introduces named entity recognition and relationship extraction models to obtain entities and relationships in business requirements, and organize them into prompts before splicing them into the input of the big language model. This can effectively solve the hallucination problem of the big language model and further improve the accuracy of pseudocode generation;
[0076] In addition, this application also involves fine-tuning the Wensheng graph model, collecting high-quality fine-tuning data from pseudocode to business model diagram, which mainly comes from daily real testing needs, and fine-tuning the open source Wensheng graph model so that the Wensheng graph model has the ability to read pseudocode and generate corresponding business model diagrams.
[0077] Step S102, generating a test step file based on the target business model diagram, and sequentially reading and assembling the test step files to obtain a test script;
[0078] The step generation module reads the business process diagram, uses the finite state machine model to traverse the business model diagram and generates a step file in txt format.
[0079] The bottom layer of the step generation module is based on the GraphWalker tool (GraphWalker is an open source tool for generating and executing test cases for directed graphs. It supports a variety of test case generation algorithms, such as random walk, A* search, etc. GraphWalker can be used to test various types of systems, such as software systems, hardware systems, network systems, etc. It can help users automatically generate comprehensive test cases, covering all possible paths of the system, thereby improving test efficiency and quality. GraphWalker also provides a wealth of extended functions, such as custom test case generation algorithms, multiple output format support, etc., so that users can customize the test process according to their needs). The finite state machine model is used to traverse the business model graph to generate the steps for users to operate page components and jump between pages when using the system under test. A key-value pair is generated for each node on the step and the page corresponding to the node. The key-value pairs are written into the step result txt file in the order of the nodes on the path. After a set of node-page key-value pairs on a step is generated, the step generation module will generate an empty key-value pair as a separator, and then start the generation of the second set of steps, and so on, until all possible paths of the business model graph are completed.
[0080] An example of the step result txt file content format is as follows:
[0081] {node_1:page_1};
[0082] {node_2:page_2};
[0083] {node_3:page_3};
[0084] {};
[0085] {node_1:page_1};
[0086] {node_4:page_4};
[0087] {node_5:page_5}; ......;
[0089] {node_n:page_n}.
[0090] Exemplarily, according to the target business model diagram in step S101, the following step files may be generated:
[0091] {"User enters amount and payee account number": "page_iuput_money_and_account"};
[0092] {"enter password":"page_iuput_password"};
[0093] {"Click the OK button":"page_confirm"};
[0094] {"Payment successful":"page_success"};
[0095] {};
[0096] {"User enters amount and payee account number": "page_iuput_money_and_account"};
[0097] {"enter password":"page_iuput_password"};
[0098] {"Click the OK button":"page_confirm"};
[0099] {"payment failed":"page_failure"}.
[0100] Finite State Machine (FSM) is a mathematical model used to describe all possible states of a system and the transition relationship between states. In the finite state machine model, the system is modeled into several states, each state represents a specific state of the system at a certain moment, and the system can transfer states according to the input signal. The basic elements of the finite state machine include state set, initial state, state transfer function and output function. Finite state machines can be divided into two types: deterministic finite state machine (DFSM) and nondeterministic finite state machine (NFSM). In a deterministic finite state machine, each input signal corresponds to a unique next state, while in a nondeterministic finite state machine, an input signal may correspond to multiple possible next states. Finite state machines are widely used in the field of computer science, such as lexical analysis of programming languages, protocol analysis, and automated control systems. By using the finite state machine model, the behavior of the system can be clearly described, helping to design and analyze the logical structure and behavior of the system.
[0101] The test step file is generated based on the target business model diagram, including:
[0102] A finite state machine model is used to traverse the target business model diagram to generate test steps and target operation page components. The target operation page components are operation page components when users use the system under test, and the test steps are steps for jumping between pages when the users use the system under test. Based on the test steps and the target operation page components, a key-value pair is generated for each node in each of the test steps and the target operation page component corresponding to the node. The key-value pairs are written into a txt file to generate the test step file.
[0103] Specifically, the step generation module reads the business process diagram, uses the finite state machine model to traverse the business model diagram and generates a step file in txt format. For example, if a jump occurs between page A and page B, it is necessary to record the steps of jumping from page A to page B. By generating corresponding key-value pairs, it is convenient to assemble the above key-value pairs into a python dictionary for subsequent query.
[0104] In one embodiment of the present application, the above test step files are read and assembled in sequence to obtain a test script, including:
[0105] In the case that the format of the test step file is not in txt format, generating first prompt information to prompt that the format of the test step file is not in txt format;
[0106] When the format of the test step file is in txt format, open the test step file;
[0107] Use a loop method to read the above test step file line by line, and assemble the above key-value pairs into a Python dictionary;
[0108] The above-mentioned python dictionary is parsed to assemble the pages involved in each operation step in series according to the order of the above-mentioned key-value pairs in the above-mentioned python dictionary to obtain the above-mentioned test script.
[0109] That is, first determine whether the file exists. If not, throw an exception (this is an early warning mechanism set up to avoid the inability to perform subsequent operations when an error occurs in the previous step). If it exists, further determine whether the document type is a txt file. If so, open the file, otherwise throw an exception; use a loop method to read the txt file line by line, and assemble the "node-page" key-value pairs output by the step generation module into a python dictionary.
[0110] Python dictionary is a data structure used to store key-value pairs. Each key-value pair is separated by a colon, and each key-value pair is separated by a comma. Dictionaries can access corresponding values through keys, and keys must be unique. Dictionaries are mutable data types that can be added, deleted, and modified. In Python, dictionaries are represented by curly braces {}.
[0111] Specifically, the assembly scheduling module parses the aforementioned test step dictionary, and assembles the pages involved in each group of operation steps into a test script in series according to the order of the key-value pairs in the dictionary. Each time an empty key-value pair is encountered, it means that the script assembly of a path is completed, and the test script is encapsulated into a test case, and the assembly of the test case of the next path begins at the same time.
[0112] The assembly scheduling module takes the step result txt file output by the step generation module as input, first parses the file through the program, then uses the reflection mechanism to automatically map the nodes in the steps to the corresponding components or pages, and assembles each component or page into the page automation script of the group of steps in the order of the nodes in the list; when the program reads an empty key-value pair, it means that the script assembly of a group of steps is completed, and the program will re-assemble a new group of test scripts according to the aforementioned process until the program traverses the entire file, then all automated test scripts are generated and the program ends.
[0113] The python dictionary is: {{“User enters the amount and the payee's account number”: “page_iuput_money_and_account”}, {“Enter the password”: “page_iuput_password”}, {“Click the OK button”: “page_confirm”}, {“Payment successful”: “page_success”}, {}, {“User enters the amount and the payee's account number”: “page_iuput_money_and_account”}, {“Enter the password”: “page_iuput_password”}, {“Click the OK button”: “page_confirm”}, {“Payment failed”: “page_failure”}}, then it is automatically assembled into Figure 4 Script1 and Script2 are shown in the figure. Script means a text file that contains programs or instructions to control a computer or other device to perform specific tasks or functions. Scripts can be used in areas such as automated tasks, batch processing, web development, etc. In computer programming, scripts are usually written in a specific programming language, such as JavaScript, Python, Shell, etc.
[0114] Step S103, execute the above test script to complete the UI automation test work.
[0115] In the above steps, the business requirement description text is processed by the large language model technology and the text graph model technology to obtain the target business model diagram, that is, the purpose of first generating pseudocode by using the large language model technology, and then processing the pseudocode by the text graph model technology to generate the target business model diagram is achieved. Compared with the existing solution, the complex business requirements can be simplified and a target business model diagram that can reflect the business requirements can be generated. At the same time, a test step file is generated based on the target business model diagram, and the test step file is read and assembled in turn to obtain a test script, and the test script is executed to complete the UI automation test work, which achieves the purpose of automatically assembling and executing the test script while generating the test case, thereby improving the efficiency of the automated test, and thus solving the problem that the existing solution cannot directly perform UI automation testing for more complex business requirements.
[0116] The automated test scripts generated by the assembly scheduling module will be automatically pushed to the test case module to form a set of test cases and incorporated into the automated test framework. When the preset conditions for automated test execution are met, the test cases will be automatically executed and a test report will be generated.
[0117] In addition, after executing the test script in step S103, the method further includes:
[0118] Execute the above test script again at a preset time or according to a preset time period.
[0119] Specifically, after the test case generation is completed, the program calls the automated testing framework to execute the test script assembled and generated in the previous step at a preset time or according to a preset time period to perform UI automated testing, for example, executing the test script every 2 minutes or once a week.
[0120] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the UI automation testing method of the present application will be described in detail below in combination with specific embodiments.
[0121] This embodiment relates to a specific UI automation testing method, such as Figure 5 As shown, including:
[0122] The initial large language model is trained using a variety of instruction data to obtain a large language model, where the instruction data is instructions related to the financial test scenario;
[0123] The initial document graph model is trained using historical fine-tuning data to obtain a document graph model. The historical fine-tuning data represents the fine-tuning data that converts the pseudo code into a business model graph to meet the actual test requirements.
[0124] Get the business requirement description text;
[0125] The large language model is used to convert the demand description text to obtain pseudo code text. The pseudo code text is used to represent the business requirements in the business demand description text in the form of code.
[0126] Specifically, a large language model is used to segment the demand description text to obtain segmented data; entity recognition is performed on the segmented data and parts of speech are marked; the relationship between the subject and object in the marked segmented data is extracted and converted into pseudocode text according to preset rules;
[0127] The pseudocode text is processed using a text graph model to obtain a target business model graph, wherein the business requirement description text represents the text content describing the business requirement;
[0128] Generate test step files based on the target business model diagram;
[0129] Specifically, a finite state machine model is used to traverse the target business model graph to generate test steps and target operation page components. The target operation page component is the operation page component when the user uses the system under test, and the test steps are the steps for jumping between pages when the user uses the system under test; based on the test steps and the target operation page components, a key-value pair is generated for each node in each test step and the target operation page component corresponding to the node; the key-value pair is written into a txt file to generate a test step file.
[0130] In each test step, each node and the target operation page component corresponding to the node generate a key-value pair, that is, for example, node B and operation page component C in step A generate a key-value pair, and operation page component C is the target operation page component corresponding to node B.
[0131] Read and assemble the test step files in sequence to obtain the test script;
[0132] When the format of the test step file is not in txt format, generate a first prompt message to prompt that the format of the test step file is not in txt format; when the format of the test step file is in txt format, open the test step file; read the test step file line by line using a loop method, and assemble the key-value pairs into a python dictionary; parse the python dictionary to assemble the pages involved in each operation step in series according to the order of the key-value pairs in the python dictionary to obtain a test script;
[0133] Execute the test script to complete the UI automation test work, and execute the test script again at the preset time or according to the preset time period.
[0134] The test steps and UI automation test scripts generated by this application are based on the finite state machine model, and are guided by the business model diagram to cover all functions, rules or processes at the business level of the system. The generation and selection of scripts do not require pre-setting or manual intervention. They are highly objective when used in the testing of complex professional software, thereby improving the test coverage rate. The business model diagram used in this application takes into account business constraints, thereby avoiding invalid or inapplicable use cases, and the test accuracy rate is high. While generating test cases, this application also automatically assembles and executes test scripts, thereby improving the efficiency of automated testing. Testers do not need to pay attention to the business logic of the system under test, but only need to write page object classes for the front-end pages of the system under test, thereby greatly reducing the workload. This application realizes the decoupling of test step generation and test script assembly, thereby further improving the flexibility of UI automation testing. This application facilitates the discovery of business requirement defects in the early stages of testing. The business model diagram output during the operation of this application can provide software developers with an intuitive and graphical demand display, which is conducive to early discovery of contradictions and omissions in business requirements.
[0135] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0136] The embodiment of the present application also provides a UI automation testing device. It should be noted that the UI automation testing device of the embodiment of the present application can be used to execute the UI automation testing method provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0137] The following is an introduction to the UI automation testing device provided in the embodiment of the present application.
[0138] Figure 6 1 is a structural block diagram of a UI automation testing device provided according to an embodiment of the present application. Figure 6 As shown, the device comprises:
[0139] The acquisition unit 61 is used to acquire a business requirement description text, and process the business requirement description text using a large language model technology and a text graph model technology to obtain a target business model graph, wherein the business requirement description text represents the text content describing the business requirement;
[0140] A first processing unit 62 is used to generate a test step file based on the target business model diagram, and sequentially read and assemble the test step files to obtain a test script;
[0141] The second processing unit 63 is used to execute the above test script to complete the UI automation test work.
[0142] In the above-mentioned device, the business requirement description text is processed by using the large language model technology and the text graph model technology to obtain the target business model diagram, that is, the purpose of first generating pseudocode by using the large language model technology, and then processing the pseudocode by the text graph model technology to generate the target business model diagram is achieved. Compared with the existing scheme, it can simplify complex business requirements and generate a target business model diagram that can reflect the business requirements. At the same time, a test step file is generated based on the target business model diagram, and the test step file is read and assembled in turn to obtain a test script, and the test script is executed to complete the UI automation test work, which achieves the purpose of automatically assembling and executing the test script while generating test cases, improves the efficiency of automated testing, and thus solves the problem that the existing scheme cannot directly perform UI automation testing for more complex business requirements.
[0143] In one embodiment of the present application, the acquisition unit includes a first processing module and a second processing module. The first processing module is used to use a large language model to convert the above-mentioned requirement description text to obtain a pseudocode text, and the above-mentioned pseudocode text is used to represent the business requirements in the above-mentioned business requirement description text in the form of code; the second processing module is used to use a text graph model to process the above-mentioned pseudocode text to obtain the above-mentioned target business model graph.
[0144] In one embodiment of the present application, the first processing module includes a first processing sub-module, a second processing sub-module and a third processing sub-module. The first processing sub-module is used to use the above-mentioned large language model to perform word segmentation processing on the above-mentioned demand description text to obtain word segmentation data; the second processing sub-module is used to perform entity recognition on the above-mentioned word segmentation data and mark the part of speech; the third processing sub-module is used to extract the relationship between the subject and the object in the marked word segmentation data, and convert it into the above-mentioned pseudocode text according to preset rules.
[0145] In one embodiment of the present application, the above-mentioned device also includes a third processing unit and a fourth processing unit. The third processing unit is used to train the initial large language model with multiple instruction data to obtain a large language model before using the large language model technology and the text graph model technology to process the above-mentioned business requirement description text to obtain the target business model graph, and the above-mentioned instruction data are instructions related to the financial testing scenario; the fourth processing unit is used to train the initial text graph model with historical fine-tuning data to obtain a text graph model, and the above-mentioned historical fine-tuning data represents the fine-tuning data for converting pseudocode into a business model graph to meet the actual testing requirements.
[0146] In one embodiment of the present application, the first processing unit includes a third processing module, a fourth processing module and a fifth processing module. The first processing unit is used to use a finite state machine model to traverse the above-mentioned target business model diagram to generate test steps and target operation page components. The above-mentioned target operation page components are operation page components when the user uses the system under test, and the test steps are steps for jumping between pages when the above-mentioned user uses the system under test; the fourth processing module is used to generate a key-value pair for each node in each of the above-mentioned test steps and the above-mentioned target operation page components corresponding to the above-mentioned nodes based on the above-mentioned test steps and the above-mentioned target operation page components; the fifth processing module is used to write the above-mentioned key-value pairs into a txt file to generate the above-mentioned test step file.
[0147] In one embodiment of the present application, the first processing unit includes a sixth processing module, a seventh processing module, an eighth processing module and a ninth processing module. The sixth processing module is used to generate a first prompt message when the format of the above-mentioned test step file is not in txt format, to prompt that the format of the above-mentioned test step file is not in txt format; the seventh processing module is used to open the above-mentioned test step file when the format of the above-mentioned test step file is in txt format; the eighth processing module is used to read the above-mentioned test step file line by line using a loop method, and assemble the above-mentioned key-value pairs into a python dictionary; the ninth processing module is used to parse the above-mentioned python dictionary, so as to assemble the pages involved in each operation step in series according to the order of the above-mentioned key-value pairs in the above-mentioned python dictionary to obtain the above-mentioned test script.
[0148] In one embodiment of the present application, the above-mentioned device also includes a fifth processing unit, and the fifth processing unit is used to execute the above-mentioned test script again at a preset time or according to a preset time period after executing the above-mentioned test script.
[0149] The UI automated testing device includes a processor and a memory. The acquisition unit, the first processing unit, the second processing unit, etc. are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.
[0150] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to solve the problem that the existing solution cannot directly perform UI automation testing for more complex business needs.
[0151] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0152] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the UI automation testing method.
[0153] An embodiment of the present invention provides a processor, which is used to run a program, wherein the UI automation testing method is executed when the program is running.
[0154] The embodiment of the present invention provides a device, which includes a processor, a memory, and a program stored in the memory and can be run on the processor. When the processor executes the program, at least the following steps are implemented: obtaining a business requirement description text, and using a large language model technology and a text graph model technology to process the above business requirement description text to obtain a target business model graph, wherein the above business requirement description text represents the text content describing the business requirement; generating a test step file based on the above target business model graph, and sequentially reading and assembling the above test step file to obtain a test script; executing the above test script to complete the UI automation test work. The device in this article can be a server, PC, PAD, mobile phone, etc.
[0155] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes at least the following method steps: obtaining a business requirement description text, and using large language model technology and text graph model technology to process the above business requirement description text to obtain a target business model graph, wherein the above business requirement description text represents the text content that describes the business requirement; generating a test step file based on the above target business model graph, and reading and assembling the above test step files in sequence to obtain a test script; and executing the above test script to complete the UI automation testing work.
[0156] The present application also provides a UI automated testing system, which includes: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for executing any of the above methods. The business requirement description text is processed by using the large language model technology and the Wensheng graph model technology to obtain the target business model diagram, that is, the purpose of first generating pseudocode by using the large language model technology, and then processing the pseudocode by the Wensheng graph model technology to generate the target business model diagram is achieved, so that compared with the existing scheme, complex business requirements can be simplified and a target business model diagram that can reflect the business requirements can be generated. At the same time, a test step file is generated based on the target business model diagram, and the test step file is read and assembled in turn to obtain a test script, and the test script is executed to complete the UI automated testing work, achieving the purpose of automatically assembling and executing the test script while generating the test case, improving the efficiency of automated testing, and thus solving the problem that the existing scheme cannot directly perform UI automated testing for more complex business requirements.
[0157] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0158] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0159] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0160] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0161] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0162] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0163] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0164] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0165] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0166] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0167] 1) The UI automation testing method of the present application uses the large language model technology and the Wensheng graph model technology to process the business requirement description text to obtain the target business model diagram, that is, it achieves the purpose of first generating pseudocode by using the large language model technology, and then processing the pseudocode by the Wensheng graph model technology to generate the target business model diagram. Compared with the existing scheme, it can simplify complex business requirements and generate a target business model diagram that can reflect the business requirements. At the same time, a test step file is generated based on the target business model diagram, and the test step file is read and assembled in turn to obtain a test script, and the test script is executed to complete the UI automation testing work, which achieves the purpose of automatically assembling and executing the test script while generating test cases, thereby improving the efficiency of automated testing, and thus solving the problem that the existing scheme cannot directly perform UI automation testing for more complex business requirements.
[0168] 2) The UI automation testing device of the present application uses the large language model technology and the Wensheng graph model technology to process the business requirement description text to obtain the target business model diagram, that is, it achieves the purpose of first generating pseudocode by using the large language model technology, and then processing the pseudocode by the Wensheng graph model technology to generate the target business model diagram. Compared with the existing scheme, it can simplify complex business requirements and generate a target business model diagram that can reflect the business requirements. At the same time, a test step file is generated based on the target business model diagram, and the test step file is read and assembled in turn to obtain a test script, and the test script is executed to complete the UI automation testing work, thereby achieving the purpose of automatically assembling and executing the test script while generating test cases, improving the efficiency of automated testing, and thus solving the problem that the existing scheme cannot directly perform UI automation testing for more complex business requirements.
[0169] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A UI automation testing method, characterized in that: include: Obtain a business requirement description text, and use a large language model technology and a text graph model technology to process the business requirement description text to obtain a target business model graph, wherein the business requirement description text represents the text content describing the business requirement; Generate a test step file based on the target business model diagram, and read and assemble the test step file in sequence to obtain a test script; Execute the test script to complete the UI automation test work.
2. The method according to claim 1, characterized in that The business requirement description text is processed using large language model technology and text graph model technology to obtain a target business model diagram, including: The requirement description text is converted by using a large language model to obtain a pseudo code text, where the pseudo code text is used to represent the business requirement in the business requirement description text in the form of code; The pseudocode text is processed using a text graph model to obtain the target business model graph.
3. The method according to claim 2, characterized in that The requirement description text is converted using a large language model to obtain a pseudo code text, including: Using the large language model to perform word segmentation processing on the demand description text to obtain word segmentation data; Performing entity recognition on the word segmentation data and marking parts of speech; The relationship between the subject and the object in the annotated word segmentation data is extracted and converted into the pseudocode text according to preset rules.
4. The method according to claim 1, characterized in that: Before using the large language model technology and the text graph model technology to process the business requirement description text to obtain the target business model graph, the method further includes: Using a variety of instruction data to train the initial large language model to obtain a large language model, wherein the instruction data is instructions related to the financial test scenario; The initial document graph model is trained using historical fine-tuning data to obtain a document graph model, wherein the historical fine-tuning data represents fine-tuning data for converting pseudocode into a business model graph to meet actual testing requirements.
5. The method according to claim 1, characterized in that Generating a test step file based on the target business model diagram includes: A finite state machine model is used to traverse the target business model graph to generate test steps and target operation page components, wherein the target operation page components are operation page components when a user uses the system under test, and the test steps are steps for jumping between pages when the user uses the system under test; Based on the test steps and the target operation page components, a key-value pair is generated for each node in each of the test steps and the target operation page component corresponding to the node; Write the key-value pairs into a txt file to generate the test step file.
6. The method according to claim 5, characterized in that The test step files are read and assembled in sequence to obtain a test script, including: When the format of the test step file is not a txt file, generating first prompt information to prompt that the format of the test step file is not a txt file; When the format of the test step file is in txt format, open the test step file; Read the test step file line by line using a loop method, and assemble the key-value pairs into a Python dictionary; The python dictionary is parsed to assemble the pages involved in each operation step in series according to the order of the key-value pairs in the python dictionary to obtain the test script.
7. The method according to claim 1, characterized in that After executing the test script, the method further includes: The test script is executed again at a preset time or according to a preset time period.
8. A UI automated testing device, characterized in that: include: An acquisition unit is used to acquire a business requirement description text, and process the business requirement description text using a large language model technology and a text graph model technology to obtain a target business model graph, wherein the business requirement description text represents text content describing the business requirement; A first processing unit is used to generate a test step file based on the target business model diagram, and sequentially read and assemble the test step file to obtain a test script; The second processing unit is used to execute the test script to complete the UI automation test work.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. A UI automated testing system, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of claims 1 to 7.
Citation Information
Cited By
UI (User Interface) test and API (Application Program Interface) test collaborative test method based on business logic chain atlas
CN121326775A