Automatic testing method for browser screen recording
By collecting user operation behavior and screen change data, building and simulating test containers, the problems of difficult maintenance and insufficient coverage of test cases in existing automated test solutions are solved, and efficient and accurate automated testing is achieved.
Patent Information
- Application Number
- CN202510286614.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-03-12
AI Technical Summary
When software functions are added and updated, existing automated testing solutions require continuous writing and maintenance of a large number of test cases, resulting in inefficient testing, waste of resources, insufficient coverage of test cases, and incomplete verification of software functions and performance.
By obtaining the operational behavior parameters and screen change data of the user's operation on the browser, building a test container and performing layered processing, simulating the browser environment of different devices for testing, analyzing the code coverage and screen change rate, and adjusting the environment container to generate a new test environment.
It effectively reduces the regeneration workload of test scripts and test environment frameworks, improves the accuracy and timeliness of automated tests, supports parallel execution of multiple test cases, shortens the test cycle, and improves the maintenance and expansion efficiency of the test system.
Smart Images

Figure CN119807077A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of protocol detection, and in particular to an automated testing method for browser screen recording. Background Art
[0002] Automated testing is a key link in ensuring software quality. However, existing automated testing solutions have some significant deficiencies, such as writing and maintaining a large number of test cases. As software functions increase and update, the testing team needs to continuously write and maintain a large number of test cases. This process is not only time-consuming and labor-intensive, but also prone to errors, resulting in low testing efficiency. Test cases often need to be repeatedly executed for different versions and environments, resulting in a waste of resources and reduced testing efficiency. Whenever the software code changes, regression testing needs to be performed to ensure the new changes. Due to the large workload of writing and maintaining test cases, some test cases are insufficiently covered and cannot fully verify the functions and performance of the software. As software requirements change and the technology stack is updated, existing test cases need to be adjusted and optimized accordingly, but this process is often difficult, resulting in difficult maintenance of test cases.
[0003] Chinese patent application publication number: CN118760420A discloses a cross-terminal responsive design system and method based on Grid. The invention discloses a cross-terminal responsive design system and method based on Grid, which relates to the technical field of web page responsive design, including a cross-terminal responsive design platform, wherein the cross-terminal responsive design platform is communicatively connected with a device detection and identification module, a Grid layout design module, a breakpoint management module, a content adaptive adjustment module, a dynamic content management module and a feedback module, wherein the modules are connected by electrical signals; the device detection and identification module is used to detect and obtain characteristic information of the screen size, resolution, operating system and browser type of the access device; the Grid layout design module is used to design a web page layout framework based on CSS Grid. The invention ensures that web page content is displayed in the most optimized way on different devices and screen sizes by using CSS Grid, and automatically adapts to various screen sizes and resolutions through predefined grid structures and flexible responsive rules, providing users with a consistent and smooth visual experience.
[0004] Chinese patent application publication number: CN113703749A discloses an information system based on visual programming technology and a construction method thereof. The invention provides an information system based on visual programming technology and a construction method thereof, which belongs to the field of software information system development technology. The information system based on visual programming technology includes an underlying component module, a data model module, a visual programming module, and an automatic deployment module. The underlying component module contains several components that can be used in various links of the information system operation; the data model module is a component library for operating the data required by the information system, and the visual programming module provides a set of WYSIWYG software design tools; the automatic deployment module is for the platform to take over the remaining code automatic generation and deployment links after the application developed by the system user is completed. The invention provides a new method for building a software application system and an information system, which is composed of component developers, system users, and system administrators, so that enterprises can save costs when developing new business applications.
[0005] It can be seen that the prior art fails to effectively generate and adjust the test scripts and the test environment framework after the simulation code runs by combining the collected screen and browser operation data to reduce the workload of subsequent regeneration of the scripts and the test environment framework. Summary of the invention
[0006] To this end, the present invention provides an automated testing method for browser screen recording, which is used to overcome the problem in the prior art that it is unable to effectively generate and adjust test scripts and test environment frameworks by combining the collected screen and browser operation data after the simulation code runs to reduce the workload of subsequent regeneration of scripts and test environment frameworks.
[0007] To achieve the above object, the present invention provides an automated testing method for browser screen recording, comprising: Obtain the operation behavior parameters of the user's operation on the browser and calculate the operation data; Using the operation data to construct a plurality of test containers, and encapsulating the test containers with the operation behavior parameters after layering; Simulate browsers in several different devices to build several environment containers, put each test container into the environment container for simulation operation to obtain code coverage, and combine the code coverage with the screen change rate to determine the operation status of the code in the test container; Determine the effective weighted value of each test container according to the result of the hierarchical processing, calculate the effective value of the environment container in combination with the code coverage rate corresponding to each test container, and determine whether the environment container is qualified based on the effective value; The qualified environment container is stored, a similar environment container is called according to the similarity value to perform the next simulation operation, and the similar environment container is adjusted according to the result of the next simulation operation to generate a new environment container.
[0008] Furthermore, the process of obtaining the screen change parameters before and after each of the test containers is placed in the environmental container for the simulation operation and calculating the screen change rate includes: Recording the changes in the window size and pixel density on the screen before and after each of the test containers is placed in the environmental container for the simulation operation; Calculate the window size change rate according to the window size change, and calculate the pixel density change rate according to the pixel density change; The screen change rate is calculated by combining the window size change rate and the pixel density change rate.
[0009] Furthermore, the process of converting the operation data into the test container includes: Performing cleaning processing on the operation data to generate unit data; Extract key information from the unit data to build an image; Building the test container according to the image; The unit data is a minimum data set that can completely run the test container.
[0010] Furthermore, the process of packaging the test containers with the operation behavior parameters after layering includes: Allocate the test containers to the basic layer, the professional layer and the interface layer according to the operation results of each test container; Associating and mapping the operation behavior parameters with the corresponding test containers; Configure packaging parameters; Among them, the basic layer is a common data layer for the operation of various systems, the professional layer is a data layer for the operation of professional systems, and the interface layer is a data layer for connecting various systems for interaction.
[0011] Furthermore, the process of simulating browsers in several different devices to build several environment containers includes: Determine device type and browser configuration; Customizing the environment image according to the device type and the browser configuration; The environment container is created based on the environment image.
[0012] Furthermore, each of the test containers is placed in the environment container for simulation operation, and the process of analyzing and obtaining the code coverage includes: deploying each of the test containers to the environment container; The environment container is started, and the code coverage of each test container is recorded.
[0013] Further, based on the code coverage and the screen change rate, it is determined whether the running status of the code in the test container is normal, code error, code redundancy or code missing.
[0014] Furthermore, the process of determining the effective weighted value of each test container according to the result of the hierarchical processing and calculating the effective value of the environment container in combination with the code coverage corresponding to each test container includes: Selecting the environment container in which the code in each of the test containers runs normally; Determine an effective weighted value for each of the test containers running in the environmental container according to the result of the hierarchical processing; The effective value of the environment container is calculated by combining the effective weighted value and the code coverage of each test container.
[0015] Furthermore, the effective value of the environmental container is compared with a preset effective value, and whether the environmental container is qualified is determined according to the comparison result, wherein: The preset effective value is positively correlated with the total number of test containers contained in the environmental container.
[0016] Furthermore, the process of calling a similar environment container to perform a next simulation run according to the similarity value, and adjusting the similar environment container to generate a new environment container according to the next simulation run result includes: Obtaining a similarity value by comparing and calculating the operation behavior parameters of the existing environment container and the user's next operation; Comparing the similarity value with a preset similarity value, and determining a similar environment container according to the comparison result; The similar environment container is subjected to the next simulation operation, and compared with the result of the next operation of the user, and the similar environment container is adjusted according to the comparison result to generate a new environment container.
[0017] Compared with the prior art, the beneficial effect of the present invention is that the present invention effectively records the user operation process by collecting the operation behavior and screen changes of the user when operating on the browser. By analyzing the recorded operation process, the difficulties and obstacles encountered by the user in the process of using the product can be clearly seen, and the complicated process links can be found. The page layout can be optimized according to the user's operation sequence and path. The function buttons commonly used by users are placed in a more conspicuous and easy-to-operate position to reduce the user's operation steps and time. At the same time, the user's operations on the browser are intuitively and comprehensively recorded, providing comprehensive parameters for subsequent automated testing. At the same time, when the collected operation behavior deviates greatly from the baseline model, the anomaly can be discovered in time, and when the user reports a problem with the product, the operation record can help the developer quickly locate the problem, and evaluate the performance of the product according to the screen changes and operation response time in the operation record, thereby improving the accuracy and timeliness of automated testing for browser screen recording.
[0018] Furthermore, in the present invention, each test container is processed in layers and then encapsulated with the operation behavior parameters. The layered processing allows test containers at different levels to run independently. By utilizing the characteristics of containerization technologies such as Docker, multiple test containers can be easily executed in parallel. The environment construction of the basic layer, the business logic test of the professional layer, and the interaction test of the interface layer can be carried out at the same time, which greatly shortens the overall test time. In large projects, the tests of each part originally needed to be completed in sequence. Now, after parallel processing, the test cycle may be shortened from several days to several hours. After layered encapsulation, each test container can accurately allocate resources according to its own needs to avoid waste of resources. The basic layer container is mainly responsible for providing a stable operating environment, which is very important for C The requirements for PU and memory are relatively fixed, while professional-layer containers may require more computing resources when conducting complex business logic tests. By allocating resources reasonably, the system can run more efficiently and support the simultaneous execution of more test cases. Layered processing divides the test system into different functional modules. Each module has clear responsibilities. When problems occur during the test, the source of the fault can be quickly located according to the level where the problem occurs. Layered encapsulation facilitates reuse. After layered processing, the architecture of the test system is clearer, and the functions and responsibilities of each level are clear. This makes it easier for developers and testers to understand the overall structure of the system, facilitates subsequent maintenance and expansion, and further improves the accuracy and timeliness of automated testing for browser screen recording.
[0019] Furthermore, the present invention builds several environmental containers by simulating browsers in several different devices, analyzes and tests the running status of the container code, and simulates the environmental containers of multiple device browsers for testing, so as to ensure that the code can run normally on various mainstream devices and browsers, and avoid compatibility issues such as disordered page layout and unusable functions. Different browser and device environments may trigger potential vulnerabilities in the code. Some older versions of browsers may not fully support certain security mechanisms, or the special hardware characteristics of some mobile devices may cause the code to be abnormal when processing data. By simulating multiple environments for testing, these potential vulnerabilities can be discovered more comprehensively, repaired in advance, and the security and stability of the product can be enhanced. With the popularization of mobile devices, users may access the product on multiple devices such as mobile phones, tablets, and computers, and simulate the browser environments of different devices for testing. , which can ensure that the product can provide a consistent and good user experience on various devices. For example, when browsing the web on a mobile phone, the page layout should be able to adapt to the size of the mobile phone screen, and the size and spacing of the operation buttons should be suitable for finger clicks; on a tablet, it may be necessary to provide richer interactive functions. Through testing, the code can be adjusted in time to meet the needs of users of different devices. The performance and network environment of different devices vary greatly. By testing the code operation in a simulated environment container, the response speed of the code on different devices can be evaluated, performance bottlenecks can be identified and optimized, and building an environment container can achieve the reuse of the test environment, avoiding the need to manually configure different devices and browser environments for each test. Developers and testers can easily run test code in different environment containers, improve test efficiency, and further improve the accuracy and timeliness of automated testing for browser screen recording.
[0020] Furthermore, in the present invention, by applying the stored environment container to the next simulation run, and adjusting the environment container according to the run result to obtain a new environment container for storage, each time a simulation run is performed, there is no need to build a complex test or run environment from scratch. The stored environment container can be directly used to quickly deploy the same or similar environment, which significantly saves time. In the iteration cycle of software development, it is very important to quickly verify new functions or fix problems. The stored environment container can be used to quickly carry out simulation runs and obtain run results in time, thereby accelerating the iteration process of development and testing. The stored environment container retains specific software versions, configuration parameters and dependencies, so that the environment of each simulation run remains consistent, which helps to eliminate the problem of inconsistent test results caused by environmental differences. According to the simulation run results, the resource configuration of the environment container can be adjusted. The run results can also reflect the rationality of certain configuration parameters in the environment container. As business needs continue to change, the software system needs to be continuously updated and optimized. The stored environment container can be used as a basis to adjust and expand according to new needs to generate a new environment container, further improving the accuracy and timeliness of automated testing for browser screen recording. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of the automated testing method for browser screen recording according to the present invention; Figure 2 A logic diagram for determining the running status of code in a test container according to an embodiment of the present invention; Figure 3 A flowchart of calculating the effective value of an environmental container according to an embodiment of the present invention; Figure 4 A logic diagram for determining whether an environmental container is qualified according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0023] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0024] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.
[0025] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0026] See also Figure 1 As shown, it is a flow chart of an automated testing method for browser screen recording of the present invention. An embodiment of the present invention provides an automated testing method for browser screen recording, including: Step S1, obtaining the operation behavior parameters of the user's operation on the browser, and calculating the operation data; Step S2, constructing a number of test containers using the operation data, and encapsulating each test container with the operation behavior parameters after layering; Step S3, simulating browsers in several different devices to build several environment containers, placing each test container into the environment container for simulation operation to obtain code coverage, and combining the code coverage with the screen change rate to determine the operation status of the code in the test container; Step S4, determining the effective weighted value of each test container according to the result of the hierarchical processing, calculating the effective value of the environment container in combination with the code coverage rate corresponding to each test container, and determining whether the environment container is qualified based on the effective value; Step S5, storing the qualified environment container, calling the similar environment container according to the similarity value to perform the next simulation operation, and adjusting the similar environment container to generate a new environment container according to the result of the next simulation operation.
[0027] Specifically, in step S3, the screen change parameters before and after each test container is placed in the environmental container for simulation operation are obtained, and the process of calculating the screen change rate includes: Record the changes in window size and pixel density on the screen before and after each test container is placed in the environmental container for simulation operation; The window size change rate is calculated based on the window size change, and the pixel density change rate is calculated based on the pixel density change; The screen change rate is calculated by combining the window size change rate and the pixel density change rate.
[0028] In a specific embodiment, screen change rate=window size change rate+pixel density change rate; In implementation, for example, after the test container A is placed in the environment container N for simulation operation, the window size on the screen increases by 15%, then the window size change rate is 0.15, and the pixel density increases by 24%, then the pixel density change rate is 0.24, and the screen change rate of the test container A is 0.15+0.24=0.39.
[0029] Specifically, the present invention effectively records the user operation process by collecting the operation behavior and screen changes when the user operates on the browser. By analyzing the recorded operation process, the difficulties and obstacles encountered by the user in the process of using the product can be clearly seen, and the complicated process links can be found. The page layout can be optimized according to the user's operation sequence and path. The function buttons commonly used by users are placed in a more conspicuous and easy-to-operate position to reduce the user's operation steps and time. At the same time, the user's operations on the browser are intuitively and comprehensively recorded, providing comprehensive parameters for subsequent automated testing. At the same time, when the collected operation behavior deviates greatly from the baseline model, the anomaly can be discovered in time, and when the user reports a problem with the product, the operation record can help the developer quickly locate the problem, and evaluate the performance of the product according to the screen changes and operation response time in the operation record, thereby improving the accuracy and timeliness of automated testing for browser screen recording.
[0030] Specifically, in step S2, the process of converting the operation data into a test container includes: Cleaning the operation data to generate unit data; Extract key information from unit data and build an image; Build a test container based on the image; The unit data is the minimum data set that the test container can run completely.
[0031] It can be understood that the operation data is cleaned to generate unit data, missing values, duplicate values and abnormal values in the operation data are processed, and then data segmentation, data integration and data verification are performed to obtain unit data.
[0032] It is understandable that constructing an image by extracting key information from the data and constructing a test container according to the image is a prior art that can be easily obtained by those skilled in the art and will not be described in detail here.
[0033] Specifically, in step S2, the process of layering each test container and encapsulating it with the operation behavior parameters includes: According to the running results of each test container, they are allocated to the basic layer, professional layer and interface layer; Associate and map the operation behavior parameters with the corresponding test containers; Configure packaging parameters; Among them, the basic layer is the common data layer for the operation of each system, the professional layer is the data layer for the operation of professional systems, and the interface layer is the data layer for connecting various systems for interaction. It is understandable that the basic layer includes those parts that provide basic support and general functions for the entire system, such as the system's underlying architecture, basic data processing modules, public services, etc. If the test container operation results show that its function is to achieve basic data storage and reading, or provide general computing, communication and other basic capabilities, it is allocated to the basic layer.
[0034] It is understandable that the professional layer involves the realization of specific fields or professional functions, and is highly professional and targeted. When the running results of the test container show that its function is related to a specific professional field, such as report generation and tax calculation in the financial field, medical record management and diagnostic assistance in the medical field, it is classified into the professional layer.
[0035] It can be understood that the interface layer is mainly responsible for the interaction and data transmission between different systems, modules or components, and plays the role of connection and adaptation. If the running results of the test container show its functions in interface calls, data format conversion, protocol adaptation, etc. between test systems, then it is assigned to the interface layer.
[0036] It is understandable that, for those skilled in the art, it is obvious to associate and map the operation behavior parameters with the corresponding test containers and configure the packaging parameters, which will not be described in detail herein.
[0037] Specifically, the present invention performs layered processing on each test container and encapsulates it with the operation behavior parameters. The layered processing allows the test containers at different levels to run independently. By utilizing the characteristics of containerization technologies such as Docker, it is easy to realize the parallel execution of multiple test containers. The environment construction of the basic layer, the business logic test of the professional layer, and the interactive test of the interface layer can be carried out at the same time, which greatly shortens the overall test time. In large projects, the tests of each part originally needed to be completed in sequence. Now, after parallel processing, the test cycle may be shortened from several days to several hours. After layered encapsulation, each test container can accurately allocate resources according to its own needs to avoid waste of resources. The basic layer container is mainly responsible for providing a stable operating environment, which is very important for C The requirements for PU and memory are relatively fixed, while professional-layer containers may require more computing resources when conducting complex business logic tests. By allocating resources reasonably, the system can run more efficiently and support the simultaneous execution of more test cases. Layered processing divides the test system into different functional modules. Each module has clear responsibilities. When problems occur during the test, the source of the fault can be quickly located according to the level where the problem occurs. Layered encapsulation facilitates reuse. After layered processing, the architecture of the test system is clearer, and the functions and responsibilities of each level are clear. This makes it easier for developers and testers to understand the overall structure of the system, facilitates subsequent maintenance and expansion, and further improves the accuracy and timeliness of automated testing for browser screen recording.
[0038] Specifically, in step S3, the process of simulating browsers in several different devices to build several environment containers includes: Determine device type and browser configuration; Customize environment images based on device type and browser configuration; Create an environment container based on the environment image.
[0039] Specifically, in step S3, each test container is placed in an environment container for simulation operation, and the process of analyzing and obtaining code coverage includes: Deploy each test container to the environment container; Start the environment container and record the code coverage of each test container.
[0040] Specifically, the present invention builds several environmental containers by simulating browsers in several different devices, analyzes and tests the running status of the container code, and simulates the environmental containers of multiple device browsers for testing, so as to ensure that the code can run normally on various mainstream devices and browsers, and avoid compatibility issues such as disordered page layout and unusable functions. Different browser and device environments may trigger potential vulnerabilities in the code. Some older versions of browsers may not fully support certain security mechanisms, or the special hardware characteristics of some mobile devices may cause the code to have exceptions when processing data. By simulating multiple environments for testing, these potential vulnerabilities can be discovered more comprehensively, repaired in advance, and the security and stability of the product can be enhanced. With the popularization of mobile devices, users may access the product on multiple devices such as mobile phones, tablets, and computers, and simulate the browser environments of different devices for testing. , which can ensure that the product can provide a consistent and good user experience on various devices. For example, when browsing the web on a mobile phone, the page layout should be able to adapt to the size of the mobile phone screen, and the size and spacing of the operation buttons should be suitable for finger clicks; on a tablet, it may be necessary to provide richer interactive functions. Through testing, the code can be adjusted in time to meet the needs of users of different devices. The performance and network environment of different devices vary greatly. By testing the code operation in a simulated environment container, the response speed of the code on different devices can be evaluated, performance bottlenecks can be identified and optimized, and building an environment container can achieve the reuse of the test environment, avoiding the need to manually configure different devices and browser environments for each test. Developers and testers can easily run test code in different environment containers, improve test efficiency, and further improve the accuracy and timeliness of automated testing for browser screen recording.
[0041] See also Figure 2 As shown, it is a logic diagram for determining the running status of the code in the test container according to an embodiment of the present invention. In step S3, the running status of the code in the test container is determined to be normal, code error, code redundancy or code missing based on the code coverage and screen change rate.
[0042] If the code coverage is greater than a preset coverage and the screen change rate is less than or equal to a preset change rate, it is determined that the running status of the code in the test container is normal; If the code coverage is greater than the preset coverage and the screen change rate is greater than the preset change rate, the running status of the code in the test container is determined to be a code error; If the code coverage is less than or equal to the preset coverage and the screen change rate is greater than the preset change rate, it is determined that the running status of the code in the test container is code missing; If the code coverage is less than or equal to the preset coverage and the screen change rate is less than or equal to the preset change rate, it is determined that the running status of the code in the test container is code redundancy; In implementation, the coverage rate can usually be preset to 95%, and the preset change rate can be preset to 10%. If the code coverage rate is 98% which is greater than the preset coverage rate and the screen change rate is 5% which is less than the preset change rate, then the running status of the code in the test container is determined to be normal; If the code coverage is 98% which is greater than the preset coverage and the screen change rate is 17% which is greater than the preset change rate, the running status of the code in the test container is determined to be a code error; If the code coverage rate is 87% which is less than the preset coverage rate and the screen change rate is 17% which is greater than the preset change rate, the running status of the code in the test container is determined to be code missing; If the code coverage rate is 87% which is less than the preset coverage rate and the screen change rate is 5% which is less than the preset change rate, the running status of the code in the test container is determined to be code redundancy; The preset coverage is negatively correlated with the total number of test containers participating in the simulation run, and the preset change rate is positively correlated with the total number of test containers participating in the simulation run.
[0043] It is understandable that, when the amount of code contained in a single test container is not much different, the more test containers participate in the simulation run, the more total code, the more complex the logic and conditional judgments between the codes, the increased difficulty of testing, and the reduced code coverage, so the preset coverage is reduced.
[0044] Optionally, the total number of test containers participating in the simulation run is 2, and the preset coverage is 95%; The total number of test containers involved in the simulation run is 5, and the preset coverage rate is 85%; The total number of test containers involved in the simulation run is 10, and the preset coverage rate is 70%.
[0045] It is understandable that, when the number of codes contained in a single test container is not much different, the more test containers participate in the simulation operation, the more total code, the more complex the logic and conditional judgments between the codes, the greater the difficulty of the test, and the need to process and update more pixel information, so the preset change rate increases.
[0046] Optionally, the total number of test containers participating in the simulation run is 2, and the preset change rate is 10%; The total number of test containers involved in the simulation run is 5, and the preset change rate is 15%; The total number of test containers participating in the simulation run is 10, and the preset change rate is 20%.
[0047] See also Figure 3 As shown, it is a flow chart of calculating the effective value of the environment container according to an embodiment of the present invention. In step S4, the effective weighted value of each test container is determined according to the result of the layered processing, and the process of calculating the effective value of the environment container in combination with the code coverage corresponding to each test container includes: Step S41, selecting an environment container in which the code in each test container runs normally; Step S42, determining an effective weighted value for each test container running in the environment container according to the result of the layered processing; Step S43, combining the effective weighted value of each test container and the code coverage rate to calculate the effective value of the environment container.
[0048] The effective value of an environment container is the sum of the effective weights of the contained test containers and the product of their code coverage.
[0049] In a specific implementation, the normal operation of the code in each test container is an environment container including three groups of test containers. Test container A belongs to the basic layer, with a code coverage of 98% and a weighted value of 0.3. Test container B belongs to the professional layer, with a code coverage of 96% and a weighted value of 0.5. Test container C belongs to the basic layer, with a code coverage of 93% and a weighted value of 0.2. The effective value of the environment container is 0.98*0.3+0.96*0.5+0.93*0.2=0.294+0.48+0.186=0.96.
[0050] See also Figure 4 As shown, it is a logic diagram of determining whether an environmental container is qualified according to an embodiment of the present invention. In step S4, the effective value of the environmental container is compared with a preset effective value, and whether the environmental container is qualified is determined according to the comparison result, wherein: If the effective value of the environmental container is greater than or equal to the preset effective value, the environmental container is judged to be qualified; If the effective value of the environmental container is less than the preset effective value, the environmental container is judged to be unqualified; In implementation, the preset effective value is 1.2. If the effective value of the environmental container is 1.6, which is greater than the preset effective value, the environmental container is determined to be qualified; If the effective value of the environmental container is 0.8, which is less than the preset effective value, the environmental container is judged to be unqualified.
[0051] The preset effective value is positively correlated with the total number of test containers contained in the environment container.
[0052] It can be understood that the larger the total number of test containers contained in the environment container, the greater the corresponding code coverage rate. According to the calculation method of the effective value of the environment container, the larger the environment effective value, the preset effective value is positively correlated with the total number of test containers contained in the environment container.
[0053] Specifically, in step S5, the process of calling a similar environment container for the next simulation run according to the similarity value, and adjusting the similar environment container to generate a new environment container according to the result of the next simulation run includes: The similarity value is obtained by comparing and calculating the operation behavior parameters of the existing environment container and the user's next operation; Compare the similarity value with a preset similarity value, and determine a similar environment container according to the comparison result; The similar environment container is simulated and run for the next time, and compared with the result of the next operation of the user, and the similar environment container is adjusted according to the comparison result to generate a new environment container.
[0054] Counting the number of operation behavior parameters of the next operation of the user that are consistent with the stored environment container as a similarity value; The container with the largest similarity value is selected as the similar environment container; Specifically, the present invention applies the stored environment container to the next simulation run, and adjusts the environment container according to the run results to obtain a new environment container for storage. Each time a simulation run is performed, there is no need to rebuild a complex test or run environment from scratch. The stored environment container can be used directly to quickly deploy the same or similar environment, which can save 70% of time compared to rebuilding the environment model. In the iteration cycle of software development, it is very important to quickly verify new functions or fix problems. The stored environment container can be used to quickly carry out simulation runs and obtain run results in time, thereby accelerating the iteration process of development and testing. The stored environment container retains specific software versions, configuration parameters and dependencies, so that the environment of each simulation run remains consistent, which helps to eliminate the problem of inconsistent test results caused by environmental differences. According to the simulation run results, the resource configuration of the environment container can be adjusted, and the run results can also reflect the rationality of certain configuration parameters in the environment container. As business needs continue to change, the software system needs to be continuously updated and optimized. The stored environment container can be used as a basis to adjust and expand according to new needs to generate a new environment container, further improving the accuracy and timeliness of automated testing for browser screen recording.
[0055] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. An automated testing method for browser screen recording, characterized in that: include: Obtain the operation behavior parameters of the user's operation on the browser and calculate the operation data; Using the operation data to construct a plurality of test containers, and encapsulating the test containers with the operation behavior parameters after layering; Simulate browsers in several different devices to build several environment containers, put each test container into the environment container for simulation operation to obtain code coverage, and combine the code coverage with the screen change rate to determine the operation status of the code in the test container; Determine the effective weighted value of each test container according to the result of the hierarchical processing, calculate the effective value of the environment container in combination with the code coverage rate corresponding to each test container, and determine whether the environment container is qualified based on the effective value; The qualified environment container is stored, a similar environment container is called according to the similarity value to perform the next simulation operation, and the similar environment container is adjusted according to the result of the next simulation operation to generate a new environment container.
2. The automated testing method for browser screen recording according to claim 1, characterized in that: The process of obtaining the screen change parameters before and after each of the test containers is placed in the environmental container for the simulation operation and calculating the screen change rate includes: Recording the changes in the window size and pixel density on the screen before and after each of the test containers is placed in the environmental container for the simulation operation; Calculate the window size change rate according to the window size change, and calculate the pixel density change rate according to the pixel density change; The screen change rate is calculated by combining the window size change rate and the pixel density change rate.
3. The automated testing method for browser screen recording according to claim 2, characterized in that: The process of converting the operation data into the test container includes: Performing cleaning processing on the operation data to generate unit data; Extract key information from the unit data to build an image; Building the test container according to the image; The unit data is a minimum data set that can completely run the test container.
4. The automated testing method for browser screen recording according to claim 3, characterized in that: The process of packaging the test containers with the operation behavior parameters after layering includes: Allocate the test containers to the basic layer, the professional layer and the interface layer according to the operation results of each test container; Associating and mapping the operation behavior parameters with the corresponding test containers; Configure packaging parameters; Among them, the basic layer is a common data layer for the operation of various systems, the professional layer is a data layer for the operation of professional systems, and the interface layer is a data layer for connecting various systems for interaction.
5. The automated testing method for browser screen recording according to claim 4, characterized in that: The process of simulating browsers in several different devices to build several environment containers includes: Determine device type and browser configuration; Customizing the environment image according to the device type and the browser configuration; The environment container is created based on the environment image.
6. The automated testing method for browser screen recording according to claim 5, characterized in that: The process of placing each of the test containers into the environment container for simulation operation and analyzing to obtain the code coverage rate includes: deploying each of the test containers to the environment container; The environment container is started, and the code coverage of each test container is recorded.
7. The automated testing method for browser screen recording according to claim 6, characterized in that: Based on the code coverage and the screen change rate, it is determined whether the running status of the code in the test container is normal, code error, code redundancy or code missing.
8. The automated testing method for browser screen recording according to claim 7, characterized in that: The process of determining the effective weighted value of each test container according to the result of the hierarchical processing and calculating the effective value of the environment container in combination with the code coverage rate corresponding to each test container includes: Selecting the environment container in which the code in each of the test containers runs normally; Determine an effective weighted value for each of the test containers running in the environmental container according to the result of the hierarchical processing; The effective value of the environment container is calculated by combining the effective weighted value and the code coverage of each test container.
9. The automated testing method for browser screen recording according to claim 8, characterized in that: The effective value of the environmental container is compared with a preset effective value, and whether the environmental container is qualified is determined according to the comparison result, wherein: The preset effective value is positively correlated with the total number of test containers contained in the environmental container.
10. The automated testing method for browser screen recording according to claim 9, characterized in that: The process of calling a similar environment container for the next simulation operation according to the similarity value, and adjusting the similar environment container to generate a new environment container according to the next simulation operation result includes: Obtaining a similarity value by comparing and calculating the operation behavior parameters of the existing environment container and the user's next operation; Comparing the similarity value with a preset similarity value, and determining a similar environment container according to the comparison result; The similar environment container is subjected to the next simulation operation, and compared with the result of the next operation of the user, and the similar environment container is adjusted according to the comparison result to generate a new environment container.
Citation Information
Patent Citations
Information system based on visual programming technology and construction method thereof
CN113703749A
Grid-based cross-terminal responsive design system and method
CN118760420A
Multi-browser testing method and device, equipment, medium and program product
CN116756016A
Visualization test method and device, electronic equipment and storage medium
CN116841865A
Browser testing method, device and equipment and computer readable storage medium
CN118295927A