Multi-system terminal remote control software automatic testing method and system based on Flutter
By designing a Flutter-based multi-system terminal remote control software automation testing method and system, the problem of lack of Flutter automation testing tools for operating systems such as Hongmeng in the existing technology is solved, and efficient automated testing of multi-system terminals is realized, and testing efficiency and quality are improved.
Patent Information
- Application Number
- CN202510163521.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-03
AI Technical Summary
The lack of Flutter automation testing tools for operating systems such as Hongmeng in the prior art, making it difficult to perform automated testing of Flutter applications on these systems.
Provides a Flutter-based multi-system terminal remote control software automated testing method and system. By planning an automated test framework, designing test cases, automatically generating test scripts, and running tests through the Flutter Integration Test framework, capturing logs and error information in real time, automatically screenshots and interface verification, and finally generating detailed test reports.
It realizes automated testing of Flutter applications of multiple system terminals, including Hongmeng system, improves testing efficiency and quality, reduces testing costs, supports cross-platform testing, and provides detailed test reports to facilitate developers to quickly locate and fix problems.
Smart Images

Figure CN120086137A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular, to an automated testing method and system for remote control software of multi-system terminals based on Flutter. Background Art
[0002] With the popularization of intelligent devices and the rapid development of mobile applications, the importance of software testing has been increasing day by day. Automated testing tools have played an important role in improving testing efficiency and ensuring software quality. As an open-source cross-platform UI framework, Flutter has been widely welcomed for its high efficiency and excellent user experience. By using the integration_test plugin of Flutter, the software can be automatically compiled and run, and the software can be initialized. Then, an automated testing tool is called to realize the automatic startup of multi-terminal applications and the automatic clicking, swiping, text input, etc. of in-application elements, avoiding manual intervention, eliminating repetitive labor, and improving development efficiency and testing quality. As a new-generation operating system independently developed by Huawei, HarmonyOS has a distributed architecture and high performance, and is gradually adopted by more and more devices. However, currently, Flutter only takes into account several system platforms such as Android, iOS, Web, Windows, macOS, and Linux, and does not directly support operating systems such as HarmonyOS. Therefore, there is a lack of dedicated Flutter automated testing tools for systems such as HarmonyOS in the market. Summary of the Invention
[0003] The object of the present invention is to overcome the above-mentioned disadvantages of the prior art, and provide a comprehensive and efficient automated testing method for Flutter applications on systems such as HarmonyOS, which is based on Flutter for remote control software of multi-system terminals, and an automated testing system for multi-system terminal software based on Flutter that realizes the above-mentioned automated testing method, which can realize the intelligentization and visualization of the automated testing process.
[0004] The present invention is realized through the following technical solutions:
[0005] An automated testing method for remote control software of multi-system terminals based on Flutter includes the following steps:
[0006] S1. According to the functions of the remote control software, plan an automated testing framework, design test cases, and write test files and configuration files;
[0007] The test files include unit tests and integration tests. The unit tests are mainly for individual unit modules of the software to be tested, including login tests, device list and grouping tests, device list remote control function list tests, remote control desktop component tests, interface driver and accessibility tests. The integration tests are for individual pages of the software to be tested, including login tests, device list and grouping tests, device list remote control function list tests, and remote control desktop component tests.
[0008] S2. Automatic generation of test scripts: After testers configure corresponding parameters in the configuration file, the test files are automatically run, the configuration file is read, the use case parameters provided by the configuration file are automatically parsed, and Dart-format test scripts that conform to the Flutter Integration Test framework are automatically generated. The test scripts support human-computer interaction operations.
[0009] S3. Test execution: The generated test scripts are automatically loaded onto the terminal device, and the tests are run through the Flutter Integration Test framework. Logs and error information during the test process are captured in real time, and automatic screenshots are triggered when errors occur.
[0010] S4. Analysis and display of test results: The test execution results are summarized and analyzed, a test report is generated and displayed on the terminal device. The test report includes the pass rate, detailed error information, and error reasons. The detailed error information includes interface error logs and error interface screenshots in step S3.
[0011] Furthermore, in step S2, the automatic generation of Dart-format test scripts that conform to the Flutter Integration Test framework is achieved by the test data acquisition and generation module. The implementation method is as follows:
[0012] Read the specified.feature file and extract the set of numbers in it.
[0013] Count the total number of lines in the set of numbers, and automatically generate the corresponding number of test cases based on the counted total number of lines. Each test case is constructed based on the corresponding set of numbers to ensure that each test case has independent test data.
[0014] Output the generated test case set to a specified file for use in test execution.
[0015] Furthermore, in step S2, the method for the test system to read the configuration file is: through the customized getParamFromConf method, it is automatically read when the user performs initialization; the customized getParamFromConf method is mainly used to obtain the parameters of each line in the configuration file by reading the file.
[0016] Furthermore, in step S3, the method for capturing logs and error information during the test in real time is:
[0017] Configure the Flutter plug-in and Dart plug-in through the vscode program, introduce the logger plug-in in the Dart code, and configure the log level and output format as needed; when running flutter on the terminal device system through the flutter test***.dart command, the logger plug-in captures the running status in real time, outputs log information according to the configuration and records it in the running log, including error information. You can view the log information directly in the VSCode terminal. If you need to save the log to a file, you can configure FileOutput in the code. You can adjust the log level according to the test requirements to avoid information overload; you can also customize the log format to make it more in line with reading habits; during the test process, pay attention to the impact of logging on performance and optimize it when necessary.
[0018] Furthermore, in step S3, the method for triggering automatic screenshot when an error occurs includes the following steps:
[0019] When an error step occurs and the log is reported, the current page is kept and the call of the screenCapture method is triggered. For different operating systems, the system type is passed to the screenCapture method through the initialization parameter passing method. The screenshot API of the corresponding system is called through the internal code of this method to realize automatic screenshot.
[0020] Furthermore, in step S3, after each single test case is run, a step of taking a screenshot of the interface and performing a comparison and verification is also included, and the method is as follows:
[0021] Through the custom captureCurrentScreen method, obtain the real-time screen of the current device test. After grayscale processing the real-time screen, perform linear processing to make the screen line-based (mainly composed of lines). Then, identify the outline formed by the lines and compare it with the line outline of the preset standard interface screenshot. Determine whether the UI interface is correct by judging whether the two are the same, and adjust the accuracy of page difference recognition by giving the accuracy parameter of fuzzy recognition during initialization; the custom captureCurrentScreen method includes judging different systems and calling the corresponding screenshot method according to different systems to take screenshots.
[0022] Further, in step S4, the method for summarizing and analyzing the test execution results includes the following steps: Through the custom logToXml and custom logCount methods, summarize all error logs that occur during the operation and generate a file in XML format. Then, through the custom analysisXml method, separate and organize the Failed logs and Error logs. The custom logToXml method is mainly used to write logs into an excel through code, the custom logCount method is mainly used to summarize and count the Failed logs and Error logs, and the custom analysisXml method is used to parse, process, or analyze XML data.
[0023] Further, in step S4, the method for generating a test report is: Obtain the debug logs of the current running state through the custom logger.d('debugmessage') method, and through the custom Future <void>The saveTestLog()async{} method collects logs and saves them locally or in a database; then it calls the analysisLog method to analyze the logs, determines whether there are error or failed steps by checking for the presence of the keywords error or failed, and stores the operation steps corresponding to the error or failed logs in the XML-formatted logs; then it generates an HTML-formatted test report through the custom createTestReport method; meanwhile, it provides detailed information about the failed test cases, including screenshots of the error interfaces.
[0024] The custom logger.d('debug message') method is used to obtain the debug logs of the current run; the custom Future <void>The `saveTestLog()async{}` method is mainly used to record and summarize various types of logs that occur during testing, including regular program logs and program error logs;
[0025] The custom `createTestReport` method is mainly used to record all logs of the `log`, `error`, and `debug` types in an HTML file step by step according to the test cases during the program running process, which is convenient for developers to double-click to start the corresponding HTML format to view the results after the entire program test.
[0026] Furthermore, the operating system of the terminal device includes the HarmonyOS.
[0027] A multi-system terminal remote control software automated testing system based on Flutter, used for the above-mentioned multi-system terminal remote control software automated testing method based on Flutter, includes a test script automatic generation module, a test execution module, and a test result analysis module;
[0028] The test script automatic generation module includes a configuration file reading and parsing module and a test data acquisition and generation module. The configuration file reading and parsing module is used to read the case parameters in the configuration file, and the test data acquisition and generation module is used to acquire test data and automatically generate Dart test scripts that conform to the Flutter Integration Test framework;
[0029] The test execution module includes a test script loading and running module, a log capture module, an error screenshot module, and an interface verification module. The test script loading and running module is used to load the test script on the test terminal device system and run the test through the Flutter Integration Test framework. The log capture module is used to capture the log information during the test through the logger plugin. The error screenshot module is used to automatically capture the error interface screenshot after an error occurs during the test. The interface verification module is used to capture and compare the screenshots of the interface after running a single test case, identify the error interface screenshot, and compare it with the standard interface screenshot to verify whether the UI interface is correct;
[0030] The test result analysis module includes a log summary module and a test report generation module. The log summary module is used to summarize logs through the analysisLog method, summarize all error logs that occur during the running process through the logToXml and logCount methods, generate a file in XML format, and separately summarize Failed logs and ERROR logs through the custom analysisXml method. The test report generation module is used to generate a test report in HTML format through the custom createTestReport method.
[0031] The technical solution of the present invention has the following beneficial effects compared with the prior art:
[0032] (1) An automated test tool based on the Flutter Integration Test framework is written in the Dart language, which can automatically generate test scripts, implement test operations such as automatic clicking and inputting, reduce the time for manually writing test code, reduce manual intervention, and also reduce the number of test failures and repeated tests caused by human errors. It can execute a large number of test cases in a short time, greatly improve the test efficiency, significantly shorten the test cycle, and reduce the test cost.
[0033] (2) The automated test tool of the present invention adopts a modular design, which is easy to integrate with other development tools. At the same time, the test script is written in the Dart language, which not only makes full use of the programming language natively supported by Flutter, but also ensures the simplicity, readability, and efficiency of the test script, facilitating developers to write and maintain the test script.
[0034] (3) The test tool of the present invention can automatically collect test logs, support automatically generating screenshots during the test process, and through comparison with the expected results, achieve visual verification, greatly improving the intuitiveness and accuracy of the test results, helping to discover potential problems of the application in different scenarios, and can automatically analyze the test results and generate a detailed test report, providing developers with fast and comprehensive test feedback.
[0035] (4) By integrating the characteristics and APIs of multiple systems such as HarmonyOS, the present invention supports all the characteristics of the Flutter framework, enabling the test tool to be applied not only to multi-system platforms such as windows, macos, linux, ios, and Android, but also to systems such as Huawei's openHarmony, enabling the application developed based on Flutter to achieve automated testing on the HarmonyOS system, ensuring the compatibility and stability of the test tool, being able to test complex UI interactions, and enabling developers to not need to write different test scripts for different platforms, reducing the complexity and repeatability of the test work.
[0036] (5) Facilitate developers to get started by providing a user-friendly interface and detailed documentation, can integrate common test cases, provide rich example codes, support multiple people to execute test tasks simultaneously, and achieve rapid communication and collaboration among team members by sharing test reports and test results.
[0037] Therefore, the automated test tool of the present invention provides strong support for Flutter application development on multiple systems such as HarmonyOS by significantly improving test efficiency, reducing test costs, enhancing test quality, supporting cross-platform testing, being easy to integrate and maintain, and improving user experience. Brief Description of the Drawings
[0038] Figure 1 It is a method framework diagram of an embodiment of the present invention.
[0039] Figure 2 It is a structural block diagram of an embodiment of the present invention. Detailed Embodiments
[0040] An automated test method for a multi-system terminal remote control software based on Flutter is compatible with multiple operating systems including HarmonyOS of Huawei, and also includes common systems such as Android, iOS, Windows, macOS, and Linux, providing a comprehensive and efficient test solution for Flutter applications on these systems, especially for the testing of remote control software on these systems. Specifically, it includes the following steps:
[0041] S1. According to the functions of the remote control software, plan an automated test framework, design test cases, and write test files and configuration files.
[0042] Such as Figure 1 , the test files include unit tests and integration tests. Unit tests are tests conducted on individual unit modules of the software to be tested, which include login test account_accessibility_test.dart, device list and grouping test device_list_accessibility_test.dart, device list remote control function list test device_function_list_accessibility_test.dart, remote control desktop component test remote_control_function_list_accessibility_test.dart, interface driver widget_test.dart, and accessibility test accessibility_test.dart. The unit test files include a set of test cases for unit tests.
[0043] Integration testing is a test that targets a single page of the software to be tested. It includes login testing (account_accessibility_test.dart), device list and grouping testing (device_list_accessibility_test.dart), device list remote control function list testing (device_function_list_accessibility_test.dart), and remote control desktop component testing (remote_control_function_list_accessibility_test.dart). Taking a single page as the test object allows the page to be called and tested individually, with a clear structure and no need to write initialization code. With the code files for unit testing, UI automation test cases can directly call the classes and methods encapsulated in the unit testing framework to directly test the corresponding modules, without the need to write independent test cases. By simply passing parameters to the unit test cases, it is possible to check whether the changes in the UI interface meet expectations. Therefore, after writing unit test cases based on the existing software code to be tested, UI automation scripts can be written, and the writing of UI automation scripts can be separated from the R & D code of the original software.
[0044] Such as Figure 1 , the test case file includes methods such as testData, setupALL, setup, teardown, group, testWidget, pumpwidget, await expect, and find. Specifically:
[0045] testData: A collection of test data (different test cases can be automatically generated through test data)
[0046] setupALL: Initialization of the test suite
[0047] setup: Initialization of the test case
[0048] teardown: Restore the state of the test case
[0049] group: A collection of testWidget calls
[0050] testWidget: A collection of test steps (cooperating with the testData module, different test cases can be automatically generated through test data)
[0051] pumpwidget: Call the interface method
[0052] await expect: Wait for the specified element to load
[0053] find to locate the specified element
[0054] find.byType
[0055] find.byToolTip
[0056] find.byWidget
[0057] find.byIcon
[0058] find.bykey
[0059] find.byElementType
[0060] find.byElementPredicate
[0061] find.byWidgetPredicate
[0062] find.image
[0063] find.text
[0064] find.toString
[0065] find.widgetWithIcon
[0066] find.widgetWithImage
[0067] find.widgetWithText
[0068] find.bySubtype
[0069] find.bySemanticsLabel
[0070] The configuration file can be written in the dart file format, mainly including the encrypted account password (considering network security), the device names and device details shown on each interface under the corresponding test account, etc.
[0071] S2. Automatic generation of test scripts: After testers configure the corresponding parameters in the configuration file, they automatically run the test file, read the configuration file, automatically parse the test case parameters provided by the configuration file, and automatically generate Dart-format test scripts that conform to the Flutter Integration Test framework. The test scripts support common human-computer interaction operations such as clicking, swiping, and inputting. Before testing, it is necessary to pre-obtain key information such as the element names of the software under test or the coordinates of the elements to be tested, and configure this information into the configuration file.
[0072] List examples of specific implementations: When testing the situation of logging in to the remote control software via mobile phone number, the tester only needs to set the login method to mobile phone number in the configuration file and enter the corresponding mobile phone number; if testing the situation of logging in to the remote control software via account password, only need to set the login method to account password in the configuration file and enter the corresponding account name and password, then the login test with account password can be carried out. There is no need to elaborate on such cases. When running the script for testing, it will automatically simulate manual input and directly input the parameters set in the configuration file into the input boxes of the corresponding modules one by one.
[0073] The method for the test system to read the configuration file is specifically as follows: By calling the custom getParamFromConf method, the configuration file is automatically read when the user performs initialization without manual import. The custom getParamFromConf method is mainly used to obtain the parameters of each line in the file by reading the file, line by line, similar to the method of reading a csv file in python.
[0074] The test data acquisition and generation module is used to automatically generate test scripts in Dart format. The main function of the test data acquisition and generation module is to obtain test data and generate dart test scripts. In this embodiment, the test data acquisition and generation module is mainly implemented through the custom module get_test_data.dart, and its implementation method and principle are as follows:
[0075] Read the specified.feature file and extract the set of numbers in it;
[0076] Count the total number of lines in the set of numbers, and automatically generate the corresponding number of test cases according to the counted total number of lines, that is, the number of test cases generated is the same as the number of lines of test data; each test case is constructed based on the corresponding set of numbers to ensure that each test case has independent test data;
[0077] Output the generated test case set to a specified file for test execution.
[0078] S3. Test execution: Automatically load the generated test script onto the terminal device, run the test through the Flutter Integration Test framework, and capture the logs and error information during the test in real time. When an error occurs, trigger an automatic screenshot.
[0079] For HarmonyOS devices, deploy the test script to the corresponding HarmonyOS devices, support debug debugging of mainstream IDEs, such as vscode, pycharm, InterlliJ IDEA, etc., and preferably use vscode.
[0080] During the testing process, it is necessary to capture log information in real time, including error information. The specific method is as follows: Configure the Flutter plugin and Dart plugin through IDE programs such as vscode, introduce the logger plugin in the Dart code, and configure the log level and output format as needed; When running flutter through the flutter test ***.dart command on the terminal device system, the logger plugin (logger:^1.0.0) captures the running status in real time, outputs the log information according to the configuration and records it in the running log, and the log information includes error information. The log information can be directly viewed in the terminal of VSCode. If it is necessary to save the log to a file, FileOutput can be configured in the code. The log level can be adjusted according to the test requirements to avoid information overload; The log format can also be customized to make it more in line with the reading habit; During the testing process, pay attention to the impact of log recording on performance and optimize it if necessary.
[0081] When an error message appears, a screenshot of the error can also be taken. The method for triggering automatic screenshot when an error occurs may include the following steps: when an error step occurs, after the log is reported, the current page remains on the page, and the call of the screenCapture method is triggered. Since the screenshot methods or API calls of different operating systems are different, the present invention proposes an independent system judgment method, that is, through the initialization parameter passing method, the system type is passed to the screenCapture method, and the internal code of this method is used to implement different systems to use different screenshot APIs, thereby realizing the function of automatic screenshot when an error occurs. After running a single test case each time, the interface needs to be screenshotted and compared for verification. The method is as follows: through the custom captureCurrentScreen method, which is similar to image recognition technologies such as Tesseract OCR, obtain the real-time screen of the current device test, and gray the real-time screen, perform linear processing on the grayscale screen, the screen after linear processing is mainly composed of lines, and the outline of the line composition is used as the recognition block, the block is recognized, and then it is compared with the line outline of the preset standard interface screenshot (obtained after manual screenshot and saving), and the UI interface of the test is judged to be correct by judging whether the two are consistent. The accuracy parameter of fuzzy recognition can be given during initialization to adjust the accuracy of page difference recognition. The above custom captureCurrentScreen method includes judgments on different systems, including Windows, openharmony, macOS, Android, iOS, and Linux systems. For different systems, different screenshot methods are called to take screenshots. For example, when the system is identified as Linux, the native screenshot plug-in and the external function interface FFI are called to interact with the C / C++ code, or commands are executed through process_run, etc. If the screenshot can be captured, the screenshot is returned. If the screenshot cannot be obtained, the second logic is entered, and scrot or gnome-screenshot is called to take a screenshot.
[0082] S4. Test result analysis and display: The test execution results are summarized and analyzed, and a test report is generated and displayed on the terminal device. The test report includes the pass rate, error details and error causes. The error details include interface error logs and error interface screenshots.
[0083] The method for summarizing test results is as follows: Through the custom logToXml and logCount methods, all error logs that occur during the running process are summarized, and an XML-formatted file is generated. Then, through the custom analysisXml method, the Failed logs and Error logs are separately summarized and organized to achieve concise and easy-to-read logs, facilitating developers to quickly understand the test situation. The custom logToXml method mainly writes the logs into an excel through code. The custom logCount method mainly summarizes and counts the error logs and exception logs (Failed logs and Error logs). The custom analysisXml method is used to parse, process, or analyze XML data.
[0084] The method for generating a test report is as follows: Obtain the debug logs of the current running status through the custom logger.d('debug message') method, and through the custom Future <void>The `saveTestLog()async{}` method collects logs and saves them locally or in a database; then it calls the `analysisLog` method to analyze the logs. By checking whether there are keywords such as `error` or `failed`, it determines whether there are error or failed steps and stores the operation steps corresponding to the error or failed logs in the XML-formatted logs; then it generates an HTML-formatted test report through the custom `createTestReport` method. At the same time, it provides detailed information about the failed test cases, including interface error logs and interface error screenshots, to help developers locate and fix problems.
[0085] The custom `logger.d('debug message')` is mainly used to obtain the debug logs of the current running status. The custom Future <void>The `saveTestLog()` async method mainly records and summarizes various types of logs that occur during testing, including regular program logs and program error logs, to facilitate viewing and observing the overall process of program operation. For example, logs of the `log` type are classified as regular program logs, and those of the `error` type are classified as program error logs. The basic principle is to record the logs when image recognition fails during the running of test cases in an Excel file to facilitate developers in debugging program problems.
[0086] The specific principle of the custom `createTestReport` method is that during the program's operation, all logs of the `log`, `error`, and `debug` types are recorded in an HTML-formatted file according to the step-by-step running of the test cases. Through simple arrangement, developers can double-click to launch this HTML format to view the results after the entire program test, which is more intuitive and convenient to view. The specific format can be:
[0087] <!DOCTYPE html>
[0088] ***
[0089] <img src="${screenshotPath.replaceAll(”,'%20')}"alt="Screenshot"> # (This is the screenshot shown when the test case runs with an error)
[0090]
[0091]
[0092] A multi-system terminal remote control software automation testing system based on Flutter is used to implement the above-mentioned multi-system terminal remote control software automation testing method based on Flutter, such as Figure 2 , which includes a test script automatic generation module, a test execution module, and a test result analysis module.
[0093] The test script automatic generation module includes a configuration file reading and parsing module and a test data acquisition and generation module. The configuration file reading and parsing module is used to read the case parameters in the configuration file, and the test data acquisition and generation module is used to automatically generate Dart test scripts that conform to the Flutter Integration Test framework.
[0094] The test execution module includes a test script loading and running module, a log capture module, an error screenshot module, and an interface verification module. The test script loading and running module is used to load test scripts on the terminal device system under test and run the tests through the Flutter Integration Test framework. The log capture module is used to capture log information during the test through the logger plugin. The error screenshot module is used to automatically capture screenshots of the error interface after an error occurs during the test. The interface verification module is used to capture screenshots of the interface and compare and verify them after running a single test case to verify whether the UI interface is correct.
[0095] The test result analysis module includes a log summary module and a test report generation module. The log summary module is used to summarize the logs through the analysisLog method, and through the custom logToXml and custom logCount methods, summarize all the error logs that occur during the running process and generate a file in XML format, and through the custom analysisXml method, separately summarize the Failed logs and Error logs; The test report generation module is used to generate a test report in HTML format through the custom createTestReport method.
[0096] The above detailed description is a specific description of the feasible embodiments of the present invention. This embodiment is not intended to limit the patent scope of the present invention. Any equivalent implementation or change without departing from the present invention shall be included in the patent scope of this case.< / void> < / void> < / void> < / void>
Claims
1. A multi-system terminal remote control software automated testing method based on Flutter, characterized in that: The steps include: S1. Plan the automated testing framework, design test cases, and write test and configuration files according to the functions of the remote control software; The test file includes unit test and integration test. The unit test is a test for a single unit module of the software to be tested, including login test, device list and group test, device list remote control function list test, remote control desktop component test, interface driver and accessibility test; the integration test is a test for a single page of the software to be tested, including login test, device list and group test, device list remote control function list test and remote control desktop component test; S2. Automatic generation of test scripts: After the tester configures the corresponding parameters in the configuration file, the test file is automatically run, the configuration file is read, the use case parameters provided by the configuration file are automatically parsed, and the test script in Dart format that conforms to the FlutterIntegration Test framework is automatically generated. The test script supports human-computer interaction operations; S3, test execution: The generated test script is automatically loaded onto the terminal device, the test is run through the Flutter IntegrationTest framework, and the logs and error information during the test are captured in real time. When an error occurs, an automatic screenshot is triggered. S4. Test result analysis and display: The test execution results are summarized and analyzed, and a test report is generated and displayed on the terminal device. The test report includes the pass rate, error details and error causes. The error details include the interface error log and the screenshot of the error interface in step S3.
2. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S2, the test script in Dart format that conforms to the FlutterIntegration Test framework is automatically generated by testing the data acquisition and generation module to automatically generate the test script in Dart format. The implementation method is as follows: Read the specified .feature file and extract the digital set in it; Count the total number of rows in a digital set, and automatically generate a corresponding number of test cases based on the total number of rows counted. Each test case is built based on the corresponding digital set to ensure that each test case has independent test data; Output the generated test case set to the specified file for test execution.
3. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S2, the method for the test system to read the configuration file is: through the customized getParamFromConf method, it is automatically read when the user performs initialization; the customized getParamFromConf method is mainly used to obtain the parameters of each line in the configuration file by reading the file.
4. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S3, the method for capturing logs and error information in the test process in real time is as follows: configure the Flutter plug-in and Dart plug-in through the vscode program, introduce the logger plug-in in the Dart code, and configure the log level and output format as needed; when running Flutter on the terminal device system through the flutter test***.dart command, the logger plug-in captures the running status in real time, outputs log information according to the configuration, and records it in the running log, and the log information includes error information.
5. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S3, the method for triggering automatic screenshot when an error occurs includes the following steps: when an error step occurs, after the log error is reported, the current page is kept, and the call of the screenCapture method is triggered. For different operating systems, the system type is passed to the screenCapture method through the initialization parameter passing method, and the screenshot API of the corresponding system is called through the internal code of the method to realize automatic screenshot.
6. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S3, after each single test case is run, the interface is also included in the steps of screenshot and comparison verification, and the method is as follows: through the custom captureCurrentScreen method, the real-time picture of the current device test is obtained, the real-time picture is grayed out and then linearly processed, and after the picture is linearized, the outline formed by the lines is identified, and it is compared with the line outline of the preset standard interface screenshot, and whether the UI interface is correct is determined by judging whether the two are consistent, and the accuracy of the fuzzy recognition is given during initialization to adjust the accuracy of the page difference recognition; the custom captureCurrentScreen method includes judgments on different systems, and calls corresponding screenshot methods according to different systems to take screenshots.
7. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S4, the method for summarizing and analyzing the test execution results includes the following steps: summarizing all error logs that appear during the running process through the customized logToXml and customized logCount methods, and generating files in XML format, and then summarizing and organizing the Failed logs and Error logs separately through the customized analysisXml method; the customized logToXml method is used to write the logs into Excel through code, the customized logCount method is used to summarize and count the Failed logs and Error logs, and the customized analysisXml method is used to parse, process or analyze XML data.
8. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: In step S4, the method for generating a test report is: Get the debug log of the current running status through the custom logger.d('debug message') method, and use the custom Future <void>The saveTestLog()async{} method collects logs and saves them locally or in a database. The analysisLog method is then called to analyze the logs. By checking whether there are error or failed keywords, it is determined whether there are errors or failed steps, and the operation steps corresponding to the error or failed logs are stored in an XML format log. The custom createTestReport method is then used to generate a test report in HTML format. At the same time, detailed information about the failed test case is provided, including a screenshot of the error interface.< / void> The custom logger.d('debug message') method is used to obtain the debug log of the current run; the custom Future <void> The saveTestLog()async{} method is used to record and summarize various types of logs that appear in the test, including regular program logs and program error logs;< / void> The custom createTestReport method is used to record all log, error, and debug logs in HTML format files according to the step-by-step execution of the test cases during the program running process, so that developers can double-click to start the corresponding HTML format to view the results of the entire program test.
9. According to a Flutter-based multi-system terminal remote control software automated testing method according to claim 1, it is characterized in that: The operating system of the terminal device includes Hongmeng system.
10. A multi-system terminal remote control software automated testing system based on Flutter, used to implement a multi-system terminal remote control software automated testing method based on Flutter as described in any one of claims 1 to 9, characterized in that: It includes test script automatic generation module, test execution module and test result analysis module; The test script automatic generation module includes a configuration file reading and parsing module and a test data acquisition and generation module. The configuration file reading and parsing module is used to read the use case parameters in the configuration file, and the test data acquisition and generation module is used to acquire test data and automatically generate a Dart test script that conforms to the Flutter Integration Test framework; The test execution module includes a test script loading and running module, a log capture module, an error screenshot module and an interface verification module. The test script loading and running module is used to load the test script on the terminal device system under test and run the test through the Flutter Integration Test framework. The log capture module is used to capture log information during the test through a logger plug-in. The error screenshot module is used to automatically take a screenshot of the error interface after an error occurs during the test. The interface verification module is used to take a screenshot and compare the interface after running a single test case to verify whether the UI interface is correct; The test result analysis module includes a log summary module and a test report generation module. The log summary module is used to summarize the logs through the analysisLog method, and to summarize all error logs that occur during the running process through the customized logToXml and customized logCount methods, and generate XML format files, and to summarize the Failed logs and Error logs separately through the customized analysisXml method; the test report generation module is used to generate a test report in HTML format through the customized createTestReport method.
Citation Information
Patent Citations
Method and device for generating integration testing case
CN105224461A
Flutter-based UI test method, apparatus and device, and storage medium
CN117407300A
Web automatic testing method and system under Linux operating system
CN117648257A
Test case generation method and device, storage medium and terminal equipment
CN117743170A