Regression test method and device of user interface, electronic equipment and storage medium
By generating log files and using preset prompt word templates and target models to generate test cases, the problem of low user interface regression testing efficiency and accuracy in the existing technology is solved, automated user interface regression testing is realized, and testing efficiency and accuracy are improved. Accuracy.
Patent Information
- Application Number
- CN202410621686.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2024-08-30
AI Technical Summary
Existing user interface regression testing methods require multiple extraction logic and checkpoints to be inserted into the source code, resulting in hidden dangers and difficulty in maintenance. They also require manual writing of parsing and automated playback scripts, resulting in low testing efficiency and accuracy.
A log file is generated through a recording operation, and test cases are intelligently generated using preset prompt word templates and target models to realize automatic writing of test cases without the need for manual writing, improving testing efficiency and accuracy without changing the source code.
It saves the work of manual script writing, improves the efficiency and accuracy of user interface regression testing, and reduces external risks and maintenance difficulties.
Smart Images

Figure CN118567975A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a regression testing method, device, electronic device and storage medium for a user interface. Background Art
[0002] In software development, regression testing of the UI (User Interface) is usually included to test whether the controls in the user interface have correct control feedback. In related technologies, regression testing of the user interface is usually performed by recording and playback. Specifically, it is necessary to insert multiple extraction logics into the UI framework source code, such as inserting event click hook logic to generate a script containing control information, and then parse the script to obtain the control information. At the same time, it is necessary to insert checkpoints into the source code to obtain the state of the UI and verify it during playback. Inserting extraction logic into the source code will bring many hidden dangers of externalization, and inserting additional checkpoints is not convenient for users to maintain; in addition, this method requires additional writing of parsing scripts and automated playback scripts, resulting in more manual script writing work, and low test efficiency and test accuracy. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a regression testing method, device, electronic device and storage medium for a user interface. Without changing the source code, standard data can be obtained through a single recording operation. At the same time, test cases can be intelligently generated through preset prompt word templates and target models to realize automatic writing of test cases. Regression testing can be achieved through test cases without manual writing, thereby saving the work of manual script writing and improving test efficiency and test accuracy.
[0004] In a first aspect, an embodiment of the present disclosure provides a regression testing method for a user interface, wherein at least one control provided by a target application is run through a terminal device, and the method comprises: generating a log file of at least one control in response to a trigger operation on at least one control; the log file comprises at least one log message, the at least one log message corresponds to at least one control one-to-one, and the log message comprises user interface target data after the control corresponding to the log message is triggered; generating at least one prompt message corresponding to the at least one log message according to the at least one log message and a preset prompt word template; determining at least one test case corresponding to the at least one log message through a target model according to the at least one prompt message; executing the test case in a target order, controlling the target control corresponding to the test case to be triggered, and obtaining user interface test data after the target control is triggered; determining a test result of the target application according to the user interface test data after the target control is triggered and the user interface target data included in the log message corresponding to the target control.
[0005] In a second aspect, an embodiment of the present disclosure provides a regression testing device for a user interface, which runs at least one control provided by a target application through a terminal device, and the device includes: a log file generation module, which is used to generate a log file of at least one control in response to a trigger operation on at least one control; the log file includes at least one log information, the at least one log information corresponds to at least one control one by one, and the log information includes user interface target data after the control corresponding to the log information is triggered; a prompt information generation module, which is used to generate at least one prompt information corresponding to the at least one log information according to the at least one log information and a preset prompt word template; a test case determination module, which is used to determine at least one test case corresponding to the at least one log information through a target model according to the at least one prompt information; a test data acquisition module, which is used to execute the test case in a target order, control the target control corresponding to the test case to be triggered, and obtain the user interface test data after the target control is triggered; a test result determination module, which is used to determine the test result of the target application according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control.
[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the regression testing method of the user interface of any one of the first aspects.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the regression testing method of the user interface of any one of the first aspects.
[0008] The embodiments of the present disclosure bring the following beneficial effects:
[0009] The present disclosure provides a regression test method, device, electronic device and storage medium for a user interface, which generates a log file of at least one control in response to a trigger operation for at least one control; the log file includes at least one log information, at least one log information corresponds to at least one control, and the log information includes user interface target data after the control corresponding to the log information is triggered; at least one prompt information corresponding to at least one log information is generated according to at least one log information and a preset prompt word template; at least one test case corresponding to at least one log information is determined through a target model according to at least one prompt information; the test case is executed in a target order, the target control corresponding to the test case is controlled to be triggered, and the user interface test data after the target control is triggered is obtained; the test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control. In this method, standard data is obtained through a recording operation without changing the source code, and test cases are intelligently generated through the preset prompt word template and the target model, so as to realize automatic case writing, and regression testing is realized through the test case without manual writing, which saves the work of manual script writing and improves the test efficiency and test accuracy.
[0010] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flowchart of a regression testing method for a user interface provided by an embodiment of the present disclosure;
[0014] Figure 2 A framework design diagram of a regression testing method for a user interface provided by an embodiment of the present disclosure;
[0015] Figure 3A schematic diagram of the structure of a regression testing device for a user interface provided by an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0018] In the software development industry, iterative development and release are the norm. Regression testing after iteration is very important. User interface regression testing is one of the links. Each iteration may lead to incorrect display of the user interface. Usually, there are two ways to test the regression of the user interface: one is pure manual click regression testing, and the other is automated regression testing.
[0019] First, in traditional recording and playback solutions, multiple extraction logics need to be inserted into the UI framework source code, such as inserting event click hook logic to generate a script containing control information, and then parsing the script to obtain the control information. At the same time, checkpoints need to be inserted into the source code to obtain the state of the UI during the test, and verify it during playback. However, inserting extraction logic into the source code will bring many hidden dangers of external playback, and additional insertion of checkpoints is not convenient for users to maintain; in addition, this method requires additional writing of parsing scripts and automated playback scripts, resulting in more manual script writing work, and low test efficiency and test accuracy.
[0020] Second, the Airtest solution is based on the method of image recognition and click area, which requires manual script writing. Although script writing is not difficult, it is still necessary to write scripts and logic for identifying image clicks in the order of execution, which still requires a lot of manpower investment. In addition, inaccurate detection and easy failure often occur during the debugging process.
[0021] Third, the Poco solution implements the click of UI events based on the control instance, generates a control instance tree of the user interface that needs to be regressed, and each instance is a control, and implements the click event according to the control type. This method still requires manual script writing, and requires obtaining the UI instance in the software to manipulate the control. Not only does it require writing code scripts, but the threshold is also very high, and only people who understand programming can master it.
[0022] Based on this, the embodiments of the present disclosure provide a regression testing method, apparatus, electronic device and storage medium for a user interface. The technology can be applied to devices such as computers, notebooks, and tablet computers.
[0023] To facilitate understanding of this embodiment, a user interface regression testing method disclosed in an embodiment of the present disclosure is first described in detail. A terminal device runs a target application to provide at least one control, such as Figure 1 As shown, the method comprises the steps of:
[0024] Step S102, in response to a trigger operation on at least one control, generating a log file of at least one control; the log file includes at least one log information, the at least one log information corresponds to at least one control, and the log information includes user interface target data after the control corresponding to the log information is triggered;
[0025] The target application may be various application applications, such as game application applications, chat application applications, shopping application applications, map application applications, video application applications, etc. The control generally refers to a UI control (ie, a user interface control).
[0026] Optionally, for each control, in response to a triggering operation on the control, log information corresponding to the control is generated, and the log information corresponding to each control is determined as a log file of at least one control.
[0027] The trigger operation mentioned above usually refers to a click operation, such as a touch operation of a finger on a control, a click operation of a mouse on a control, etc. That is to say, each time a trigger operation is performed on a control, a log information corresponding to the control will be generated. After the trigger operation on each control is completed, the log information corresponding to each control will be determined as the above log file.
[0028] The user interface target data after the control corresponding to the log information is triggered usually includes various data included in the interface fed back to the user after the control corresponding to the log information is triggered, such as control data, text data, image data, animation data, etc. Taking a game application as an example, if you click on the character details, the character related information will be displayed, usually including the character's health, life value, attack power, character casting animation, etc.
[0029] Step S104, generating at least one prompt message corresponding to the at least one log message according to the at least one log message and a preset prompt word template;
[0030] The preset prompt word template is used to guide the target model to generate test cases corresponding to the log information. The target model, for example, can be a large-scale language generation model, which can automatically generate test cases according to the preset prompt word template. The large-scale language generation model can also be called a large language model (LLM), which is a deep learning model trained based on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks, such as text summarization, question answering, translation, etc.
[0031] Optionally, for the log information corresponding to each control, part of the content in the preset prompt word template is replaced with the log information to obtain the prompt information corresponding to the log information.
[0032] Optionally, for the log information corresponding to each control, the log information is added to a specified position of a preset prompt word template to obtain prompt information corresponding to the log information.
[0033] Each control corresponds to a log message, and each log message corresponds to a prompt message. The prompt message corresponding to the log message includes at least part of the preset prompt word template and the log message.
[0034] Step S106, determining at least one test case corresponding to at least one log information through the target model according to at least one prompt information;
[0035] The target model can be a pre-trained network model or a natural language processing model driven by artificial intelligence technology that does not require training. The test case is usually a code script, and executing the code script will automatically execute the trigger operation for the control. For example, the test case corresponding to the first control, when executing the test case, will automatically execute the trigger operation for the first control. Each control has a corresponding test case.
[0036] Optionally, at least one piece of prompt information is input into the target model, and at least one test case corresponding to the at least one piece of prompt information is output through the target model;
[0037] Optionally, the target model is a large-scale language model or a pre-trained large model. The target model can also be called a natural language processing tool, which belongs to an intelligent chatbot model and is a natural language processing tool driven by artificial intelligence technology. The target model is a natural language processing tool driven by artificial intelligence technology, which can generate answers based on the patterns and statistical laws seen in the pre-training stage.
[0038] It should be noted that the above-mentioned target model is a large language model (LLM, referred to as the large model) that has been completed in advance through a large amount of language training. The large model is essentially a deep neural network model trained using massive data. Its huge data and parameter scale realizes the emergence of intelligence and shows human-like intelligence. In the field of natural language processing, the large model can automatically generate high-quality text content, including news reports, poems, novels, etc. In the field of image recognition, the large model can accurately identify various complex image contents, including faces, objects, scenes, etc. Therefore, in this embodiment, the powerful language understanding and self-learning capabilities of the large model are utilized to automatically generate test cases based on the input log information and prompt information.
[0039] Specifically, the log information in this embodiment records detailed control information, interface name, interface parameters, UIdata that needs to be verified, and other information. According to prompt engineering technology, the log information is encapsulated into prompt corpus (corresponding to the above prompt information) as the input prompt (prompt word) of the large model to generate corresponding test cases.
[0040] Optionally, for each prompt information, the prompt information is input into the target model, and a test case corresponding to the prompt information is output through the target model.
[0041] In actual implementation, the target model can automatically write test cases based on the log information by learning the content in the prompt information.
[0042] Step S108, executing the test cases in the target order, controlling the target controls corresponding to the test cases to be triggered, and obtaining the user interface test data after the target controls are triggered;
[0043] The above target sequence can be a pre-set sequence, or can match the triggering sequence of each control in at least one control, for example, the target sequence is the operation sequence of the triggering operation for the control or the reverse order of the operation sequence of the triggering operation for the control. Optionally, according to the target sequence, for each test case, the test case is executed, the target control corresponding to the test case in at least one control provided by the target application is controlled to be triggered, and the user interface test data after the target control corresponding to the test case is triggered is obtained.
[0044] Optionally, test log information corresponding to a target control corresponding to the test case is obtained, where the test log information summary includes user interface test data after the target control corresponding to the test case is triggered.
[0045] Test cases are usually executed only when updates are made to the target application.
[0046] Step S110, determining the test result of the target application according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control.
[0047] Optionally, the user interface test data and the user interface target data included in the log information corresponding to the target control are compared to obtain a comparison result, and the test result of the target application is determined based on the comparison result. For example, if the user interface test data and the user interface target data included in the log information corresponding to the target control are different, it is determined that an error has occurred in the updated target application; if the user interface test data and the user interface target data included in the log information corresponding to the target control are the same, it is determined that no error has occurred in the updated target application.
[0048] Optionally, data analysis is performed on the user interface test data and the user interface target data included in the log information corresponding to the target control to obtain analysis results, and the test results of the target application are determined based on the analysis results. For example, statistical analysis is performed on the user interface test data and the user interface target data included in the log information corresponding to the target control, and if the statistical result is less than a preset threshold, it is determined that no error has occurred in the updated target application, and if the statistical result is greater than or equal to the preset threshold, it is determined that an error has occurred in the updated target application.
[0049] The embodiment of the present disclosure provides a regression test method for a user interface, in response to a trigger operation for at least one control, a log file of at least one control is generated; the log file includes at least one log information, at least one log information corresponds to at least one control, and the log information includes the user interface target data after the control corresponding to the log information is triggered; at least one prompt information corresponding to the at least one log information is generated according to the at least one log information and a preset prompt word template; at least one test case corresponding to the at least one log information is determined through a target model according to the at least one prompt information; the test case is executed in a target order, the target control corresponding to the test case is controlled to be triggered, and the user interface test data after the target control is triggered is obtained; the test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control. In this method, without changing the source code, standard data is obtained through a recording operation, and test cases are intelligently generated through the preset prompt word template and the target model, so as to realize automatic case writing, and regression testing is realized through the test case, without manual writing, saving the work of manual script writing, and improving the test efficiency and test accuracy.
[0050] The above-mentioned log information also includes: the control name and control class name of the control corresponding to the log information, the function name and function parameters of the function executed when the control is triggered, and the environment variables when the control is triggered.
[0051] Exemplarily, the format and information of the log information are as follows:
[0052]
[0053] Among them, [UI_Name=Main] is the name of the above-mentioned control, [Widget=PyButton] is the control class name, [ClickFunc=OpenBag] is the function name of the function executed when the control is triggered, [Args=*args][Kwargs=**kwargs] are function parameters, the content of "globals" is the environment variables when the control is triggered, and UIData is the above-mentioned user interface target data.
[0054] The preset prompt word template includes: description content of the log information template, the log information template, the role played by the target model, the instructions executed by the target model, and a code example of the output result of the target model;
[0055] Optionally, the description content of the above-mentioned log information template, the role played by the target model, the instructions executed by the target model, and the code example of the output result of the target model are used to guide the target model to generate at least one test case corresponding to at least one log information.
[0056] Exemplarily, the preset prompt word template is as follows:
[0057] The content between 1### is a comprehensive and accurate log obtained by a functional test engineer after a full regression of UI interface operations. Each operation records a log. A complete log includes the following fields:
[0058] 2UI_Name: The name of the UI panel
[0059] 3Widget: The type of control on the UI panel, such as a button is pybutton
[0060] 4clickfunc: The function triggered by the control being clicked
[0061] 5Args, Kwargs: Parameters of the function triggered by the control being clicked
[0062] 6globals: Global environment variables when the control is clicked
[0063] 7UIData: Data on the UI panel after the control is clicked
[0064] 8###
[0065] 9[UI_Name=Main][Widget=PyButton][ClickFunc=OpenBag][Args=*args][Kwargs=**kwargs][globals={("ue":<module'ue'> ,"BaseUI":<class"base.client.game.ui_new.umg.wrap.common.BaseUI"> ,
[0066] 10"register_widget_class":<function register_widget_class at0x000001C5865E67A0> ,"PyButton":<class"base.client.game.ui_umg.wrap.button.PyButton"> ,"self":<base.client.game.ui_new.umg.wrap.button.PyButton object at0x000001C5C590E3F990> ,
[0067] 11}][UIData={"hp":1000,"mp":2000,"max_hp":3000,"max_mp":4000,"attack":5000}]
[0068] 12…
[0069] 13###
[0070] 14 Please play the role of a computer programming expert and automated testing expert. Based on the 1og information provided above, automatically generate executable code use cases. Requirements:
[0071] 15 1. The time sequence of the automated execution use cases and log records is consistent
[0072] 16 2. The generated automated use cases need to have the same effect as the use case operations executed by regression
[0073] 17 3. Requires to generate executable python code script as automation script
[0074] 18 4. Generate an execution case for each log and output it in markdown format
[0075] 19 Output format:
[0076] 20*python
[0077] 21# One log corresponds to one operation and one use case
[0078] 22import genv
[0079] 23panel=genv.client_mgr.ui_new_mgr.show("Main")
[0080] 24Widget=PyButton()
[0081] 25Widget.ClickFunc(*Args,**Kwargs)
[0082] 1-7 above are descriptions of the log information template; 8-12 are log information templates, 14 is the role played by the target model, 15-18 are instructions executed by the target model, and 20-25 are code examples of the output results of the target model.
[0083] A possible implementation of the above step of generating at least one prompt message corresponding to at least one log message according to at least one log message and a preset prompt word template is as follows: for each log message, the log message template in the preset prompt word template is replaced with the log message to obtain the prompt message corresponding to the log message.
[0084] The above steps of executing test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and obtaining the user interface test data after the target controls are triggered, a possible implementation method is: if the target application is updated, executing the test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and generating test log information corresponding to the target controls; obtaining the user interface test data after the target control is triggered from the test log information.
[0085] Usually, the purpose of regression testing is to execute the regression script (i.e., the test case mentioned above) to ensure that the updated program is correct when the software is iterated (that is, updated) and to control the corresponding controls to be triggered. There is no need to manually click the controls after each software iteration, nor is there any need to rewrite the script to execute the triggering operation for the controls.
[0086] The above-mentioned step of determining the test result of the target application based on the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control, a possible implementation method is: if the user interface test data after the target control is triggered is different from the user interface target data included in the log information corresponding to the target control, it is determined that an error has occurred in the updated target application; if the user interface test data after the target control is triggered is the same as the user interface target data included in the log information corresponding to the target control, it is determined that no error has occurred in the updated target application.
[0087] After determining that an error has occurred in the updated target application, the corresponding control when the error occurred is usually recorded to facilitate users to modify the error.
[0088] The above method also includes: updating the target application according to the test result of the target application.
[0089] Optionally, if an error occurs in the updated target application, you need to determine the cause and location of the error based on the UI test data and then update the target application.
[0090] Optionally, the test result includes relevant information about the control where the error occurred; based on the relevant information about the control where the error occurred, the program related to the control in the target application is updated. The relevant information about the control usually includes log information corresponding to the control, and the program related to the control is updated, such as updating the control class name, the function name and function parameters of the function executed when the control is triggered, and the environment variables when the control is triggered. In this way, the program where the error occurred in the target application is updated in a targeted manner based on the control-related information in the test results, thereby improving the modification and update efficiency.
[0091] In order to further ensure that the user interface target data is standard data, the above-mentioned step of generating a log file of at least one control in response to a trigger operation on at least one control may be implemented as follows: in response to a trigger operation on at least one control, the trigger result for the control is displayed on the graphical user interface; if the trigger result is different from the preset result, the step of responding to the trigger operation on at least one control and displaying the trigger result for the control on the graphical user interface is re-executed until the trigger result for each control is the same as the preset result, thereby obtaining a log file of at least one control.
[0092] That is to say, while the user is performing a trigger operation on a control, he will also observe the trigger result. Once he finds that the trigger result is different from the preset result, he will delete the previously generated log information and restart the trigger operation on at least one control. If each trigger result is the same as the preset result, the log information generated this time will be determined as a log file, and the user interface data included in the log information will be determined as user interface target data.
[0093] For example, Figure 2 As shown, the first step is to perform UI test operations and generate log information, corresponding to the above step S102, in response to the trigger operation for at least one control, generate a log file of at least one control; the log file includes at least one log information (i.e., log information); the second step is to automatically generate valid prompt corpus, corresponding to the above "generating at least one prompt information corresponding to at least one log information according to at least one log information and a preset prompt word template", wherein the prompt corpus is the prompt information; the third and fourth steps, the AI model (corresponding to the above target model) generates a regression script, corresponding to the above according to at least one prompt information, through the target model, determining at least one test case corresponding to at least one log information, wherein at least one test case is a regression script; the fifth step, the game client sequentially executes the script (i.e., regression script), corresponding to the above "execute the test case in the target order, and control the target control corresponding to the test case to be triggered", and the target application in this embodiment refers to the game application. Afterwards, the user interface test data after the target control is triggered will be obtained; the test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control.
[0094] In the above method, the recording process does not need to insert many extraction logic points in the source code, and does not require user maintenance. It also does not need to write additional parsing scripts, reducing the work of manual script writing and parsing.
[0095] Corresponding to the above method embodiment, the embodiment of the present disclosure provides a regression testing device for a user interface, wherein a terminal device runs a graphical user interface provided by a target application, wherein the graphical user interface includes at least one control, such as Figure 3 As shown, the device comprises:
[0096] The log file generation module 301 is used to generate a log file of at least one control in response to a trigger operation on at least one control; the log file includes at least one log information, the at least one log information corresponds to at least one control, and the log information includes user interface target data after the control corresponding to the log information is triggered;
[0097] A prompt information generating module 302, configured to generate at least one prompt information corresponding to at least one log information according to a preset prompt word template of at least one log information;
[0098] A test case determination module 303 is used to determine at least one test case corresponding to at least one log information according to at least one prompt information and through a target model;
[0099] The test data acquisition module 304 is used to execute the test cases in the target order, control the target controls corresponding to the test cases to be triggered, and obtain the user interface test data after the target controls are triggered;
[0100] The test result determination module 305 is used to determine the test result of the target application according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control.
[0101] The embodiment of the present disclosure provides a regression test device for a user interface, which generates a log file of at least one control in response to a trigger operation for at least one control; the log file includes at least one log information, the at least one log information corresponds to at least one control, and the log information includes the user interface target data after the control corresponding to the log information is triggered; at least one prompt information corresponding to the at least one log information is generated according to the at least one log information and a preset prompt word template; at least one test case corresponding to the at least one log information is determined through a target model according to the at least one prompt information; the test case is executed in a target order, the target control corresponding to the test case is controlled to be triggered, and the user interface test data after the target control is triggered is obtained; the test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control. In this method, without changing the source code, standard data is obtained through a recording operation, and test cases are intelligently generated through the preset prompt word template and the target model, so as to realize automatic writing of test cases, and regression testing is realized through test cases, without manual writing, saving the work of manual script writing, and improving the test efficiency and test accuracy.
[0102] The above-mentioned log information also includes: the control name and control class name of the control corresponding to the log information, the function name and function parameters of the function executed when the control is triggered, and the environment variables when the control is triggered.
[0103] The above-mentioned preset prompt word template includes: the description content of the log information template, the log information template, the role played by the target model, the instructions executed by the target model, and a code example of the output result of the target model; the above-mentioned prompt information generation module is also used to: for each log information, replace the log information template in the preset prompt word template with the log information to obtain the prompt information corresponding to the log information.
[0104] The description content of the above-mentioned log information template, the role played by the target model, the instructions executed by the target model, and the code example of the output result of the target model are used to guide the target model to generate at least one test case corresponding to at least one log information.
[0105] The above target model is a large-scale language model.
[0106] The above target order matches the triggering order of each control in at least one control.
[0107] The above-mentioned test data acquisition module is also used for: if the target application is updated, executing the test case in the target order, controlling the target control corresponding to the test case to be triggered, and generating the test log information corresponding to the target control; obtaining the user interface test data after the target control is triggered from the test log information.
[0108] The above-mentioned test result determination module is also used for: if the user interface test data after the target control is triggered is different from the user interface target data included in the log information corresponding to the target control, determining that an error has occurred in the updated target application; if the user interface test data after the target control is triggered is the same as the user interface target data included in the log information corresponding to the target control, determining that no error has occurred in the updated target application.
[0109] The above-mentioned log file generation module is also used to: respond to a trigger operation on at least one control and display the trigger result of the control on a graphical user interface; if the trigger result is different from a preset result, re-execute the step of responding to the trigger operation on at least one control and displaying the trigger result of the control on a graphical user interface until the trigger result of each control is the same as the preset result, thereby obtaining a log file of at least one control.
[0110] The device program update module is used to update the target application according to the test result of the target application.
[0111] The program update module is also used to update the program related to the control in the target application according to the relevant information of the control where the error occurs.
[0112] The user interface regression testing device provided in the embodiment of the present disclosure has the same technical features as the user interface regression testing method provided in the above embodiment, and therefore can also solve the same technical problems and achieve the same technical effects.
[0113] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned user interface regression testing method. The electronic device can be a server or a terminal device.
[0114] See also Figure 4 As shown, the electronic device includes a processor 100 and a memory 101 , wherein the memory 101 stores machine executable instructions that can be executed by the processor 100 , and the processor 100 executes the machine executable instructions to implement the above-mentioned regression testing method for the user interface.
[0115] Further, Figure 4 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0116] Among them, the memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0117] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.
[0118] The processor in the electronic device can implement the following operations in the regression testing method of the user interface by executing the machine executable instructions:
[0119] In response to a trigger operation for at least one control, a log file of at least one control is generated; the log file includes at least one log message, at least one log message corresponds to at least one control, and the log message includes user interface target data after the control corresponding to the log message is triggered; at least one prompt message corresponding to the at least one log message is generated according to the at least one log message and a preset prompt word template; at least one test case corresponding to the at least one log message is determined through a target model according to the at least one prompt message; the test case is executed in a target order, the target control corresponding to the test case is controlled to be triggered, and the user interface test data after the target control is triggered is obtained; the test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log message corresponding to the target control. In this method, without changing the source code, standard data is obtained through a recording operation, and test cases are intelligently generated through the preset prompt word template and the target model, so that automatic writing of test cases is realized, and regression testing is realized through test cases without manual writing, which saves the work of manual script writing and improves test efficiency and test accuracy.
[0120] The above-mentioned log information also includes: the control name and control class name of the control corresponding to the log information, the function name and function parameters of the function executed when the control is triggered, and the environment variables when the control is triggered.
[0121] The above-mentioned preset prompt word template includes: the description content of the log information template, the log information template, the role played by the target model, the instructions executed by the target model, and a code example of the target model output result; the step of generating at least one prompt message corresponding to at least one log information according to at least one log information and the preset prompt word template includes: for each log information, replacing the log information template in the preset prompt word template with the log information to obtain the prompt information corresponding to the log information.
[0122] The description content of the above-mentioned log information template, the role played by the target model, the instructions executed by the target model, and the code example of the output result of the target model are used to guide the target model to generate at least one test case corresponding to at least one log information.
[0123] The above target model is a large-scale language model.
[0124] The above target order matches the triggering order of each control in at least one control.
[0125] The above steps of executing test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and obtaining the user interface test data after the target controls are triggered, include: if the target application is updated, executing the test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and generating test log information corresponding to the target controls; and obtaining the user interface test data after the target controls are triggered from the test log information.
[0126] The above-mentioned step of determining the test result of the target application based on the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control includes: if the user interface test data after the target control is triggered is different from the user interface target data included in the log information corresponding to the target control, determining that an error has occurred in the updated target application; if the user interface test data after the target control is triggered is the same as the user interface target data included in the log information corresponding to the target control, determining that no error has occurred in the updated target application.
[0127] The above-mentioned step of generating a log file of at least one control in response to a trigger operation on at least one control includes: responding to a trigger operation on at least one control and displaying the trigger result of the control on a graphical user interface; if the trigger result is different from a preset result, re-executing the step of responding to the trigger operation on at least one control and displaying the trigger result of the control on a graphical user interface until the trigger result of each control is the same as the preset result, thereby obtaining a log file of at least one control.
[0128] The above method also includes: updating the target application according to the test result of the target application.
[0129] The test result includes relevant information of the control where the error occurs; the step of updating the target application according to the test result of the target application includes: updating the program related to the control in the target application according to the relevant information of the control where the error occurs.
[0130] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned regression testing method for the user interface.
[0131] The machine executable instructions stored in the machine readable storage medium can implement the following operations in the regression testing method of the user interface by executing the machine executable instructions:
[0132] In response to a trigger operation for at least one control, a log file of at least one control is generated; the log file includes at least one log message, at least one log message corresponds to at least one control, and the log message includes user interface target data after the control corresponding to the log message is triggered; at least one prompt message corresponding to the at least one log message is generated according to the at least one log message and a preset prompt word template; at least one test case corresponding to the at least one log message is determined through a target model according to the at least one prompt message; the test case is executed in a target order, the target control corresponding to the test case is controlled to be triggered, and the user interface test data after the target control is triggered is obtained; the test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log message corresponding to the target control. In this method, without changing the source code, standard data is obtained through a recording operation, and test cases are intelligently generated through the preset prompt word template and the target model, so that automatic writing of test cases is realized, and regression testing is realized through test cases without manual writing, which saves the work of manual script writing and improves test efficiency and test accuracy.
[0133] The above-mentioned log information also includes: the control name and control class name of the control corresponding to the log information, the function name and function parameters of the function executed when the control is triggered, and the environment variables when the control is triggered.
[0134] The above-mentioned preset prompt word template includes: the description content of the log information template, the log information template, the role played by the target model, the instructions executed by the target model, and a code example of the target model output result; the step of generating at least one prompt message corresponding to at least one log information according to at least one log information and the preset prompt word template includes: for each log information, replacing the log information template in the preset prompt word template with the log information to obtain the prompt information corresponding to the log information.
[0135] The description content of the above-mentioned log information template, the role played by the target model, the instructions executed by the target model, and the code example of the output result of the target model are used to guide the target model to generate at least one test case corresponding to at least one log information.
[0136] The above target model is a large-scale language model.
[0137] The above target order matches the triggering order of each control in at least one control.
[0138] The above steps of executing test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and obtaining the user interface test data after the target controls are triggered, include: if the target application is updated, executing the test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and generating test log information corresponding to the target controls; and obtaining the user interface test data after the target controls are triggered from the test log information.
[0139] The above-mentioned step of determining the test result of the target application based on the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control includes: if the user interface test data after the target control is triggered is different from the user interface target data included in the log information corresponding to the target control, determining that an error has occurred in the updated target application; if the user interface test data after the target control is triggered is the same as the user interface target data included in the log information corresponding to the target control, determining that no error has occurred in the updated target application.
[0140] The above-mentioned step of generating a log file of at least one control in response to a trigger operation on at least one control includes: responding to a trigger operation on at least one control and displaying the trigger result of the control on a graphical user interface; if the trigger result is different from a preset result, re-executing the step of responding to the trigger operation on at least one control and displaying the trigger result of the control on a graphical user interface until the trigger result of each control is the same as the preset result, thereby obtaining a log file of at least one control.
[0141] The above method also includes: updating the target application according to the test result of the target application.
[0142] The test result includes relevant information of the control where the error occurs; the step of updating the target application according to the test result of the target application includes: updating the program related to the control in the target application according to the relevant information of the control where the error occurs.
[0143] The computer program product of the user interface regression testing method, device, electronic device and storage medium provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0144] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0145] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0146] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0147] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0148] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A regression testing method for a user interface, characterized in that: The method includes: running at least one control provided by a target application program through a terminal device, and comprising: In response to a trigger operation on the at least one control, a log file of the at least one control is generated; the log file includes at least one log information, the at least one log information corresponds to the at least one control one by one, and the log information includes user interface target data after the control corresponding to the log information is triggered; Generate at least one prompt message corresponding to the at least one log message according to the at least one log message and a preset prompt word template; Determine, according to the at least one prompt information, at least one test case corresponding to the at least one log information through a target model; Execute the test cases in target order, control the target controls corresponding to the test cases to be triggered, and obtain user interface test data after the target controls are triggered; The test result of the target application is determined according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control.
2. The method according to claim 1, characterized in that The log information also includes: a control name and a control class name of the control corresponding to the log information, a function name and function parameters of a function executed when the control is triggered, and environment variables when the control is triggered.
3. The method according to claim 1, characterized in that The preset prompt word template includes: description content of the log information template, the log information template, the role played by the target model, the instructions executed by the target model, and a code example of the output result of the target model; The step of generating at least one prompt message corresponding to the at least one log message according to the at least one log message and a preset prompt word template includes: For each of the log information, the log information template in the preset prompt word template is replaced with the log information to obtain prompt information corresponding to the log information.
4. The method according to claim 3, characterized in that The description content of the log information template, the role played by the target model, the instructions executed by the target model, and the code example of the output result of the target model are used to guide the target model to generate at least one test case corresponding to the at least one log information.
5. The method according to claim 1, characterized in that The target model is a large-scale language model.
6. The method according to claim 1, characterized in that The target order matches a triggering order of each of the at least one control.
7. The method according to claim 1, characterized in that The steps of executing the test cases in a target order, controlling the target controls corresponding to the test cases to be triggered, and obtaining the user interface test data after the target controls are triggered include: If the target application is updated, the test cases are executed in a target order, the target controls corresponding to the test cases are controlled to be triggered, and the test log information corresponding to the target controls is generated; The user interface test data after the target control is triggered is obtained from the test log information.
8. The method according to claim 1, characterized in that The step of determining the test result of the target application according to the user interface test data after the target control is triggered and the user interface target data included in the log information corresponding to the target control comprises: If the user interface test data after the target control is triggered is different from the user interface target data included in the log information corresponding to the target control, it is determined that an error occurs in the updated target application; If the user interface test data after the target control is triggered is the same as the user interface target data included in the log information corresponding to the target control, it is determined that no error occurs in the updated target application.
9. The method according to claim 1, characterized in that: In response to a trigger operation on the at least one control, the step of generating a log file of the at least one control comprises: In response to a trigger operation on the at least one control, displaying a trigger result of the control on a graphical user interface; If the trigger result is different from the preset result, re-execute the step of responding to the trigger operation for the at least one control and displaying the trigger result for the control on the graphical user interface until the trigger result of each of the controls is the same as the preset result, thereby obtaining a log file for the at least one control.
10. The method according to claim 1, characterized in that The method further comprises: The target application is updated according to the test result of the target application.
11. The method according to claim 10, characterized in that The test result includes relevant information of the control where the error occurs; The step of updating the target application according to the test result of the target application comprises: According to the relevant information of the control in which the error occurs, the program related to the control in the target application is updated.
12. A regression testing device for a user interface, characterized in that: At least one control provided by a target application is run by a terminal device, and the apparatus comprises: A log file generation module, configured to generate a log file of the at least one control in response to a trigger operation on the at least one control; the log file includes at least one log information, the at least one log information corresponds to the at least one control one by one, and the log information includes user interface target data after the control corresponding to the log information is triggered; A prompt information generating module, configured to generate at least one prompt information corresponding to the at least one log information according to a preset prompt word template of the at least one log information; A test case determination module, used to determine at least one test case corresponding to the at least one log information according to the at least one prompt information and through the target model; A test data acquisition module, used to execute the test cases in a target order, control the target controls corresponding to the test cases to be triggered, and acquire user interface test data after the target controls are triggered; The test result determination module is used to determine the test result of the target application according to the user interface test data and the user interface target data included in the log information corresponding to the target control.
13. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the regression testing method for the user interface according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the user interface regression testing method according to any one of claims 1 to 11.
Citation Information
Cited By
Read-write function test method and device of storage chip, equipment and storage medium
CN119847941A
Test case generation and script optimization method and device based on machine learning
CN120123251A
Test case generation and script optimization method and device based on machine learning
CN120123251B
