Web testing methods, devices, storage media, and electronic equipment

By deploying a browser driver service on the terminal device, the browser can be remotely invoked for testing, which solves the problem of low testing efficiency in existing technologies and achieves efficient testing and good compatibility in cross-platform environments.

CN119440984BActive Publication Date: 2026-01-06TONGFANG KNOWLEDGE DIGITAL PUBLISHING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411334391.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2026-01-06
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

When testing web projects on multiple domestic platform environments, existing technologies require repeated execution of test programs, resulting in low testing efficiency and affecting adaptation efficiency.

Method used

By deploying driver services for different browsers on terminal devices, remote calls to the browser driver services can simulate user operations, generate test code, and enable cross-platform testing.

Benefits of technology

It reduces redundant work and repetitive operations during the testing process, improves testing efficiency, enhances the adaptability of web projects to different platform environments, and has good compatibility and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440984B_ABST
    Figure CN119440984B_ABST
Patent Text Reader

Abstract

This application discloses a web testing method, apparatus, storage medium, and electronic device, relating to the field of automated testing technology. The method includes: obtaining a first test case for a web project under a target testing scenario, the first test case containing defined user operations; generating a first test task based on the first test case under the target testing scenario; generating test code corresponding to the first test task; and, based on the test code, remotely invoking browser driver services in different platform environments to simulate user browser operations, obtaining the test results of the web project under the different platform environments, wherein the different platform environments consist of different terminal devices and different browsers. This application can improve testing efficiency, thereby improving the adaptability of web projects to different domestic platform environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automated testing technology, and in particular to a web testing method, apparatus, storage medium, and electronic device. Background Technology

[0002] In recent years, with the rapid advancement of internet technology and the booming development of the domestic ecosystem, the market share of domestically produced equipment has achieved a leapfrog growth. However, in order to enhance product compatibility, web projects have to deal with complex and diverse domestic environments and browser combinations, which necessitates testing web projects on multiple domestic platform environments.

[0003] Currently, existing technologies typically perform web project testing directly on a local machine. However, this testing method requires continuously adding test programs to different domestic platform environments for repeated testing, resulting in a large amount of redundant work, low testing efficiency, and consequently affecting the adaptability of web projects to different domestic platform environments. Summary of the Invention

[0004] In view of this, this application provides a web testing method, apparatus, storage medium and electronic device, the main purpose of which is to improve testing efficiency, thereby improving the compatibility of web projects with different domestic platform environments.

[0005] According to a first aspect of this application, a web testing method is provided, the method comprising:

[0006] Obtain the first test case of the web project in the target test scenario. The first test case contains defined user operations.

[0007] Based on the first test case in the target test scenario, generate the first test task;

[0008] Generate the test code corresponding to the first test task;

[0009] Based on the test code, browser driver services in different platform environments are remotely invoked to simulate user browser operations and obtain the test results of the web project in the different platform environments, wherein the different platform environments consist of different terminal devices and different browsers.

[0010] According to a second aspect of this application, a web testing apparatus is provided, the apparatus comprising:

[0011] The acquisition unit is used to acquire the first test case of the web project in the target test scenario, wherein the first test case contains defined user operations;

[0012] The generation unit is used to generate a first test task based on the first test case under the target test scenario;

[0013] The generation unit is also used to generate test code corresponding to the first test task;

[0014] The testing unit is used to remotely call browser driver services in different platform environments based on the test code, so as to simulate the behavior of users operating the browser and obtain the test effect of the web project in the different platform environments, wherein the different platform environments consist of different terminal devices and different browsers.

[0015] According to a third aspect of this application, a storage medium is provided on which a computer program is stored, which, when executed by a processor, implements the above-described web testing method.

[0016] According to a fourth aspect of this application, an electronic device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the web testing method described above.

[0017] By employing the above technical solutions, this application provides a web testing method, apparatus, storage medium, and electronic device. Based on user operations defined in the first test case, it generates corresponding test code and, based on the test code, remotely calls browser driver services in different platform environments to simulate user browser behavior. This allows for obtaining test results of web projects in different platform environments. Compared to existing technologies, because this application deploys different browser driver services on the terminal device, it can directly remotely call the browser driver for testing. Therefore, it solves the problem of traditional testing methods only being able to perform UI testing locally. When testing web projects for different platform environments, it reduces redundant work and repetitive operations during the testing process, thereby improving testing efficiency and enhancing the adaptability of web projects to different platform environments. Furthermore, because this application can complete testing for different platform environments, it has good compatibility.

[0018] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 A flowchart illustrating a web testing method provided in an embodiment of this application is shown;

[0021] Figure 2 A schematic diagram of the architecture of the UI automation testing module provided in an embodiment of this application is shown;

[0022] Figure 3 A schematic diagram of the first test case provided in an embodiment of this application is shown;

[0023] Figure 4 This illustration shows a list of UI test cases provided in an embodiment of this application.

[0024] Figure 5 This illustration shows a schematic diagram of UI test task information provided in an embodiment of this application;

[0025] Figure 6 This illustration shows a UI test task list provided in an embodiment of this application;

[0026] Figure 7 This illustration shows a schematic diagram of a UI test report provided in an embodiment of this application;

[0027] Figure 8 A schematic diagram of the UI testing process provided in an embodiment of this application is shown;

[0028] Figure 9 A flowchart illustrating another web testing method provided in an embodiment of this application is shown;

[0029] Figure 10 A schematic diagram of the architecture of the API automated testing module provided in an embodiment of this application is shown;

[0030] Figure 11 A schematic diagram of the second test case provided in an embodiment of this application is shown;

[0031] Figure 12 This illustration shows a list of API test cases provided in an embodiment of this application.

[0032] Figure 13 This illustration shows a schematic diagram of API testing task information provided in an embodiment of this application;

[0033] Figure 14 This illustration shows a schematic diagram of the API test task list provided in an embodiment of this application;

[0034] Figure 15 This illustration shows a schematic diagram of an API test report provided in an embodiment of this application;

[0035] Figure 16A flowchart illustrating another web testing method provided in an embodiment of this application is shown;

[0036] Figure 17 A schematic diagram of the architecture of the visualization testing module provided in an embodiment of this application is shown;

[0037] Figure 18 This illustration shows a schematic diagram of device information for an optional terminal device provided in an embodiment of this application;

[0038] Figure 19 A schematic diagram of a terminal device page provided in an embodiment of this application is shown;

[0039] Figure 20 A schematic diagram of the structure of a web testing device provided in an embodiment of this application is shown. Detailed Implementation

[0040] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.

[0041] Existing testing methods require constantly adding test programs to different domestic platform environments for testing and repeated execution, which leads to a lot of redundant work, low testing efficiency, and thus affects the adaptation efficiency of web projects to different domestic platform environments.

[0042] To address the aforementioned problems, this invention provides a web testing method applied to an automated testing tool. This automated testing tool primarily involves three modules: a UI automated testing module, an API automated testing module, and a visual testing module. The UI automated testing module is mainly used for browser testing, the API automated testing module is mainly used for interface testing, and the visual testing module is mainly used for manual testing via remote access to a terminal device through a webpage. The testing process involved in the UI automated testing module is as follows: Figure 1 As shown, the method includes:

[0043] Step 101: Obtain the first test case of the web project in the target test scenario.

[0044] The first test case includes defined user operations, such as user login and query operations. The web project can specifically include a web application. The target test scenario can be any one of multiple test scenarios, such as a login test scenario, a query test scenario, etc., or a combination of test scenarios, such as a combination of a login test scenario and a query test scenario.

[0045] The embodiments of this invention are primarily applicable to testing web projects in different platform environments. The executing entity of these embodiments is a device or equipment capable of performing web testing in different platform environments.

[0046] The specific architectural logic of the UI automated testing module Figure 2 As shown, before testing, multiple browsers need to be installed on each of the multiple terminal devices, and browser driver services corresponding to each of the multiple browsers need to be deployed; based on the multiple terminal devices and the multiple browsers, the different platform environments are formed.

[0047] Specifically, terminal equipment includes domestically produced terminal equipment, with different operating systems and central processing units on different terminal devices.

[0048] Specifically, driver information for various browsers can be pre-collected, compiled into driver files, and deployed on different terminal devices. For example, on terminal device 1, browsers 1, 2, ..., n can be installed, and their driver files deployed accordingly. Similarly, on terminal device 2, browsers 1, 2, ..., n can be installed, and their driver files deployed accordingly, and so on. This allows for the creation of different platform environments based on different terminal devices and browsers for web project testing. During testing, the corresponding platform environment needs to be initialized, and the browser driver service needs to be started to provide external services.

[0049] By integrating resources from different platform environments to form a unified resource pool, this invention enables the web project testing system to cover multiple platform environments and run stably on different operating systems and browsers.

[0050] Before testing, it is necessary to obtain user operations in the target test scenario, as well as information on each step involved in the user operations; based on the interface information corresponding to each step, determine browser operation behavior, element location information, screenshot information, and assertion information; based on the user operations, the information on each step, and the browser operation behavior, element location information, screenshot information, and assertion information involved in each step, define the first test case of the web project in the target test scenario, such as... Figure 3 As shown. Figure 4 A list of predefined test cases is displayed.

[0051] For example, in a login test scenario, the user action is a login operation. This login operation involves steps such as entering a username, entering a password, and clicking "login." Based on the interface information corresponding to each step, the tester's configured browser actions (such as clicking, pressing Enter, scrolling down), element location information, whether a screenshot is taken, and assertion information are obtained. Then, based on the login operation and its involved steps, as well as the corresponding browser actions, element location information, screenshot information, and assertion information for each step, the first test case for the login test scenario is generated.

[0052] This invention, by developing unified test cases for different platform environments and testing scenarios, enables testing and adaptation across different platform environments, greatly reducing the investment of various resources, shortening the product release cycle, and improving social productivity.

[0053] Step 102: Generate the first test task based on the first test case under the target test scenario.

[0054] In an embodiment of the present invention, if the first test case under the target test scenario includes test cases under multiple test scenarios, then the test cases under the multiple test scenarios are integrated to obtain the first test task. Figure 5 The task information corresponding to the first test task (UI test task) is shown, including the task name, task type, terminal device and browser involved. Figure 6 The generated list of UI test tasks is shown.

[0055] For example, when a website needs to undergo functional testing, its first test task could include login test cases, query test cases, etc.

[0056] Step 103: Generate the test code corresponding to the first test task.

[0057] The test code includes Selenium code.

[0058] In this embodiment of the invention, Selenium code is generated according to the first test task.

[0059] Step 104: Based on the test code, remotely call the browser driver service in different platform environments to simulate the user's browser operation behavior and obtain the test effect of the web project in the different platform environments.

[0060] The different platform environments consist of different terminal devices and different browsers.

[0061] In this embodiment of the invention, during testing, a selected target terminal device and a target browser are first obtained; based on the selected target terminal device and target browser, a target platform environment in the multiple different platform environments is determined; the test code is compiled and executed, and the browser driver service in the target platform environment is remotely called to simulate the user's browser operation behavior, so as to obtain the test effect of the web project in the target platform environment.

[0062] The target platform environment can be any one of multiple different platform environments.

[0063] Specifically, based on the terminal device and browser selected by the tester, a target platform environment can be generated. Simultaneously, a Java editor (such as Janino) is used to compile and execute the test code, remotely invoking the browser driver service within the target platform environment to simulate user browser operations. The returned results are then parsed to generate a corresponding test report, such as... Figure 7 As shown, this test report can determine whether the web project's page can be displayed correctly on the target platform.

[0064] The embodiments of the present invention can also embed expected behavior results, and after the relevant functional point tests are completed, they are automatically compared with the expected behavior results to improve the accuracy and reliability of the tests.

[0065] Furthermore, after clicking "Execute," testers can view the entire testing process by selecting the corresponding terminal device (target terminal device). Once the page is opened, the browser can be seen clicking and operating automatically, such as... Figure 8 As shown.

[0066] This invention defines basic information once, which can then be reused in different platform environments. Figure 2 The testing process in the process.

[0067] In some embodiments, to ensure the successful execution of the first test task, it is necessary to pre-determine whether the target terminal device meets the execution conditions. For this process, the method includes: determining whether the browser driver service in the target platform environment has been successfully driven, and whether the number of test tasks to be run in the target platform environment is less than a preset number of tasks; if the browser driver service in the target platform environment is successfully driven, and the number of test tasks to be run is less than the preset number of tasks, then the target terminal device is determined to meet the execution conditions, the test code is compiled and executed, and the browser driver service in the target platform environment is remotely invoked; if the browser driver service in the target platform environment is not successfully driven, or the number of test tasks to be run is less than the preset number of tasks, then the target terminal device is determined not to meet the execution conditions.

[0068] The number of preset tasks can be set according to the performance of the target terminal device.

[0069] This invention provides a web testing method that, by deploying driver services for different browsers on the terminal device, can directly and remotely invoke the driver browser for testing. This overcomes the limitation of traditional testing methods that can only perform UI testing locally. When testing web projects across different platform environments, it reduces redundant work and repetitive operations, thereby improving testing efficiency and the adaptability of web projects to different platform environments. Furthermore, because this invention can complete testing for different platform environments, it has good compatibility. Moreover, through a highly automated testing process, this invention reduces manual intervention, significantly improves testing efficiency, shortens the testing cycle, and has good scalability.

[0070] Furthermore, the testing process involved in the API automated testing module, such as... Figure 9 As shown, the method includes:

[0071] Step 201: Obtain the second test case in the target test scenario.

[0072] The second test case includes defined user operations, such as user login and query operations.

[0073] The specific architecture logic of the API automated testing module is as follows: Figure 10 Place

[0074] As shown, before testing, it is necessary to obtain user operations in the target test scenario, information on each step involved in the user operations, and the request methods, request parameters, and pre-request settings corresponding to each step. Based on the user operations, the information on each step, and the request methods, request parameters, and pre-request settings corresponding to each step, a second test case is defined in the target test scenario, such as... Figure 11 As shown. Figure 12 A list of interface test cases is shown.

[0075] For example, in a query test scenario, the user operation is a query operation. The information for each step involved in this query operation includes querying all users, querying by ID, and paginated querying. Each step has corresponding request methods (such as GET, POST, DELETE, etc.), query parameters, header parameters, and whether there are any pre-requests. Then, based on the query operation and its involved steps, as well as the request methods, query parameters, header parameters, and whether there are any pre-requests for each step, a second test case for the query test scenario is generated.

[0076] Step 202: Generate a second test task based on the second test cases under the target test scenario.

[0077] In this embodiment of the invention, if the second test case under the target test scenario includes test cases under multiple test scenarios, then the test cases under the multiple test scenarios are integrated to obtain the second test task. Figure 13 The task information corresponding to the first test task (interface test task) is shown, including the task name, task type, etc. Figure 14 The generated list of interface test tasks is shown.

[0078] For example, when a website needs to undergo functional testing, its first test task could include login test cases, query test cases, etc.

[0079] Step 203: Based on the second test task, generate an HTTP request and call the API interface of the selected target web project to send the HTTP request.

[0080] In this embodiment of the invention, an HTTP request is generated based on the request method, request parameters, and pre-request settings information in the second test task, and the API interface of the selected target web project is called to send the HTTP request.

[0081] It should be noted that if a pre-request exists, an OPTIONS request is first sent to the server to determine whether it is safe to send the original request and to find out which HTTP methods, request headers, and other information can be used. Then, the above parameter information is placed in the interface before making the request.

[0082] Step 204: Obtain and parse the return information of the API interface to verify whether the return information of the API interface is correct.

[0083] The final test report of the API interface is as follows: Figure 15 As shown, this embodiment of the invention completes functional testing of a domestically developed web project by remotely calling its API interface, which reduces the workload of testers and lowers the cost of customized testing.

[0084] Furthermore, the testing process involved in the visualization testing module, such as... Figure 16 As shown, the method includes:

[0085] Step 301: When the tester accesses the automated testing system through a local browser, display the device information of the optional terminal devices to the tester.

[0086] The specific device information for optional terminal devices includes: device model, architecture, server IP, and installed browser.

[0087] For embodiments of the present invention, the specific architectural logic of the visualization testing module is as follows: Figure 17 As shown, X11vnc, noVNC, and Nginx services are installed and started on multiple terminal devices. To ensure the security of these services, Nginx only forwards socket connections, and other ports are not exposed. At the same time, the terminal information for multiple devices, such as IP address, port, and password, is completed.

[0088] In this embodiment of the invention, when a tester accesses the automated testing system through a local browser, they need to select a corresponding terminal device. For this process, the method includes: obtaining the target operating system and target CPU selected by the tester; based on the target operating system and target CPU, filtering out the selectable terminal devices from multiple terminal devices, and displaying the device information of the selectable terminal devices to the tester, such as... Figure 18 As shown.

[0089] Step 302: When the tester selects a test terminal device from the selectable terminal devices based on the device information, the tester remotely enters the test terminal device and visualizes the interface of the test terminal device so that the tester can select the corresponding browser for manual testing based on the visualized interface.

[0090] In this embodiment of the invention, after the tester selects a test terminal device, they can remotely access the test terminal device and open its page, such as... Figure 19 As shown, testers can select the appropriate browser on this page to complete manual testing.

[0091] This invention connects to a remote terminal via a local browser, enabling manual visual testing of related web projects using different browsers.

[0092] Furthermore, as Figure 1 , Figure 9 and Figure 16 The specific implementation of the method shown in this embodiment provides a web testing device, such as... Figure 20 As shown, the device includes: an acquisition unit 31, a generation unit 32, and a testing unit 33.

[0093] The acquisition unit 31 can be used to acquire the first test case of the web project in the target test scenario, wherein the first test case contains defined user operations.

[0094] The generation unit 32 can be used to generate a first test task based on the first test case under the target test scenario.

[0095] The generation unit 32 can also be used to generate test code corresponding to the first test task.

[0096] The test unit 33 can be used to remotely call browser driver services in different platform environments based on the test code, so as to simulate the behavior of users operating the browser and obtain the test effect of the web project in the different platform environments, wherein the different platform environments consist of different terminal devices and different browsers.

[0097] In some embodiments, the apparatus further includes a deployment unit and a component unit.

[0098] The deployment unit can be used to install multiple browsers on each of the multiple terminal devices and deploy browser driver services corresponding to each of the multiple browsers, wherein the operating systems and central processing units on the different terminal devices are different.

[0099] The constituent units can be used to form the different platform environments based on the multiple terminal devices and the multiple browsers.

[0100] In some embodiments, the acquisition unit 31 may be specifically used to acquire user operations in the target test scenario, as well as information on each step involved in the user operations; determine browser operation behavior, element positioning information, screenshot information, and assertion information based on the interface information corresponding to each step information; and define a first test case for the web project in the target test scenario based on the user operations, the information on each step, and the browser operation behavior, element positioning information, screenshot information, and assertion information involved in each step information.

[0101] In some embodiments, the generation unit 32 may be specifically used to integrate the test cases in the multiple test scenarios to obtain the first test task if the first test case in the target test scenario includes test cases in multiple test scenarios.

[0102] In some embodiments, the generation unit 32 may also be specifically used to generate Selenium code corresponding to the first test task.

[0103] In some embodiments, the test unit 33 may be specifically used to acquire a selected target terminal device and a target browser; based on the selected target terminal device and target browser, determine the target platform environment in the plurality of different platform environments; compile and execute the test code, remotely call the browser driver service in the target platform environment to simulate the user's browser operation behavior, and obtain the test effect of the web project in the target platform environment.

[0104] In some embodiments, the testing unit 33 can also be specifically used to determine whether the browser driver service in the target platform environment has been successfully driven, and whether the number of test tasks to be run in the target platform environment is less than a preset number of tasks; if the browser driver service in the target platform environment is successfully driven, and the number of test tasks to be run is less than the preset number of tasks, then the target terminal device is determined to meet the execution conditions, the test code is compiled and executed, and the browser driver service in the target platform environment is remotely invoked; if the browser driver service in the target platform environment is not successfully driven, or the number of test tasks to be run is less than the preset number of tasks, then the target terminal device is determined not to meet the execution conditions.

[0105] In some embodiments, the acquisition unit 31 can also be used to acquire a second test case under the target test scenario.

[0106] The generation unit 32 can also be used to generate a second test task based on the second test cases under the target test scenario.

[0107] The test unit 33 can also be used to generate an HTTP request based on the second test task, and call the API interface of the selected target web project to send the HTTP request; obtain the return information of the API interface and parse it to verify whether the return information of the API interface is correct.

[0108] In some embodiments, the acquisition unit 31 may also be specifically used to acquire user operations in the target test scenario, information on each step involved in the user operations, and request methods, request parameters, and pre-request setting information corresponding to each step information; and define a second test case in the target test scenario based on the user operations, the information on each step, and the request methods, request parameters, and pre-request setting information corresponding to each step information.

[0109] In some embodiments, the apparatus further includes a display unit and a visualization unit.

[0110] The display unit can be used to display device information of optional terminal devices to testers when they access the automated testing system through a local browser.

[0111] The visualization unit can be used to remotely access the test terminal device when the tester selects a test terminal device from the selectable terminal devices based on the device information, and visualize the interface of the test terminal device so that the tester can select the corresponding browser for manual testing based on the visualized interface.

[0112] In some embodiments, the display unit may be specifically used to obtain the target operating system and target central processing unit selected by the tester; based on the target operating system and target central processing unit, to filter out the optional terminal devices from multiple terminal devices, and to display the device information of the optional terminal devices to the tester.

[0113] It should be noted that other corresponding descriptions of the functional units involved in the web testing device provided in this embodiment of the invention can be found in [reference needed]. Figure 1 , Figure 9 and Figure 16 The corresponding description in [the document] will not be repeated here.

[0114] Based on the above, Figure 1 , Figure 9 and Figure 16 Accordingly, this embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described method. Figure 1 , Figure 9 and Figure 16 The web testing method shown.

[0115] Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause an electronic device (such as a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of this application.

[0116] Based on the above, Figure 1 , Figure 9 and Figure 16 The method shown, and Figure 20 To achieve the above objectives, the present application also provides an electronic device, specifically a personal computer, tablet computer, server, or other network device, as shown in the virtual device embodiment. This device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to achieve the above-described objectives. Figure 1 , Figure 9 and Figure 16 The web testing method shown.

[0117] Optionally, the aforementioned physical devices may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.

[0118] Those skilled in the art will understand that the physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.

[0119] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned physical device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing physical device.

[0120] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platform, or it can be implemented by hardware.

[0121] This invention, by deploying driver services for different browsers on the terminal device, allows for direct remote invocation of the driver browser for testing. This overcomes the limitation of traditional testing methods that restrict UI testing to local environments. When testing web projects across different platform environments, it reduces redundant work and repetitive operations, thereby improving testing efficiency and enhancing the adaptability of web projects to different platform environments. Furthermore, because this invention can perform testing across various platform environments, it exhibits excellent compatibility. Moreover, through a highly automated testing process, this invention reduces manual intervention, significantly improves testing efficiency, shortens the testing cycle, and provides excellent scalability.

[0122] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.

[0123] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.

Claims

1. A web testing method characterized by, The method comprises the following steps: obtaining a first test case of a web project under a target test scenario, wherein the first test case comprises defined user operations; generating a first test task according to the first test case under the target test scenario; generating test code corresponding to the first test task; based on the test code, remotely calling browser driver services in different platform environments to simulate the behavior of a user operating a browser, and obtaining the test effect of the web project in the different platform environments, wherein the different platform environments are composed of different terminal devices and different browsers; comparing the test effect in the different platform environments with built-in expected behavior effect to improve test accuracy; based on the test code, remotely calling browser driver services in different platform environments to simulate the behavior of a user operating a browser, and obtaining the test effect of the web project in the different platform environments, comprising: obtaining a selected target terminal device and a target browser; based on the selected target terminal device and the target browser, determining a target platform environment in a plurality of different platform environments; compiling and executing the test code, remotely calling the browser driver service in the target platform environment to simulate the behavior of a user operating a browser, and obtaining the test effect of the web project in the target platform environment; before the step of based on the test code, remotely calling browser driver services in different platform environments, the method further comprises: for a target platform environment in the different platform environments, determining whether the browser driver service in the target platform environment is successfully driven, and whether the number of test tasks to be run in the target platform environment is less than a preset number of tasks; if the browser driver service in the target platform environment is successfully driven, and the number of test tasks to be run is less than the preset number of tasks, it is determined that the target terminal device meets the execution condition, and the test code is compiled and executed to remotely call the browser driver service in the target platform environment; if the browser driver service in the target platform environment is not successfully driven, or the number of test tasks to be run is less than the preset number of tasks, it is determined that the target terminal device does not meet the execution condition.

2. The method of claim 1, wherein, before the step of obtaining a first test case of a web project under a target test scenario, the method further comprises: installing a plurality of browsers on each of a plurality of terminal devices respectively, and deploying browser driver services corresponding to the plurality of browsers respectively, wherein the operating systems and central processing units on different terminal devices are different; based on the plurality of terminal devices and the plurality of browsers, the different platform environments are composed; and / or the step of obtaining a first test case of a web project under a target test scenario comprises: obtaining user operations under the target test scenario, and step information involved in the user operations; determining browser operation behavior, element positioning information, screenshot information and assertion information according to interface information corresponding to the step information; define a first test case of the web project under the target test scenario based on the user operation, the step information, and browser operation behavior, element positioning information, screenshot information, and assertion information involved in the step information.

3. The method of claim 1, wherein, The first test task is generated according to the first test case under the target test scenario, including: If the first test case under the target test scenario includes test cases under multiple test scenarios, the test cases under the multiple test scenarios are integrated to obtain the first test task; and / or The test code includes Selenium code, and the test code corresponding to the first test task is generated, including: Selenium code corresponding to the first test task is generated; and / or The test code is used to remotely call browser driver services in different platform environments to simulate user operation of the browser to obtain test results of the web project in the different platform environments, including: selected target terminal device and target browser are obtained; Based on the selected target terminal device and target browser, a target platform environment is determined from the multiple different platform environments; The test code is compiled and executed to remotely call browser driver services in the target platform environment to simulate user operation of the browser to obtain test results of the web project in the target platform environment.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: a second test case under a target test scenario is obtained; a second test task is generated according to the second test case under the target test scenario; an HTTP request is generated based on the second test task, and an API interface of a selected target web project is called to send the HTTP request; return information of the API interface is obtained and parsed to verify whether the return information of the API interface is correct; and / or The method further includes: When a test personnel accesses the automatic test system through a local browser, device information of selectable terminal devices is displayed to the test personnel; When the test personnel selects a test terminal device from the selectable terminal devices based on the device information, the test terminal device is remotely entered, and an interface of the test terminal device is visualized so that the test personnel can select a corresponding browser for manual testing based on the visualized interface.

5. The method of claim 4, wherein, The second test case under the target test scenario is obtained, including: User operation under the target test scenario, step information involved in the user operation, and request mode, request parameter, and pre-request setting information corresponding to the step information are obtained; A second test case under the target test scenario is defined based on the user operation, the step information, and the request mode, the request parameter, and the pre-request setting information corresponding to the step information.

6. The method of claim 4, wherein, The device information of the selectable terminal devices is displayed to the test personnel, including: A target operating system and a target central processing unit selected by the test personnel are obtained; Filtering the selectable terminal device from a plurality of terminal devices based on the target operating system and the target central processing unit, and showing device information of the selectable terminal device to the tester.

7. A web testing device characterized by comprising: Comprise: An acquisition unit is configured to acquire a first test case of a web project under a target test scenario, wherein the first test case contains defined user operations. A generation unit is configured to generate a first test task according to the first test case under the target test scenario. The generation unit is further configured to generate test code corresponding to the first test task. A test unit is configured to remotely call a browser driver service in different platform environments based on the test code to simulate the behavior of a user operating a browser, and obtain a test effect of the web project under the different platform environments, wherein the different platform environments are composed of different terminal devices and different browsers. A comparison unit is configured to compare the test effect under the different platform environments with an internal expected behavior effect to improve test accuracy. The test unit is specifically configured to acquire a selected target terminal device and a target browser, determine a target platform environment in a plurality of different platform environments based on the selected target terminal device and the target browser, compile and execute the test code, remotely call the browser driver service in the target platform environment to simulate the behavior of the user operating the browser, and obtain the test effect of the web project under the target platform environment. A determination unit is configured to determine whether the browser driver service in the target platform environment is successfully driven and whether a number of test tasks to be run in the target platform environment is less than a preset number of tasks for the target platform environment in the different platform environments.

8. A storage medium having stored thereon a computer program, characterized in that If the browser driver service in the target platform environment is successfully driven and the number of test tasks to be run is less than the preset number of tasks, it is determined that the target terminal device meets an execution condition, the test code is compiled and executed, and the browser driver service in the target platform environment is remotely called.

9. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, If the browser driver service in the target platform environment is not successfully driven or the number of test tasks to be run is less than the preset number of tasks, it is determined that the target terminal device does not meet the execution condition. The computer program is executed by the processor to implement the method of any one of claims 1-6. The processor executes the computer program to implement the method of any one of claims 1-6.

Citation Information

Patent Citations

  • UI automatic test method, electronic device and computer readable storage medium

    CN111190823A

  • Automatic test method and device for Html5 game page login, equipment and medium

    CN112506785A