Graphical user interface software function coverage test method
By analyzing the window structure and event flow chart of the graphical user interface software on the cloud test platform, dividing functional modules, and using cross-platform frameworks or libraries to write test scripts, the problem of low test coverage in different devices and network environments is solved, efficient and comprehensive one-time testing is achieved, and user experience and testing efficiency is improved.
Patent Information
- Application Number
- CN202411554690.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing graphical user interface software function coverage testing methods are easily restricted to specific physical devices and network environments during the testing process under different devices and network environments, resulting in low coverage of the test environment and affecting the user experience.
By analyzing the window structure and event flow chart of the software being tested, dividing functional modules, obtaining test requirements, and using cross-platform frameworks or libraries to write test scripts on the cloud test platform to perform automated testing. Use code coverage tools to analyze functional coverage, apply genetic algorithms or evolutionary calculations to optimize test scripts, and improve test coverage.
It realizes comprehensive coverage of software functions in different devices and network environments, improves user experience, shortens test cycles, and reduces repetitive labor and testing costs.
Smart Images

Figure CN119621542A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of software engineering, and in particular to a graphical user interface software function coverage testing method. Background Art
[0002] With the rapid development of information technology and the widespread application of graphical user interfaces in software, graphical user interfaces have become an indispensable way for users to interact with software. However, the complexity of graphical user interface software has also increased. It contains many functional modules and intricate behavior paths, which poses a severe challenge to software quality assurance. Software function diagrams are the basis and basis for functional coverage testing, but function diagrams can only be manually operated by testers based on documents such as software requirements specifications, which is labor-intensive and lacks accuracy.
[0003] Based on this technology, there is CN101916225A-Graphical user interface software function coverage test method. The steps of the graphical user interface software function coverage test method are to analyze the software under test, find out the calling relationship between all the windows of the software, the events contained in each window and their mutual relationship, and the event interaction relationship between the windows, and simplify the event interaction diagram; track the test process, capture the windows and events passed during the execution of the software under test, and generate a software operation diagram based on the captured execution information of the test case; optimize the test case, eliminate duplicate and redundant test cases; The software operation diagram is compared with the event interaction diagram, and the covered events and event interactions are marked on the event interaction diagram. At the same time, test coverage statistics are given; according to the test coverage statistics, it is determined whether the set test coverage standard is met; if it is met, the test is stopped; otherwise, the execution of new test cases is tracked; this method realizes the automatic generation of software function diagrams, improves test efficiency and test quality, but this method uses traditional testing methods in the testing process of software under different equipment and network environments, which is easily limited by specific physical equipment and network environments, and the test environment coverage is low, thus affecting user experience. Summary of the invention
[0004] The main purpose of the present invention is to provide a graphical user interface software function coverage testing method to expand the software function coverage, improve user experience, while shortening the testing cycle, reducing duplication of work and testing costs.
[0005] To achieve the above object, the present invention provides a graphical user interface software function coverage testing method, comprising the following steps: By analyzing the software under test and identifying the window structure of the graphical user interface, an event flow chart is constructed, and the software under test is divided into functional modules; According to the event flow chart and the functional module, obtaining test requirements; the test requirements include test cases, execution steps and expected effects; Establishing a cloud testing platform, and installing the software under test into a virtual device of the cloud testing platform for operation; Using a cross-platform framework or library, writing a first test script according to the test requirements, and deploying it to the cloud test platform to trigger the execution of the first test; obtaining first test data during the test execution process; Based on the first test data, the functional coverage of the graphical user interface is analyzed, and the code execution path is counted by a code coverage tool to analyze the code coverage and obtain the coverage analysis result; Analyze and evaluate the coverage analysis results, formulate a coverage optimization strategy, and update the cloud testing platform according to the coverage optimization strategy; Based on the coverage optimization strategy, the first test script is optimized by using a genetic algorithm or evolutionary computing to obtain a second test script; Deploy the second automated test script to the updated cloud test platform to re-execute the script test, collect second test data, and verify the effective coverage of the second test script; write a visual test report and provide feedback.
[0006] Furthermore, after analyzing the software under test and identifying the window structure of the graphical user interface, an event flow chart is constructed, and the steps of dividing the software under test into functional modules include: Browse all graphical user interfaces of the software under test, understand and record the interface elements, layout and functional characteristics of the graphical user interfaces; Determine the main window of the software under test, trigger the display of the sub-window through user operation, obtain the hierarchical relationship, call relationship and data flow between the windows to construct a window structure diagram; Identify all operations performed by the user and the system's response events to draw an event flow chart, which includes the sequence and logic of user operations, system responses, and interface changes; According to the window structure and the event flow chart, independent functional modules are identified, the input, output and interaction interface of each functional module with other modules are clarified, and the functional modules are divided.
[0007] Further, according to the event flow chart and the functional module, the test requirements are obtained; the test requirements include test cases, execution steps and steps of expected effects, including: Based on the analysis of the event flow chart and the functional modules, test cases are designed one by one; the test cases cover all behavioral paths and functional points; Design test scenarios for each test case, including preconditions, input data, test steps, and expected environment states; List the execution steps of the test case, including user actions, system responses, and input data; Clarify the expected effects that should be achieved after the execution of the execution case, including one or more of the changes in system status, output data, and generated errors or exception information; Necessary test data is preset for triggering the behavior path and function point, and the necessary test data includes normal data and abnormal data.
[0008] Furthermore, the steps of establishing a cloud testing platform and installing the software under test into a virtual device of the cloud testing platform for running include: Establish a cloud testing platform, including test environment configuration, network environment configuration and test software installation; Test environment configuration: create virtual devices on the cloud test platform, including different models of mobile phones, tablets and computers (PCs); match the operating system version, screen resolution parameters and storage configuration of the virtual devices to simulate real usage scenarios; Network environment configuration: preset network environments on the cloud testing platform, such as Wi-Fi, 3G / 4G / 5G, to test the performance of the software in different network environments; Test software installation: install the software under test into the virtual device, configure the test environment and network environment according to the test case and run it normally.
[0009] Furthermore, a cross-platform framework or library is used to write a first test script according to the test requirements, and the script is deployed to the cloud test platform to trigger the execution of the first test; and the step of obtaining first test data of the test execution process includes: Analyze the behavior paths and functional points that need to be tested in the test requirements, preparation of test data, execution steps, and expected results; Select a cross-platform testing framework or library based on the testing requirements and technology stack; Using the selected cross-platform framework or library to write a first test script; the first test script includes initialization of the test environment, preparation of test data, execution of test steps, correctness of assertion results, and cleanup of the test environment; Uploading the first test script to the cloud testing platform; Configure the preset environment of the cloud testing platform according to the test case; for example, the operating system, browser version, device type, etc. on which the test is run; The first test is executed by triggering the user interface, application programming interface call or scheduled task, and the cloud testing platform runs the first test script in the preset environment; Recording data generated during the test execution process, such as test steps, input data, output results, error messages, etc., through the logging function of the first test script of the test script; View the progress and real-time output of the first test through the real-time monitoring function of the cloud testing platform; After the first test is executed, first test data is obtained, including execution logs, test results, test duration, performance indicators, error details and exception reports, etc.
[0010] Further, based on the first test data, the functional coverage of the graphical user interface is analyzed, the code execution path is statistically analyzed by a code coverage tool, the code coverage is analyzed and the coverage analysis result is obtained, including: Based on the first test data, a functional coverage analysis is performed on the graphical user interface to detect whether the test case covers all the behavior paths and function points; whether the test of the behavior paths and function points is successful, failed or omitted; whether the behavior of the graphical user interface during the test is as expected, and the test is recorded; Integrate a code coverage tool into the test framework of the first test script, count the code execution paths, automatically collect coverage data, and identify frequently executed hotspot codes and redundant or omitted codes that have never been executed; According to the analysis of the function coverage and the code coverage, a coverage analysis result is output.
[0011] Further, the steps of analyzing and evaluating the coverage analysis results, formulating a coverage optimization strategy, and updating the cloud testing platform according to the coverage optimization strategy include: Analyze and evaluate the coverage analysis results to identify problem areas, such as code areas not covered by the test, test paths not executed, redundant or insufficient test cases, etc.; Based on the above analysis and evaluation, formulate targeted coverage optimization strategies, including adding new test cases to the code areas not covered by the test or expanding the coverage of test paths and functional points by modifying existing test cases, optimizing the test environment, optimizing the code structure or adjusting the test data, etc.; According to the new test requirements and optimization measures of the coverage optimization strategy, the configuration of the cloud testing platform is updated or the environment is adjusted.
[0012] Furthermore, based on the coverage optimization strategy, the first test script is optimized using a genetic algorithm or evolutionary computing to obtain a second test script, including: Iteratively optimizing the first test script by simulating natural selection and genetic mechanism using genetic algorithm (GA) or evolutionary computation (EC); The purpose of the iterative optimization includes at least one of improving test coverage, reducing test time, and increasing test effectiveness; After multiple rounds of iterative optimization, the second test script was obtained.
[0013] Further, the second automated test script is deployed to the updated cloud test platform to re-execute the script test, collect second test data, and verify the effective coverage of the second test script; the steps of writing a visual test report and providing feedback include: Deploy the second test script to the updated cloud test platform to perform automated script testing; Acquire new test coverage data of the second test script during the test execution process to obtain second test data; Verify whether the second test script effectively improves the test coverage; According to the second test data, test results, coverage analysis results, and problem tracking information are obtained, and displayed in a visual form, such as a chart, a heat map, etc.; Provide problem tracking and repair suggestions based on the second test data and feedback to the development department.
[0014] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned graphical user interface software function coverage test method when executing the computer program.
[0015] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned graphical user interface software function coverage testing method are implemented.
[0016] The graphical user interface software function coverage testing method provided by the present invention has the following beneficial effects: By analyzing the window structure and event flow chart of the graphical user interface in detail and dividing it into functional modules, we ensure that the test requirements fully cover all behavioral paths and functional points, thereby improving the completeness and coverage of the test. We use code coverage tools to count the code execution paths, identify and optimize the unexecuted code areas, and improve the depth and breadth of the test.
[0017] Establishing a cloud testing platform and using virtual devices and network environments to simulate real usage scenarios ensures functional testing coverage of the software in different devices and network environments, improving user experience; at the same time, multiple test cases can be executed in parallel, significantly shortening the test cycle. The use of cross-platform testing frameworks or libraries allows test scripts to run seamlessly on different operating systems and devices, reducing duplication of work and testing costs.
[0018] The writing and deployment of automated test scripts reduces manual intervention and improves the accuracy and consistency of tests. The application of genetic algorithms or evolutionary computing iteratively optimizes test scripts and improves their efficiency and effectiveness.
[0019] Based on the coverage analysis results, targeted coverage optimization strategies can be formulated to accurately identify test blind spots, and fill in the blind spots by adding or modifying test cases, thereby expanding software function coverage. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flowchart of a graphical user interface software function coverage testing method in one embodiment of the present invention; Figure 2 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0021] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0023] Reference Figure 1 , which is a flow chart of a graphical user interface software function coverage test method proposed by the present invention, comprising the following steps: S1, after analyzing the software under test and identifying the window structure of the graphical user interface, an event flow chart is constructed, and the software under test is divided into functional modules; S2, obtaining test requirements according to the event flow chart and the functional module; the test requirements include test cases, execution steps and expected effects; S3, establishing a cloud testing platform, and installing the software under test into a virtual device of the cloud testing platform for execution; S4, using a cross-platform framework or library to write a first test script according to the test requirements, and deploy it to the cloud test platform to trigger the execution of the first test; and obtain first test data during the test execution process; S5, based on the first test data, analyzing the functional coverage of the graphical user interface, using a code coverage tool to count code execution paths, analyzing code coverage and obtaining coverage analysis results; S6, analyzing and evaluating according to the coverage analysis results, formulating a coverage optimization strategy, and updating the cloud testing platform according to the coverage optimization strategy; S7, based on the coverage optimization strategy, optimizing the first test script by using a genetic algorithm or evolutionary computing to obtain a second test script; S8, deploy the second automated test script to the updated cloud test platform to re-execute the script test, collect second test data, verify the effective coverage of the second test script; write a visual test report and provide feedback.
[0024] For S1, specifically: Browse all graphical user interfaces of the software under test, understand and record the interface elements, layout and functional characteristics of the graphical user interfaces; Determine the main window of the software under test, trigger the display of the sub-window through user operation, obtain the hierarchical relationship, call relationship and data flow between the windows to construct a window structure diagram; Identify all operations performed by the user and the system's response events to draw an event flow chart, which includes the sequence and logic of user operations, system responses, and interface changes; According to the window structure and the event flow chart, independent functional modules are identified, the input, output and interaction interface of each functional module with other modules are clarified, and the functional modules are divided.
[0025] In specific operations, the tester browses each graphical user interface in the tested software one by one, including the main window, dialog boxes, sub-windows, etc., and records the elements of each interface (such as buttons, text boxes, drop-down menus, etc.), layout (the arrangement of elements) and functional characteristics (the operations that each element or interface can perform or the tasks that can be completed); after understanding all the interfaces, the tester needs to determine the main window of the software, that is, the first interface that the user sees after entering the software; then, by simulating the user's actual operation (such as clicking a button, selecting a menu item, etc.), the display of the sub-window is triggered; in this process, the tester needs to record the hierarchical relationship between the windows (which window is opened by which window), the call relationship (how the user navigates from one window to another) and the data flow (how the data flows between different windows) transfer); Based on the above information, the tester constructs the window structure diagram of the tested software, that is, through an intuitive graphic to show the overall architecture of the software interface and the interactive relationship between windows; the tester identifies all the operations that the user may perform in the software (such as inputting data, clicking buttons, etc.), and observes the system's response events to these operations (such as interface updates, data processing, error prompts, etc.), and records the data. The tester draws the sequence and logical relationship of these user operations, system responses, and interface changes into an event flow chart; the event flow chart is a chart that describes the sequence and logical relationship of a series of events in the process of user interaction with the software; by solving the software's window structure diagram and event flow chart, the tester further identifies the independent functional modules in the software and divides the software into several independent functional modules. In the division process, the tester needs to clarify the input (what data or commands are received), output (what results or changes are produced), and interactive interface with other modules (how to communicate or exchange data with other modules) of each functional module.
[0026] For S2, specifically: Based on the analysis of the event flow chart and the functional modules, test cases are designed one by one; the test cases cover all behavioral paths and functional points; Design a test scenario for each test case, list the execution steps of the test case, and clarify the expected results that should be achieved after the execution of the test case; Necessary test data is preset for triggering the behavior path and function point, and the necessary test data includes normal data and abnormal data.
[0027] In specific operations, testers need to deeply analyze the event flow chart, including the sequence and logic of user operations, system responses, and interface changes; at the same time, combined with the analysis of functional modules, clarify the specific responsibilities, inputs and outputs of each functional module, and the way of interaction with other modules; based on the above information, testers design test cases one by one to ensure that each test case verifies one or more key paths in the event flow chart or one or more functional points in the functional module; the design goal of the test case is to cover all behavioral paths and functional points of the software as comprehensively as possible, considering every possible user operation path, and the main functions and boundary conditions of each functional module can be tested; design specific tests for each test case Scenarios, test scenarios include preconditions, input data, user operations, etc.; at the same time, detailed execution steps are listed to ensure the consistency and repeatability of the test process; and the expected results that should be achieved after executing the test cases need to be clearly defined; testers need to preset necessary test data for test cases that trigger specific behavior paths and functional points. These data include normal data and abnormal data; normal data refers to data that meets the software design requirements and can trigger functions normally; and abnormal data refers to data that does not meet the software design requirements and may cause errors or abnormalities; by testing normal data and abnormal data, the software's working ability under normal conditions and its fault tolerance under abnormal conditions are verified to ensure the robustness and reliability of the software.
[0028] For S3, specifically: Establish a cloud testing platform, including test environment configuration, network environment configuration and test software installation; Test environment configuration: create virtual devices on the cloud test platform, including different models of mobile phones, tablets and PCs; match the operating system version, screen resolution parameters and storage configuration of the virtual devices to simulate real usage scenarios; Network environment configuration, presetting the network environment on the cloud testing platform; Test software installation: install the software under test into the virtual device, configure the test environment and network environment according to the test case and run it normally.
[0029] In specific operations, cloud computing technology is used to quickly create virtual devices of various models of mobile phones, tablets and PCs on the cloud testing platform. The creation of virtual devices is logically highly customizable and scalable, and can physically save resources; the corresponding operating system version, screen resolution parameters and storage configuration are matched for each virtual device to simulate the user's real usage scenarios under different devices and system environments, and to discover potential compatibility issues or performance bottlenecks; by configuring network parameters (such as bandwidth, latency, packet loss rate, etc.), the user's usage in different network environments is simulated, such as WIFI, 3G / 4G / 5G and other network environments, to test the stability and performance of the software under different network conditions, as well as network compatibility; after the test environment and network environment are configured, the software package to be tested is uploaded to the cloud testing platform and installed in the previously created virtual device. The installation process needs to consider factors such as software dependencies, installation paths, and permission settings; according to the requirements of the test case, the test environment (such as system settings, software configuration, etc.) and network environment (such as network proxy, VPN settings, etc.) are configured to ensure that the test environment can accurately simulate the user's usage scenarios and meet the requirements of the test case; after the configuration is completed, the software under test is started and a normal test run is performed.
[0030] For S4, specifically: Analyze the behavior paths and functional points that need to be tested in the test requirements, preparation of test data, execution steps, and expected results; Select a cross-platform testing framework or library based on the testing requirements and technology stack; Using the selected cross-platform framework or library to write a first test script and upload it to the cloud testing platform; Configure the preset environment of the cloud testing platform according to the test case; The first test is executed by triggering the user interface, application programming interface call or scheduled task, and the cloud testing platform runs the first test script in the preset environment; Recording data generated during the test execution process by means of a logging function of the first test script of the test script; View the progress and real-time output of the first test through the real-time monitoring function of the cloud testing platform; After the first test is completed, first test data is obtained.
[0031] In specific operations, testers need to carefully analyze the test requirements, clarify the specific behavior paths (i.e. user operation processes) and functional points (such as login, search, payment, etc.) that need to be tested in the software application, and use these behavior paths and functional points as the basis for test case design; prepare corresponding test data according to the test requirements, and the test data covers normal and abnormal situations, for example, prepare valid username and password combinations and invalid username and password combinations for the login function; design and execute test cases, including steps such as inputting test data, performing operations, and observing results, and record the steps in detail in the test plan to ensure the repeatability and traceability of the test; for each test case, clarify the expected results; According to the test requirements and technology stack (such as Web, mobile applications, desktop applications, etc.), select a suitable cross-platform test framework or library that can support the target platform and has good scalability and maintainability. For example, for Web applications, choose Selenium or Cypress; for mobile applications, choose Appium; use the selected cross-platform framework or library to write the first test script, which contains the necessary test logic, assertions (used to verify whether the actual results are consistent with the expected results) and logging functions, and upload the written test script to the cloud testing platform; According to the requirements of the test cases, configure the preset environment on the cloud test platform, including selecting the appropriate virtual device, operating system version, screen resolution and network environment, etc., execute the first test through the user interface, application programming interface call or scheduled task trigger, run the test script in the preset environment, and simulate the real user scenario for testing; use the logging function of the test script to record the data generated during the test execution, and view the progress and real-time output of the first test through the real-time monitoring function of the cloud test platform; after the first test is completed, obtain the test data from the cloud test platform, including test results, log files and screenshots.
[0032] For S5, specifically: Based on the first test data, a functional coverage analysis is performed on the graphical user interface to detect whether the test case covers all the behavior paths and function points; whether the test of the behavior paths and function points is successful, failed or omitted; whether the behavior of the graphical user interface during the test is as expected, and the test is recorded; Integrate a code coverage tool into the test framework of the first test script, count the code execution paths, automatically collect coverage data, and identify frequently executed hotspot codes and redundant or omitted codes that have never been executed; According to the analysis of the function coverage and the code coverage, a coverage analysis result is output.
[0033] In specific operations, based on the first test data, the functional coverage analysis of the graphical user interface (GUI) is performed, and the test data is compared with the actual executed behavior paths and function points to detect whether the test cases fully cover all the behavior paths and function points that need to be tested; according to the analysis results, the information on whether the test of each behavior path and function point is successful, failed or omitted is obtained. A successful test means that the test case is executed as expected and verifies the function; a test failure indicates the existence of a bug or problem, which indicates the omitted test, uncovered function point or behavior path; a detailed record is made of whether the behavior of the graphical user interface (GUI) during the test (such as button clicks, page jumps, data display, etc.) meets expectations; the code coverage tool can monitor the execution of the code during the test and Generate a coverage report; integrate a code coverage tool (such as JaCoCo, Istanbul, Coverlet, etc., depending on the programming language and test framework used) into the test framework of the first test script, and count the code paths actually executed during the execution of the test script, including coverage at the statement, branch, function, etc. levels; by analyzing the functional coverage and the code coverage data, identify which codes are frequently executed (hot code) and which codes are never executed (redundant or missing code), and generate a comprehensive coverage analysis report, which includes but is not limited to the following information: coverage statistics of test cases, successful and failed test cases, uncovered functional points and behavioral paths, a detailed list of hot code and missing code, etc.
[0034] For S6, specifically: Analyze and evaluate the coverage analysis results to identify problem areas, such as code areas not covered by the test, test paths not executed, redundant or insufficient test cases, etc.; Based on the above analysis and evaluation, formulate targeted coverage optimization strategies, including adding new test cases to the code areas not covered by the test or expanding the coverage of test paths and functional points by modifying existing test cases, optimizing the test environment, optimizing the code structure or adjusting the test data, etc.; According to the new test requirements and optimization measures of the coverage optimization strategy, the configuration of the cloud testing platform is updated or the environment is adjusted.
[0035] In specific operations, the coverage analysis results are analyzed and evaluated to identify problem areas, such as code areas that are not covered by the test, such as newly added code, conditional branches, exception handling paths, etc.; paths or functional points that are not covered due to insufficient or omitted test case design; test paths that are not executed, such as some code areas are partially covered, but there may be specific execution paths (such as execution flows under specific conditional combinations) that are not tested; the same functional points may be tested repeatedly; redundant test cases will lead to low test efficiency, and insufficient test cases cannot fully verify the behavior of the software; based on the above analysis and evaluation results, formulate targeted coverage optimization strategies to improve the comprehensiveness and effectiveness of the test. The optimization strategies include: adding new test cases, designing new test cases to cover code areas that are not covered by the test; modifying existing test cases to modify existing For test cases, expand the test paths and functional points they cover, for example, modify input data or operation sequences to trigger different code paths; optimize the test environment and adjust the configuration of the test environment to better simulate the actual user scenarios; optimize the code structure and simplify the test by refactoring the code when possible, for example, splitting complex logic into smaller functions or components to facilitate the writing of test cases; adjust the test data, update or expand the test data set to cover more boundary conditions and abnormal situations; upload the newly added or modified test cases to the cloud test platform and execute the new test environment; adjust the preset environment configuration of the cloud test platform according to the test requirements, such as the virtual device model, operating system version, screen resolution, etc. If the optimization strategy mentions new test tools or frameworks, they need to be integrated into the cloud test platform; configure real-time monitoring and alarm mechanisms to monitor potential problems during the test process.
[0036] For S7, specifically: Iteratively optimizing the first test script by simulating natural selection and genetic mechanism using genetic algorithm (GA) or evolutionary computation (EC); The purpose of the iterative optimization includes at least one of improving test coverage, reducing test time, and increasing test effectiveness; After multiple rounds of iterative optimization, the second test script was obtained.
[0037] In specific operations, in genetic algorithms, test scripts are regarded as individuals in a population, each of which represents a potential solution (i.e., a test script). The algorithm selects the best individuals for reproduction by evaluating the fitness of the individuals (indicators such as test coverage, test time, or test effectiveness), and generates new individuals through genetic operations (such as crossover and mutation). This process is iterated continuously until the stopping condition is met (such as reaching the maximum number of iterations, the test coverage reaches a preset threshold, etc.).
[0038] In the iterative optimization process of test scripts, genetic algorithms or evolutionary computing continuously optimize test scripts to cover more code paths and functional points, thereby improving the comprehensiveness of the test; by optimizing the execution order of test scripts, reducing unnecessary test steps or using parallel testing technology to shorten the test cycle; by ensuring that the test scripts can accurately find defects in the software and reduce false positives and false negatives, the quality and reliability of the test are improved; in the iterative optimization process, a certain number of test scripts are randomly generated as the initial population, and the fitness of each individual is evaluated based on indicators such as test coverage, test time or test effectiveness. Based on the fitness evaluation results, individuals with higher fitness are selected (implemented through strategies such as roulette selection and tournament selection) The selected individuals are crossovered (i.e., exchanging some codes or test steps) and mutated (i.e., randomly modifying codes or test steps) to generate new test scripts. The newly generated test scripts are replaced with some individuals in the population to keep the population size unchanged. The above process is repeated until the stopping condition is met (such as reaching the maximum number of iterations, the test coverage reaching a preset threshold, etc.). After multiple rounds of iterative optimization, a set of optimized test scripts will be obtained, which may include multiple excellent candidates. According to actual needs, the best test script is selected as the second test script. The second test script has higher test coverage, shorter test time or higher test effectiveness than the first test script.
[0039] For S8, specifically: Deploy the second test script to the updated cloud test platform to perform automated script testing; Acquire new test coverage data of the second test script during the test execution process to obtain second test data; Verify whether the second test script effectively improves the test coverage; According to the second test data, test results, coverage analysis results, and problem tracking information are obtained and displayed in a visual form; Provide problem tracking and repair suggestions based on the second test data and feedback to the development department.
[0040] In the specific operation, the second test script after iterative optimization by genetic algorithm or evolutionary computing is deployed to the cloud test platform with updated configuration or environment, triggering the automatic execution of the second test script; the test script performs comprehensive testing on the software according to the predetermined test steps and logic, including functional testing, performance testing, compatibility testing, etc.; during the test execution process, the cloud test platform collects and generates new test coverage data, which includes information such as code paths and function points covered by the second test script during the test process, which is used to evaluate the optimization effect of the test script; the newly acquired test coverage data is compared with the previous test coverage data to verify whether the second test script effectively improves the test coverage; if the new test coverage data is significantly higher than the previous data, it means that the optimized test script has been optimized in covering more code paths and function points; the test results, coverage analysis results and problem tracking information in the second test data are sorted and intuitively displayed in a visual form, and according to the problem and defect information in the second test data, detailed problem tracking and repair suggestions are provided to the development department, indicating the specific location of the problem, possible causes and repair solutions; the above test results, coverage analysis results, problem tracking and repair suggestions and other information are promptly fed back to the development department.
[0041] Reference Figure 2 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 2 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0042] Those skilled in the art will understand that Figure 2 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0043] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0044] In summary, Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0045] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0046] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A graphical user interface software function coverage testing method, characterized in that: The following steps are involved: By analyzing the software under test and identifying the window structure of the graphical user interface, an event flow chart is constructed, and the software under test is divided into functional modules; According to the event flow chart and the functional module, obtaining test requirements; the test requirements include test cases, execution steps and expected effects; Establishing a cloud testing platform, and installing the software under test into a virtual device of the cloud testing platform for operation; Using a cross-platform framework or library, writing a first test script according to the test requirements, and deploying it to the cloud test platform to trigger the execution of the first test; Acquire first test data of the test execution process; Based on the first test data, the functional coverage of the graphical user interface is analyzed, and the code execution path is counted by a code coverage tool to analyze the code coverage and obtain the coverage analysis result; Analyze and evaluate the coverage analysis results, formulate a coverage optimization strategy, and update the cloud testing platform according to the coverage optimization strategy; Based on the coverage optimization strategy, the first test script is optimized by using a genetic algorithm or evolutionary computing to obtain a second test script; Deploy the second automated test script to the updated cloud test platform to re-execute the script test, collect second test data, and verify the effective coverage of the second test script; Write visual test reports and provide feedback.
2. The graphical user interface software function coverage testing method according to claim 1, characterized in that: According to the event flow chart and the functional module, the test requirements are obtained; the test requirements include test cases, execution steps and steps of expected effects, including: Based on the analysis of the event flow chart and the functional modules, test cases are designed one by one; the test cases cover all behavioral paths and functional points; Design a test scenario for each test case, list the execution steps of the test case, and clarify the expected results that should be achieved after the execution of the test case; Necessary test data is preset for triggering the behavior path and function point, and the necessary test data includes normal data and abnormal data.
3. The graphical user interface software function coverage testing method according to claim 1, characterized in that: The steps of establishing a cloud testing platform and installing the software under test into a virtual device of the cloud testing platform for execution include: Establish a cloud testing platform, including test environment configuration, network environment configuration and test software installation; Test environment configuration, creating virtual devices on the cloud test platform, including different models of mobile phones, tablets and computers; matching the operating system version, screen resolution parameters and storage configuration of the virtual devices to simulate real usage scenarios; Network environment configuration, presetting the network environment on the cloud testing platform; Test software installation: install the software under test into the virtual device, configure the test environment and network environment according to the test case and run it normally.
4. The graphical user interface software function coverage testing method according to claim 1, characterized in that: Using a cross-platform framework or library, writing a first test script according to the test requirements, and deploying it to the cloud test platform to trigger the execution of the first test; The step of obtaining first test data of the test execution process includes: Analyze the behavior paths and functional points that need to be tested in the test requirements, preparation of test data, execution steps, and expected results; Select a cross-platform testing framework or library based on the testing requirements and technology stack; Using the selected cross-platform framework or library to write a first test script and upload it to the cloud testing platform; Configure the preset environment of the cloud testing platform according to the test case; The first test is executed by triggering the user interface, application programming interface call or scheduled task, and the cloud testing platform runs the first test script in the preset environment; Recording data generated during the test execution process by means of a logging function of the first test script of the test script; View the progress and real-time output of the first test through the real-time monitoring function of the cloud testing platform; After the first test is completed, first test data is obtained.
5. The graphical user interface software function coverage testing method according to claim 1, characterized in that: The steps of analyzing the functional coverage of the graphical user interface based on the first test data, performing statistical analysis of code execution paths through a code coverage tool, analyzing code coverage and obtaining coverage analysis results include: Based on the first test data, a functional coverage analysis is performed on the graphical user interface to detect whether the test case covers all the behavior paths and function points; whether the test of the behavior paths and function points is successful, failed or omitted; whether the behavior of the graphical user interface during the test is as expected, and the analysis is recorded; Integrate a code coverage tool into the test framework of the first test script, count the code execution paths, automatically collect coverage data, and identify frequently executed hotspot codes and redundant or omitted codes that have never been executed; According to the analysis of the function coverage and the code coverage, a coverage analysis result is output.
6. The graphical user interface software function coverage testing method according to claim 1, characterized in that: The steps of analyzing and evaluating the coverage analysis results, formulating a coverage optimization strategy, and updating the cloud testing platform according to the coverage optimization strategy include: Analyze and evaluate the coverage analysis results to identify problem areas, such as code areas not covered by the test, test paths not executed, redundant or insufficient test cases, etc.; Based on the above analysis and evaluation, formulate targeted coverage optimization strategies, including adding new test cases to code areas that are not covered by the test, or expanding the coverage of test paths and functional points by modifying existing test cases, optimizing the test environment, optimizing the code structure, or adjusting the test data, etc.; According to the new test requirements and optimization measures of the coverage optimization strategy, the configuration of the cloud testing platform is updated or the environment is adjusted.
7. The graphical user interface software function coverage testing method according to claim 1, characterized in that: Based on the coverage optimization strategy, the first test script is optimized by using a genetic algorithm or evolutionary computing to obtain a second test script, including: Iteratively optimizing the first test script by simulating natural selection and genetic mechanism using genetic algorithm or evolutionary computing; The purpose of the iterative optimization includes at least one of improving test coverage, reducing test time, and increasing test effectiveness; After multiple rounds of iterative optimization, the second test script was obtained.
8. The graphical user interface software function coverage testing method according to claim 1, characterized in that: Deploy the second automated test script to the updated cloud test platform to re-execute the script test, collect second test data, and verify the effective coverage of the second test script; Steps for writing visual test reports and providing feedback include: Deploy the second test script to the updated cloud testing platform to perform automated script testing; Acquire new test coverage data of the second test script during the test execution process to obtain second test data; Verify whether the second test script effectively improves the test coverage; According to the second test data, test results, coverage analysis results, and problem tracking information are obtained and displayed in a visual form; Provide problem tracking and repair suggestions based on the second test data and feedback to the development department.
9. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the graphical user interface software function coverage testing method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the graphical user interface software function coverage testing method described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Graphical user interface software function coverage testing method
CN101916225A