A method of UI automation testing
Patent Information
- Application Number
- CN202311071575.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-24
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-08-24
AI Technical Summary
许多UI自动化测试框架没有提供成熟的录制功能;或者提供的录制功能偏简单,录制下来的脚本可读性很差,录制元素定位不准确
[0021] The UI automation testing method proposed in this invention enables the recording, playback, debugging, asynchronous batch execution, test case execution trace tracking, and video recording of the test case execution process. This solves problems such as difficulties in writing and managing UI automation test cases, poor readability of recorded scripts, low playback success rates, and difficulties in error tracking due to the lack of trace video playback. It maximizes work efficiency and ultimately improves product quality.
Smart Images

Figure CN117009245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of UI testing technology, specifically a method for UI automated testing. Background Technology
[0002] Currently, some UI automation testing frameworks and tools in use have the following problems that urgently need to be addressed when writing and executing test cases:
[0003] (1) Recording function. Many UI automation testing frameworks do not provide mature recording functions; or the recording functions they provide are too simple, resulting in poor readability of the recorded scripts and inaccurate positioning of recorded elements.
[0004] (2) Long startup time and low execution efficiency. Automated tools and frameworks start slowly; element location takes a long time, resulting in very low execution efficiency.
[0005] (3) Lack of automated test case visualization management tools. Currently, test cases are still stored as individual script files, lacking a visual management tool. When executing test cases in batches, scripts still need to be selected manually, which is inefficient and prone to errors. Summary of the Invention
[0006] The purpose of this invention is to provide a method for UI automation testing to solve the problems mentioned in the background art.
[0007] To achieve the above objectives, the present invention provides the following technical solution: a method for UI automated testing, the method comprising the following steps:
[0008] Test case recording, writing, and debugger;
[0009] Test case set executor;
[0010] Scheduled task designer.
[0011] Preferably, the test case recording, writing, and debugging tool supports the creation of test projects, the recording and writing of test cases, overall debugging, single-step debugging, viewing of debugging reports, and viewing of trace results.
[0012] Preferably, the test case executor supports sequential or multi-threaded batch execution of test cases and generates execution reports and trace results.
[0013] Preferably, the scheduled task designer is responsible for designing scheduled tasks so that the server calls the test case executor at a set time to execute test cases and generate test reports.
[0014] Preferably, the specific operations of test case recording, writing, and debugging include:
[0015] In Project, select the created project. The homepage displays a line graph showing the total number of test cases and their execution success rate under the current project. The bottom of the homepage displays the names and descriptions of all failed test cases. Clicking the MyCase button takes you to the test case recording, writing, and debugging interface. Clicking the Record button opens a browser using the PlayWright tool. User actions are recorded and all steps are displayed in the VirtualBatch Record window. Select all or some steps to copy to the script editor. Write the script directly in the script editor. Clicking the Debug button executes the current test case and outputs the test results and trace results. Clicking the Step-by-Step Debug button enters the step-by-step debugging window, supporting step-by-step debugging by clicking the Next button. Clicking the Save button saves the current script to the database.
[0016] Preferably, the specific operation of the test case set executor is as follows:
[0017] Click the Execute button to enter the test case executor interface. Users can create test case sets according to their business needs, select the required test cases in batches from the test case library and add them to the test case set, and adjust the execution order of test cases.
[0018] Preferably, the specific operations of the scheduled task designer include:
[0019] Users can set up scheduled tasks to invoke the test case set executor, enabling the system to automatically run the test case set and generate test reports and trace results within a specified time.
[0020] Compared with the prior art, the beneficial effects of the present invention are:
[0021] The UI automation testing method proposed in this invention enables the recording, playback, debugging, asynchronous batch execution, test case execution trace tracking, and video recording of the test case execution process. This solves problems such as difficulties in writing and managing UI automation test cases, poor readability of recorded scripts, low playback success rates, and difficulties in error tracking due to the lack of trace video playback. It maximizes work efficiency and ultimately improves product quality. Attached Figure Description
[0022] Figure 1 This is a diagram of the architecture of the present invention;
[0023] Figure 2 This is a schematic diagram of the recording of Embodiment 2 of the present invention;
[0024] Figure 3 A schematic diagram is provided for this invention;
[0025] Figure 4 This is a schematic diagram of single-step debugging of the present invention;
[0026] Figure 5 A schematic diagram illustrating the creation of a test case set for this invention;
[0027] Figure 6 A schematic diagram of test cases is introduced for this invention;
[0028] Figure 7 This is a schematic diagram illustrating the execution of a multi-threaded random browser according to the present invention;
[0029] Figure 8 This is a schematic diagram illustrating the batch execution of test reports according to the present invention;
[0030] Figure 9 This is a schematic diagram of the debugging report for this invention;
[0031] Figure 10 This is a schematic diagram illustrating the Trace result tracking of the present invention. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the present invention clear and complete, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only some, not all, embodiments of the present invention, and are merely illustrative of the embodiments of the present invention. They are not intended to limit the embodiments of the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] Example 1
[0034] Please see Figure 1 This invention provides a technical solution: a method for UI automated testing, the method comprising the following steps:
[0035] Test case recording, writing, and debugger;
[0036] Test case set executor;
[0037] Scheduled task designer.
[0038] The specific implementation method is as follows: (1) Test case recording, writing and debugging: Select the created project in Project. At this time, the homepage will display a line graph of the total number of test cases and the execution success rate under the current project. The names and descriptions of all failed test cases will be displayed at the bottom of the homepage. Clicking the My Case button will enter the test case recording, writing and debugging interface. Clicking the record button will call the Playwright tool to open the browser. User operations will be recorded and all steps will be displayed in the Record window of Uirabbit. You can select all or part of the steps to copy to the script editor; you can also write the script directly in the script editor; clicking the debug button will execute the current test case and output the test results and Trace results; clicking the single-step debug button will enter the single-step debug window, and you can click the next button to single-step debug; clicking the save button will save the current script to the database.
[0039] (2) Test Case Set Executor: Click the Execute button to enter the test case executor interface. Users can create test case sets according to their business needs, select the required test cases in batches from the test case library and add them to the test case set, and adjust the execution order of test cases. During test case execution, the sequential execution or simultaneous execution by multiple threads can be controlled according to the enabled multi-threading parameter.
[0040] a) Without multi-threading: Click the Execute button to execute test cases sequentially according to their order numbers. During execution, the browser type used for each test case is controlled by a random browser parameter. A test report and trace results are automatically generated upon completion.
[0041] b) When multi-threading is enabled: Clicking the Execute button will open N browsers simultaneously, based on the set number of threads N, to execute different test cases. This feature can significantly reduce test case execution time and effectively utilize server resources, improving test case execution efficiency. Similarly, during execution, the browser type used for each test case is controlled by a random browser parameter. After execution, a test report and trace results are automatically generated.
[0042] (3) Scheduled Task Designer. Supports users to set up scheduled tasks to call the test case set executor, so that the system can automatically run the test case set and generate test reports and trace results within a specified time.
[0043] This invention enables visualized management of UI automated test cases, excellent script recording functionality and readability, multi-threaded execution of test cases, and random browser type selection. It significantly improves the quality of the company's products and reduces learning costs. Business script writing time has been reduced from 2 days to 5 days, saving test case writing time; enabling multi-threaded test case execution reduces execution time from 18 hours to 5 hours, improving execution efficiency and greatly saving manpower and resources across the entire automation process. Compared to the company's previous UI automated testing tools, workload has been reduced and efficiency improved.
[0044] Example 2
[0045] Based on Example 1, the process of writing and executing test cases is as follows:
[0046] (1) Record, write, and debug test cases
[0047] Recording;
[0048] write;
[0049] Single-step debugging;
[0050] (2) Batch execution of test cases
[0051] Create a test case set;
[0052] For testing purposes;
[0053] Multi-threaded random browser execution (screenshot with headed mode; headless mode can be enabled during actual runtime).
[0054] (3) Test report analysis and trace result tracking
[0055] Batch execution of test reports;
[0056] Debugging report;
[0057] Trace result tracking.
[0058] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for UI automation testing, characterized in that: The method uses the following modules: Test case recording, writing, and debugger; Test case set executor; Scheduled task designer; The test case recording, writing, and debugging tool supports the creation of test projects, the recording and writing of test cases, overall debugging, single-step debugging, viewing of debugging reports, and viewing of trace results. The test case executor supports sequential or multi-threaded batch execution of test cases and generates execution reports and trace results. The scheduled task designer is responsible for designing scheduled tasks so that the server can call the test case executor at the set time to execute test cases and generate test reports. The specific operations of test case recording, writing, and debugging include: In Project, select the created project. The homepage displays a line graph showing the total number of test cases and their execution success rate under the current project. The bottom of the homepage displays the names and descriptions of all failed test cases. Clicking the MyCase button takes you to the test case recording, writing, and debugging interface. Clicking the Record button opens a browser using the PlayWright tool. User actions are recorded and all steps are displayed in the VirtualBatch Record window. Select all or some steps to copy to the script editor. Write the script directly in the script editor. Clicking the Debug button executes the current test case and outputs the test results and trace results. Clicking the Step-by-Step Debug button enters the step-by-step debugging window, supporting step-by-step debugging by clicking the Next button. Clicking the Save button saves the current script to the database.
2. The method for UI automated testing according to claim 1, characterized in that: The specific operations of the test case set executor are as follows: Click the Execute button to enter the test case executor interface. Users can create test case sets according to their business needs, select the required test cases in batches from the test case library and add them to the test case set, and adjust the execution order of test cases.
3. The method for UI automated testing according to claim 2, characterized in that: The specific operations of the scheduled task designer include: Users can set up scheduled tasks to invoke the test case set executor, enabling the system to automatically run the test case set and generate test reports and trace results within a specified time.
Citation Information
Patent Citations
User interface testing method and device
CN112148579A
Design and use method of automatic test case
CN114297057A