Web test method and device, storage medium and electronic equipment

By obtaining and generating test cases, remotely calling browser-driven services from different platform environments for web project testing, solving the problems of low testing efficiency and poor adaptation efficiency in the existing technology, and achieving efficient testing and good compatibility .

CN119440984AActive Publication Date: 2025-02-14TONGFANG KNOWLEDGE NETWORK DIGITAL PUBLISHING TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411334391.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-02-14
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

When conducting web project testing, the existing technology requires repeated testing in multiple domestic platform environments, resulting in redundant work and inefficiency, affecting adaptation efficiency.

Method used

By obtaining the first test case of the web project in the target test scenario, generating the corresponding test code, and remotely calling the browser driver services in different platform environments to simulate user operations and obtain the test effect.

Benefits of technology

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

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440984A_ABST
    Figure CN119440984A_ABST
Patent Text Reader

Abstract

The invention discloses a web testing method and device, a storage medium and electronic equipment, and relates to the technical field of automatic testing. The method comprises the steps of obtaining a first test case of a web item in a target test scene, wherein the first test case comprises defined user operation; generating a first test task according to a first test case in the target test scene; generating a test code corresponding to the first test task; based on the test codes, browser driving services in different platform environments are remotely called to simulate browser operation behaviors of a user, test effects of the web project in the different platform environments are obtained, and the different platform environments are composed of different terminal devices and different browsers. According to the method and the device, the test efficiency can be improved, so that the adaptation efficiency of the web project and different domestic platform environments is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In recent years, with the rapid progress of Internet technology and the vigorous development of the domestic ecological environment, the market share of domestic equipment has achieved a leap-forward growth. However, in order to enhance the compatibility of products, web projects have to face complex and diverse domestic environments and browser combinations, which requires testing web projects on multiple domestic platform environments.

[0003] At present, the existing technology usually directly tests web projects locally. However, this testing method requires constantly adding test programs to different domestic platform environments for testing and repeated execution, which will result in a lot of redundant work and low testing efficiency, thus affecting the adaptation efficiency of web projects and different domestic platform environments. Summary of the invention

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

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

[0006] Obtaining a first test case of a web project in a target test scenario, wherein the first test case includes a defined user operation;

[0007] Generate a first test task according to a first test case in the target test scenario;

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

[0009] Based on the test code, the browser driver service in different platform environments is remotely called to simulate the behavior of the user operating the browser, and the test effect of the web project in the different platform environments is obtained, wherein the different platform environments are composed of different terminal devices and different browsers.

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

[0011] An acquisition unit, configured to acquire a first test case of a web project in a target test scenario, wherein the first test case includes a defined user operation;

[0012] A generating unit, configured to generate a first test task according to a first test case in the target test scenario;

[0013] The generating unit is further configured to generate a test code corresponding to the first test task;

[0014] The test unit is used to remotely call the browser driver service in different platform environments based on the test code to simulate the behavior of the user operating the browser and obtain 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.

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

[0016] According to a fourth aspect of the present application, an electronic device is provided, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned web testing method when executing the program.

[0017] By means of the above technical scheme, the web testing method, device, storage medium and electronic device provided by the present application generate corresponding test codes according to the user operation defined in the first test case, and based on the test code, remotely call the browser driver service in different platform environments to simulate the user's operation of the browser, thereby obtaining the test effect of the web project in different platform environments. Compared with the prior art, since the present application deploys the driver services of different browsers on the terminal device, the driver browser can be directly called remotely for testing, so it can solve the dilemma that the traditional testing method can only perform UI testing locally. When testing web projects for different platform environments, it can reduce redundant work and repeated operations in the testing process, thereby improving the testing efficiency and improving the adaptation efficiency of web projects to different platform environments. In addition, since the present application can complete the test for different platform environments, it has good compatibility.

[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0020] Figure 1 A schematic diagram of a web testing method provided in an embodiment of the present application is shown;

[0021] Figure 2 The following is a schematic diagram of the architecture of the UI automation test module provided in the embodiment of the present application;

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

[0023] Figure 4 A schematic diagram of a UI test case list provided in an embodiment of the present application is shown;

[0024] Figure 5 A schematic diagram of UI test task information provided in an embodiment of the present application is shown;

[0025] Figure 6 A schematic diagram of a UI test task list provided in an embodiment of the present application is shown;

[0026] Figure 7 A schematic diagram of a UI test report provided in an embodiment of the present application is shown;

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

[0028] Fig. 9 A schematic diagram of another web testing method provided in an embodiment of the present application is shown;

[0029] Fig.10 The following is a schematic diagram of the architecture of the API automated testing module provided in the embodiment of the present application;

[0030] Fig.11 A schematic diagram of a second test case provided in an embodiment of the present application is shown;

[0031] Fig.12 A schematic diagram of a list of API test cases provided in an embodiment of the present application is shown;

[0032] Fig.13 A schematic diagram of API test task information provided in an embodiment of the present application is shown;

[0033] Fig.14 A schematic diagram of an API test task list provided in an embodiment of the present application is shown;

[0034] Fig.15 A schematic diagram of an API test report provided in an embodiment of the present application is shown;

[0035] Fig.16A schematic diagram of a flow chart of another web testing method provided in an embodiment of the present application is shown;

[0036] Fig.17 A schematic diagram of the architecture of a visual testing module provided in an embodiment of the present application is shown;

[0037] Fig.18 A schematic diagram of device information of an optional terminal device provided in an embodiment of the present application is shown;

[0038] Fig.19 A schematic diagram of a terminal device page provided in an embodiment of the present application is shown;

[0039] Fig. 20 A schematic diagram of the structure of a web testing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

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

[0041] The existing testing method requires constantly adding test programs to different domestic platform environments for testing and repeated execution, which will result in a large amount of redundant work and low testing efficiency, thus affecting the adaptation efficiency of web projects and different domestic platform environments.

[0042] In order to solve the above problems, an embodiment of the present invention provides a web testing method, which is applied to an automated testing tool. The automated testing tool mainly involves three modules, namely a UI automated testing module, an API automated testing module and a visual testing module. Among them, 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 remotely accessing a terminal device through a web page for manual testing. The test process involved in the UI automated testing module is as follows: Figure 1 As shown, the method includes:

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

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

[0045] The embodiment of the present invention is mainly applicable to the testing of web projects in different platform environments. The execution subject of the embodiment of the present invention is a device or equipment capable of performing web testing in different platform environments.

[0046] The specific architecture logic of the UI automatic testing module is as follows Figure 2 As shown, before testing, it is necessary to install multiple browsers on each of the multiple terminal devices, and deploy browser driver services corresponding to the multiple browsers respectively; based on the multiple terminal devices and the multiple browsers, the different platform environments are formed.

[0047] Among them, the terminal devices specifically include domestically produced terminal devices, and the operating systems and central processing units on different terminal devices are different.

[0048] Specifically, the driving modes of various browsers can be collected in advance to form driving files and deployed on different terminal devices. For example, browser 1, browser 2, ..., browser n are installed in terminal device 1, and the driving files of browser 1, browser 2, ..., browser n are deployed respectively. Similarly, browser 1, browser 2, ..., browser n are installed in terminal device 2, and the driving files of browser 1, browser 2, ..., browser n are deployed respectively. And so on, different platform environments can be formed according to different terminal devices and different browsers for web project testing. During testing, it is necessary to initialize the corresponding platform environment and start the browser's driving service to provide external services.

[0049] The embodiment of the present invention integrates different platform environment resources to form a unified resource pool, thereby ensuring that the web project testing system can cover a variety of platform environments and can run stably on different operating systems and browsers.

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

[0051] For example, for the login test scenario, the user operation is a login operation, and the various step information involved in the login operation includes inputting a user name, inputting a password, and clicking to log in, etc. According to the interface information corresponding to each of the above step information, the browser operation behavior (such as click, enter, drop-down, etc.), element positioning information, whether to take a screenshot, and assertion information set by the tester are obtained. Then, according to the login operation and the various step information involved, as well as the browser operation behavior, element positioning information, screenshot information, and assertion information corresponding to each step information, the first test case under the login test scenario is generated.

[0052] The embodiments of the present invention can complete testing and adaptation in different platform environments by uniformly developing test cases in different test scenarios for different platform environments, greatly reducing the investment in various resources, shortening the product release cycle, and improving social production capacity.

[0053] Step 102: Generate a first test task according to a first test case in the target test scenario.

[0054] According to the embodiment of the present invention, 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. Figure 5 The task information corresponding to the first test task (UI test task) is shown, including the task name, task type, terminal devices and browsers involved, etc. Figure 6 The generated UI test task list is shown.

[0055] For example, if a website needs to undergo functional testing, the corresponding first test task may include login test cases, query test cases, and the like.

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

[0057] Wherein, the test code includes Selenium code.

[0058] According to the embodiment of the present invention, the corresponding 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 behavior of the user operating the browser and obtain the test effect of the web project in the different platform environments.

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

[0061] For the embodiment of the present invention, during testing, the selected target terminal device and target browser are first obtained; based on the selected target terminal device and target browser, the target platform environment among 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 operation of the browser, and the test effect of the web project in the target platform environment is obtained.

[0062] The target platform environment is any one of a plurality of different platform environments.

[0063] Specifically, according to the terminal device and browser selected by the tester, a target platform environment can be generated. At the same time, a Java editor (such as Janino) is used to compile and execute the test code, and the browser driver service in the target platform environment is remotely called to simulate the user's browser operation behavior. After that, the returned results are parsed and a corresponding test report is generated, such as Figure 7 As shown, the test report can be used to determine whether the web project page can be displayed normally in the target platform environment.

[0064] The embodiment of the present invention may also have built-in expected behavior results, and automatically compare them with the expected behavior results after completing the relevant functional point tests, so as to improve the accuracy and reliability of the tests.

[0065] In addition, after clicking on the execution, the tester can see the entire test process by selecting the corresponding terminal device (target terminal device). After opening the page, the browser can see its own clicks and operations, such as Figure 8 shown.

[0066] The embodiment of the present invention defines basic information once and can be reused in different platform environments Figure 2 The test process in .

[0067] In some embodiments, in order to ensure that the first test task can be executed smoothly, 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 is driven successfully, and whether the number of test tasks to be run in the target platform environment is less than the preset number of tasks; if the browser driver service in the target platform environment is driven successfully, and the number of test tasks to be run is less than the preset number of tasks, then determining that the target terminal device meets the execution conditions, compiling and executing the test code, and remotely calling the browser driver service in the target platform environment; if the browser driver service in the target platform environment is not driven successfully, or the number of test tasks to be run is less than the preset number of tasks, then determining that the target terminal device does not meet the execution conditions.

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

[0069] A web testing method provided by an embodiment of the present invention can directly remotely call the driver browser for testing because the driver services of different browsers are deployed on the terminal device. Therefore, it can solve the dilemma that the traditional testing method can only perform UI testing locally. When testing web projects for different platform environments, it can reduce redundant work and repeated operations in the testing process, thereby improving the testing efficiency and improving the adaptation efficiency of web projects to different platform environments. In addition, since the embodiment of the present invention can complete the test for different platform environments, it has good compatibility. Furthermore, the embodiment of the present invention can reduce manual intervention, significantly improve the testing efficiency, shorten the testing cycle, and has good scalability through a highly automated testing process.

[0070] Furthermore, the test process involved in the API automatic testing module is as follows: Fig. 9 As shown, the method includes:

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

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

[0073] The specific architecture logic of the API automatic testing module is as follows Fig.10 Place

[0074] It is shown that before the test, it is necessary to obtain the user operation under the target test scenario, the various step information involved in the user operation, and the request method, request parameters and pre-request setting information corresponding to the various step information; based on the user operation, the various step information, and the request method, request parameters and pre-request setting information corresponding to the various step information, define the second test case under the target test scenario, such as Fig.11 shown. Fig.12 A list of interface test cases is shown.

[0075] For example, for the query test scenario, the user operation is a query operation, and the various step information involved in the query operation includes querying all users, querying by id, paging query, etc. Each step has a corresponding request method (such as GET, POST, DELETE...), query parameters, header parameters, whether there is a pre-request, etc. Then, based on the query operation and the various step information involved, as well as the request method, query parameters, header parameters, whether there is a pre-request, etc. corresponding to each step, the second test case under the query test scenario is generated.

[0076] Step 202: Generate a second test task according to a second test case in the target test scenario.

[0077] According to the embodiment of the present invention, if the second 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 second test task. Fig.13 The task information corresponding to the first test task (interface test task) is shown, including the task name, task type, etc. Fig.14 The generated interface test task list is shown.

[0078] For example, if a website needs to undergo functional testing, the corresponding first test task may include login test cases, query test cases, and the like.

[0079] Step 203: 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.

[0080] According to the embodiment of the present invention, an HTTP request is generated based on the request mode, request parameters and pre-request setting 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 there is a pre-request, an OPTIONS request is first sent to the server to determine whether the original request can be sent safely, and to understand which HTTP methods, request headers and other information can be used, and 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: Fig.15 The embodiment of the present invention completes the functional test of the project by remotely calling the API interface of the domestic environment web project, which can reduce the workload of testers and reduce the test customization cost.

[0084] Furthermore, the test process involved in the visual test module is as follows: Fig.16 As shown, the method includes:

[0085] Step 301: When a tester accesses an automatic test system through a local browser, device information of an optional terminal device is displayed to the tester.

[0086] The device information of the optional terminal device specifically includes: device model, architecture, server IP and installed browser.

[0087] For the embodiment of the present invention, the specific architecture logic of the visual test module is as follows: Fig.17 As shown in the figure, X11vnc, noVNC, and Nginx services are installed on multiple terminal devices, and related services are started. To ensure the security of related services, nginx is used to forward only socket connections, and other ports are not open to the public. At the same time, the terminal information of multiple terminal devices is improved, such as IP, port, password, etc.

[0088] According to the embodiment of the present invention, when the tester accesses the automatic test system through the local browser, the tester needs to select a corresponding terminal device. For this process, the method includes: obtaining the target operating system and the target central processor selected by the tester; based on the target operating system and the target central processor, filtering out the optional terminal device from multiple terminal devices, and displaying the device information of the optional terminal device to the tester, such as Fig.18 shown.

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

[0090] In the embodiment of the present invention, after the tester selects the test terminal device, he can remotely enter the test terminal device and open the page of the test terminal device, such as Fig.19 As shown, the tester can select the corresponding browser on this page to complete the manual test.

[0091] The embodiment of the present invention connects to a remote terminal by means of a local browser, and can use different browsers to perform manual visual testing of related web projects.

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

[0093] The acquisition unit 31 may be used to acquire a first test case of a web project in a target test scenario, wherein the first test case includes a defined user operation.

[0094] The generating unit 32 may be configured to generate a first test task according to a first test case in the target test scenario.

[0095] The generating unit 32 may also be configured to generate a test code corresponding to the first test task.

[0096] The test unit 33 can be used to remotely call the browser driver service in different platform environments based on the test code to simulate the user's operation of the browser and obtain 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.

[0097] In some embodiments, the device further comprises: a deployment unit and a composition 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 the multiple browsers, wherein the operating systems and central processors on different terminal devices are different.

[0099] The composition unit 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 can be specifically used to obtain user operations in the target test scenario, and each step information involved in the user operation; determine the browser operation behavior, element positioning information, screenshot information and assertion information according to the interface information corresponding to the each step information; based on the user operation, the each step information, and the browser operation behavior, element positioning information, screenshot information and assertion information involved in the each step information, define the first test case of the web project in the target test scenario.

[0101] In some embodiments, the generating unit 32 may be specifically configured 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 generating unit 32 may also be specifically configured to generate Selenium code corresponding to the first test task.

[0103] In some embodiments, the testing unit 33 can be specifically used to obtain a selected target terminal device and a target browser; based on the selected target terminal device and the target browser, determine the target platform environment among the multiple 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 operation of the browser, and obtain the test effect of the web project in the target platform environment.

[0104] In some embodiments, the test unit 33 can also be specifically used to determine whether the browser driver service in the target platform environment is driven successfully, and whether the number of test tasks to be run in the target platform environment is less than the preset number of tasks; if the browser driver service in the target platform environment is driven successfully, 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 conditions, compiles and executes the test code, and remotely calls the browser driver service in the target platform environment; if the browser driver service in the target platform environment is not driven successfully, 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 conditions.

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

[0106] The generating unit 32 may also be configured to generate a second test task according to a second test case in the target test scenario.

[0107] The testing 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 can also be specifically used to obtain user operations under the target test scenario, the various step information involved in the user operations, and the request method, request parameters and pre-request setting information corresponding to the various step information; based on the user operations, the various step information, and the request method, request parameters and pre-request setting information corresponding to the various step information, define a second test case under the target test scenario.

[0109] In some embodiments, the device further comprises: a display unit and a visualization unit.

[0110] The display unit may be used to display device information of optional terminal devices to the tester when the tester accesses the automatic test system through a local browser.

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

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

[0113] It should be noted that for other corresponding descriptions of the functional units involved in a web testing device provided in an embodiment of the present invention, reference can be made to Figure 1 , Fig. 9 and Fig.16 The corresponding description in will not be repeated here.

[0114] Based on the above Figure 1 , Fig. 9 and Fig.16 The method shown in the embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned Figure 1 , Fig. 9 and Fig.16 The web testing method shown.

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

[0116] Based on the above Figure 1 , Fig. 9 and Fig.16 The method shown, and Fig. 20 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides an electronic device, which can be a personal computer, a tablet computer, a server, or other network equipment, etc. The device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 , Fig. 9 and Fig.16 The web testing method shown.

[0117] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0118] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.

[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 above-mentioned physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.

[0120] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware.

[0121] Since the embodiment of the present invention deploys driver services of different browsers on the terminal device, the driver browser can be directly called remotely for testing, thereby solving the dilemma that the traditional testing method can only perform UI testing locally. When testing web projects for different platform environments, it can reduce redundant work and repeated operations in the testing process, thereby improving the testing efficiency and the adaptation efficiency of web projects to different platform environments. In addition, since the embodiment of the present invention can complete the test for different platform environments, it has good compatibility. Furthermore, the embodiment of the present invention can reduce manual intervention, significantly improve test efficiency, shorten the test cycle, and has good scalability through a highly automated test process.

[0122] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0123] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A web testing method, characterized in that: include: Obtaining a first test case of a web project in a target test scenario, wherein the first test case includes a defined user operation; Generate a first test task according to a first test case in the target test scenario; Generate test code corresponding to the first test task; Based on the test code, the browser driver service in different platform environments is remotely called to simulate the behavior of the user operating the browser, and the test effect of the web project in the different platform environments is obtained, wherein the different platform environments are composed of different terminal devices and different browsers.

2. The method according to claim 1, characterized in that Before obtaining the first test case of the web project in the target test scenario, the method further includes: Installing multiple browsers on each of the multiple terminal devices, and deploying browser driver services corresponding to the multiple browsers, respectively, wherein the operating systems and central processing units on different terminal devices are different; Based on the multiple terminal devices and the multiple browsers, forming the different platform environments; and / or The obtaining of the first test case of the web project in the target test scenario includes: Obtaining user operations in the target test scenario and information about each step involved in the user operations; Determine browser operation behavior, element location information, screenshot information and assertion information according to the interface information corresponding to each step information; Based on the user operation, the various step information, and the browser operation behavior, element location information, screenshot information, and assertion information involved in the various step information, a first test case for the web project in the target test scenario is defined.

3. The method according to claim 1, characterized in that: The generating a first test task according to the first test case in the target test scenario includes: If the first test case under the target test scenario includes test cases under multiple test scenarios, integrating the test cases under the multiple test scenarios to obtain the first test task; and / or The test code includes Selenium code, and the generating of the test code corresponding to the first test task includes: Generate Selenium code corresponding to the first test task; and / or Based on the test code, remotely calling the browser driver service in different platform environments to simulate the behavior of the user operating the browser and obtain the test effect of the web project in the different platform environments includes: Obtain the selected target terminal device and target browser; Determining a target platform environment among the plurality of different platform environments based on the selected target terminal device and target browser; The test code is compiled and executed, and the browser driver service in the target platform environment is remotely called to simulate the behavior of a user operating a browser, so as to obtain the test effect of the web project in the target platform environment.

4. The method according to claim 3, characterized in that Before compiling and executing the test code and remotely calling the browser driver service in the target platform environment, the method further includes: Determine whether the browser driver service in the target platform environment is driven successfully, 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 the 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, the test code is compiled and executed, and the browser driver service in the target platform environment is remotely called; If the browser driver service in the target platform environment is not driven successfully, or the number of the 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.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtain a second test case under the target test scenario; Generate a second test task according to a second test case under the target test scenario; 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; Obtaining and parsing the return information of the API interface to verify whether the return information of the API interface is correct; and / or The method further comprises: When a tester accesses the automatic test system through a local browser, device information of an optional terminal device is displayed to the tester; When the tester selects a test terminal device from the optional terminal devices based on the device information, the test terminal device is remotely accessed and the interface of the test terminal device is visualized so that the tester can select a corresponding browser for manual testing based on the visualized interface.

6. The method according to claim 5, characterized in that The obtaining of a second test case in a target test scenario includes: Obtaining the user operation under the target test scenario, information about each step involved in the user operation, and request methods, request parameters, and pre-request setting information corresponding to each step information; Based on the user operation, the various step information, and the request mode, request parameters, and pre-request setting information corresponding to the various step information, a second test case under the target test scenario is defined.

7. The method according to claim 5, characterized in that The displaying of device information of the optional terminal device to the tester includes: Obtaining a target operating system and a target central processing unit selected by the tester; Based on the target operating system and the target central processor, the optional terminal device is screened out from a plurality of terminal devices, and device information of the optional terminal device is displayed to the tester.

8. A web testing device, characterized in that: include: An acquisition unit, configured to acquire a first test case of a web project in a target test scenario, wherein the first test case includes a defined user operation; A generating unit, configured to generate a first test task according to a first test case in the target test scenario; The generating unit is further configured to generate a test code corresponding to the first test task; The test unit is used to remotely call the browser driver service in different platform environments based on the test code to simulate the behavior of the user operating the browser and obtain 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.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Cloud connected automated testing

    CN108347358A

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

    CN111190823A

  • Web automation test method and device, electronic equipment and storage medium

    CN112506772A

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

    CN112506785A

  • Visual test execution method and device, electronic equipment and readable storage medium

    CN114911712A