Web UI testing method, device, equipment and storage medium
By establishing long links between the server and the client, dynamically obtaining and executing test tasks, the problem that existing testing methods cannot test multiple environments is solved, and a more comprehensive Web UI testing is achieved.
Patent Information
- Application Number
- CN202010975806.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-16
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-09-16
AI Technical Summary
Existing testing methods cannot test multiple environments, resulting in greater limitations.
Through the server, multiple test tasks are acquired according to the test plan and configured multiple execution environments, and task information is sent to clients that have long links with the server. After the client receives the task information, it downloads the script to be run, compiles and builds, generates configuration files and execution files, tests the browser based on the environment information, obtains the test results and sends them to the server.
The testing of multiple environments is implemented, breaking the limitations of existing testing methods and being able to more comprehensively evaluate the performance and functionality of the Web UI.
Smart Images

Figure CN113760704B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of software automatic testing, and in particular to a Web UI testing method, apparatus, device and storage medium. Background Art
[0002] With the rapid development of the IT industry, software products have played an increasingly important role in human life and have a profound impact on people's daily lives. The World Wide Web (Web) is a network service built on the Internet, which provides a graphical, easy-to-access, and intuitive interface for viewers to search and browse information on the Internet. Since a large number of large-scale application systems are developed based on the Web, not only the requirements for Web development are increased, but also higher requirements for Web application testing are put forward.
[0003] In the prior art, the method for testing Web applications mainly uses Jenkins to implement remote and scheduled automated testing, and after the execution is completed, the automated testing results and test reports are viewed on Jenkins.
[0004] However, existing testing methods cannot test multiple environments and have great limitations. Summary of the invention
[0005] The present application provides a Web UI testing method, apparatus, device and storage medium, which are used to solve the problem that the existing testing methods cannot test multiple environments and have great limitations.
[0006] In a first aspect, an embodiment of the present application provides a Web UI testing method, which is applied to a server, and the method includes:
[0007] According to the test plan and multiple execution environments configured, multiple test tasks are obtained, each test task corresponds to a different test environment;
[0008] According to the multiple test tasks, task information is sent to multiple clients that have established long links with the server respectively, wherein the task information received by each client includes use case information, version information, and environment information of the corresponding test task;
[0009] The test results returned by the multiple clients are received, wherein the test result returned by each client includes an execution result and an execution log of the test task executed by the client.
[0010] In a specific implementation, the test plan includes a test type, at least one test case to be tested, a version of each test case, a test time of each test case, and a test type, and acquiring multiple test tasks according to the test plan and the configured multiple execution environments includes:
[0011] For each execution environment, determine whether the test plan meets the pre-configured task time or continuous integration CI execution condition according to the current time and the test time of each test case in the test plan;
[0012] If the test plan meets the task time or CI execution condition, the test task for automated testing corresponding to each test case is determined according to the execution environment, the test type and the version of each test case.
[0013] In a specific implementation, the method further includes:
[0014] In response to the user's operation, the multiple execution environments are configured, and the execution environments include at least two of the following: an online environment, a pre-release environment, and a test environment.
[0015] In a specific implementation, the method further includes:
[0016] The test tasks corresponding to each test case are cached through Redis.
[0017] In a specific implementation, the test type includes at least one of the following: full regression test, emergency full regression test, module test, stability test, and compatibility test.
[0018] In a specific implementation, the method further includes:
[0019] Receiving a long link establishment request sent by the client;
[0020] A long link is established with the client according to the long link establishment request.
[0021] In a specific implementation, the method further includes:
[0022] Analyze and process the test results returned by the multiple clients to obtain a visual test report;
[0023] The visual test report is displayed.
[0024] In a second aspect, an embodiment of the present application provides a Web UI testing method, which is applied to a client, and the method includes:
[0025] Obtaining task information of the test task issued by the server, wherein the task information includes use case information, version information and environment information of the test task;
[0026] According to the use case information and the version information, download the script to be run, compile and build the script to be run, generate a configuration file and an execution file, and the execution file includes the execution script and script data;
[0027] Testing the browser according to the environment information, the configuration file and the execution file to obtain a test result, wherein the test result includes an execution result and an execution log of the test task;
[0028] The test result is sent to the server.
[0029] In a specific implementation, the testing of the browser according to the environment information, the configuration file and the execution file to obtain the test result includes:
[0030] Loading the configuration file and the execution file into a driver, parsing the execution script to drive the browser;
[0031] The script data is sent to the browser so that the browser runs the script data according to the environment information to obtain the test result.
[0032] In a specific implementation, the step of obtaining task information of a test task sent by a server includes:
[0033] Receive the task information of the test task sent by the server that establishes a long link with the client.
[0034] In a specific implementation, the method further includes:
[0035] In response to the operation of starting the automated testing service, a long link establishment request is sent to the service.
[0036] In a specific implementation, when the long link with the server is disconnected or re-establishing the long link fails, obtaining the task information of the test task sent by the server includes:
[0037] The task information of the test task is obtained from the Redis of the server.
[0038] In a third aspect, an embodiment of the present application provides a Web UI testing device, including:
[0039] An acquisition module is used to acquire multiple test tasks according to the test plan and multiple execution environments configured, each test task corresponding to a different test environment;
[0040] A sending module, used for sending task information to multiple clients that have established long links with the server respectively according to the multiple test tasks, wherein the task information received by each client includes use case information, version information, and environment information of the corresponding test task;
[0041] The receiving module is used to receive the test results returned by the multiple clients, and the test results returned by each client include the execution result and execution log of the test task executed by the client.
[0042] In a specific implementation, the acquisition module is specifically used to determine, for each execution environment, whether the test plan meets the pre-configured task time or CI execution condition based on the current time and the test time of each test case in the test plan; if the test plan meets the task time or CI execution condition, then determine the test task for automated testing corresponding to each test case based on the execution environment, the test type and the version of each test case.
[0043] In a specific implementation, the Web UI testing device further includes:
[0044] The processing module is used to configure the multiple execution environments in response to user operations, and the execution environments include at least two of the following: an online environment, a pre-release environment, and a test environment.
[0045] In a specific implementation, the receiving module may also be used to cache the test task corresponding to each test case through Redis.
[0046] Optionally, the test type includes at least one of the following: full regression test, emergency full regression test, module test, stability test, and compatibility test.
[0047] In a specific implementation, the receiving module may also be used to receive a long link establishment request sent by the client;
[0048] The processing module may also be configured to establish a long link with the client according to the long link establishment request.
[0049] In a specific implementation, the Web UI testing device further includes:
[0050] A display module, used for displaying the visual test report;
[0051] The processing module may also be used to analyze and process the test results returned by the multiple clients to obtain a visual test report.
[0052] In a fourth aspect, an embodiment of the present application provides a Web UI testing device, including:
[0053] An acquisition module is used to acquire task information of a test task issued by a server, wherein the task information includes use case information, version information and environment information of the test task;
[0054] A processing module, used for downloading the script to be run according to the use case information and the version information, and compiling and building the script to be run to generate a configuration file and an execution file, wherein the execution file includes the execution script and script data;
[0055] The processing module is also used to test the browser according to the environment information, the configuration file and the execution file to obtain a test result, wherein the test result includes an execution result and an execution log of the test task;
[0056] A sending module is used to send the test result to the server.
[0057] In a specific implementation, the processing module is specifically used to load the configuration file and the execution file into the driver, parse the execution script to drive the browser; send the script data to the browser so that the browser runs the script data according to the environment information to obtain the test result.
[0058] In a specific implementation, the acquisition module is specifically used to receive the task information of the test task sent by the server that establishes a long link with the client.
[0059] In a specific implementation, the acquisition module is specifically used to obtain the task information of the test task from the Redis of the server.
[0060] In response to the operation of starting the automated testing service, a long link establishment request is sent to the service.
[0061] In a specific implementation, the acquisition module is also used to obtain the task information of the test task from the Redis of the server.
[0062] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein when the processor executes the computer program instructions, the Web UI testing method provided in any one of the embodiments of the first aspect or the second aspect is implemented.
[0063] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the testing method of the Web UI provided in any implementation of the first aspect or the second aspect is implemented.
[0064] The Web UI testing method, apparatus, device, and storage medium provided in the embodiments of the present application obtain test tasks through the server according to the test plan and the configured execution environment, and send task information to the client that establishes a long link with the server. The client obtains the task information of the test task issued by the server, downloads the script to be run according to the use case information and version information, and compiles and builds the script to be run to generate a configuration file and an execution file. The browser is tested according to the environment information, configuration file, and execution file, and the test results are obtained and sent to the server. A long link is established between the server and the server and task information is sent to achieve purposeful automated testing of the browser. The problem that the existing testing method cannot test multiple environments and has great limitations is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0066] Figure 2 A flowchart of a first embodiment of a Web UI testing method provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of a user interface provided in an embodiment of the present application;
[0068] Figure 4 A diagram of the main functional architecture of a server provided in an embodiment of the present application;
[0069] Figure 5 A schematic diagram of a client interface provided in an embodiment of the present application;
[0070] Figure 6 A client main function architecture diagram provided for an embodiment of the present application;
[0071] Figure 7 A schematic diagram of a report details interface provided in an embodiment of the present application;
[0072] Figure 8 A flowchart of another embodiment of the Web UI testing method provided in the embodiment of the present application;
[0073] Fig. 9 A schematic diagram of the structure of a first embodiment of a Web UI testing device provided in an embodiment of the present application;
[0074] Fig.10 A schematic diagram of the structure of a second embodiment of a Web UI testing device provided in an embodiment of the present application;
[0075] Fig.11 A schematic diagram of the structure of a third embodiment of a Web UI testing device provided in an embodiment of the present application;
[0076] Fig.12 A schematic diagram of the structure of a fourth embodiment of a Web UI testing device provided in an embodiment of the present application;
[0077] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0079] With the rapid development of the Internet, the software market is booming, and endless software tools are being developed. Software is widely used in various industries. Whether it is to modify the software when errors are found or to add new modules during the inheritance or maintenance stage, it may cause problems to the software. Software testing, as an important means to improve software quality, has a special strategic position. Whenever the software changes, we need to retest the existing functions to determine whether the modification has achieved the intended purpose and check whether the modification has damaged the original normal function. At the same time, new test cases need to be added to test new or modified functions. In recent years, with the development of software testing technology, automated testing has gradually become the mainstream trend of software testing technology development.
[0080] In the prior art, the method of testing Web applications mainly uses Jenkins to implement remote and scheduled automated testing. After the execution is completed, the automated test results and test reports can be viewed on Jenkins. The basic workflow of Jenkins is as follows: First, the developer submits the code for update, and Jenkins obtains the latest code by monitoring the source code management (SCM) tool. Then, Jenkins completes the code building (static checking, compilation, unit testing), packaging, deployment, and integration testing processes in sequence according to the created test tasks and the written execution scripts, and finally sends the results of the build including the results of the automated testing to the relevant personnel via email. However, this testing method cannot test multiple environments and has great limitations.
[0081] In response to the above problems, the embodiments of the present application provide a Web UI testing method, device, and storage medium, which obtains the test task through the server according to the test plan and the configured execution environment, and sends the task information to the client that establishes a long link with the server. The client obtains the task information of the test task issued by the server, downloads the script to be run according to the use case information and version information, and compiles and builds the script to be run to generate a configuration file and an execution file. The browser is tested according to the environmental information, configuration file, and execution file, and the test results are obtained and sent to the server. By establishing a long link between the server and the server and sending the task information, a purposeful automated test of the browser is realized. The problem that the existing testing method cannot test multiple environments and has great limitations is solved.
[0082] The technical solution of the present application is described in detail below through specific embodiments.
[0083] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0084] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the electronic device can be implemented as server A or terminal device B. Server 100 displays a user interface to the user, so that the user can select a test type by operating the user interface, obtain a test task and send it to terminal device B. Terminal device B displays a client interface to the user, so that the user can choose to start or terminate the service by operating the client interface. When the service is started, the terminal device is in a working state, and the browser is tested by receiving the task information of the test task sent by the server, and the test results are sent to server A for storage. Optionally, server A can be any device with human-computer interaction capabilities, such as a mobile phone, a computer, a tablet computer, a smart wearable, etc.
[0085] Figure 2 A flowchart of the first embodiment of the Web UI testing method provided in the present application is shown in FIG. Figure 2 As shown, based on the above Figure 1 In the application scenario shown, the Web UI testing method may include the following steps:
[0086] S101: Acquire multiple test tasks according to the test plan and multiple configured execution environments, where each test task corresponds to a different test environment.
[0087] The Web UI testing method provided in the embodiment of the present application needs to provide an operation interface for users, and in order to store and analyze the test results, a background service platform is also required so that users can access the service platform through a browser or application installed on the server.
[0088] In this step, the server maintains the already written automated test scripts through the use case management function. Among them, the use case management function mainly includes: script maintenance, module maintenance, and use case maintenance. Use case is a technology that obtains requirements through user usage scenarios. Each use case provides one or more scenarios, which illustrate how the system interacts with users or other systems, that is, who can do what with the system, so as to obtain a clear business goal. In the process of using use cases to test the browser, when an error occurs, the script in the use case needs to be modified. When it is necessary to add or delete certain functions in the use case, the script in the use case also needs to be modified. In order to facilitate the user to continue to use the use case next time, the use case will be stored after editing and modification, and users can maintain different use cases according to their different needs.
[0089] When the user needs to test the browser, the user can select the test type control on the user interface displayed by the server according to the test requirements. For example, the user clicks the test type control on the user interface. After detecting that the test type control is clicked, the server formulates a test plan and configures multiple execution environments according to the user's needs, obtains multiple corresponding test tasks, and sends the task information to one or more terminal devices through the browser or application.
[0090] The terminal device obtains the task information sent by the server.
[0091] Figure 3 A user interface diagram provided in an embodiment of the present application, such as Figure 3As shown, in the implementation of the solution on the server (that is, the service end), the server provides the user with a user interface 01, so that the user can select the test type by operating the user interface. The user interface 01 includes test type controls: [full regression test] control, [emergency full regression test] control, [module test] control, [stability test] control, and [compatibility test] control. In response to the user selecting the test type control in the user interface 01, a corresponding test plan is formulated and the execution environment is configured, and the corresponding test task is obtained and sent to the terminal device. Among them, regression testing refers to retesting after modifying the old code to confirm whether new errors have been introduced or errors have been caused in other codes, which will greatly reduce the cost of system testing, maintenance and upgrades. Full regression testing refers to the detection of all system functions to check whether there are errors; emergency full regression testing refers to modifying the problems found in the full regression test and then conducting targeted testing again; module testing refers to the test of the smallest granularity with obvious functions of the system, which is a test of a module to check whether the module has errors according to the functional description of the module; stability testing refers to stress testing of software programs, central processing units or computer components (such as graphics cards). Its purpose is to exert maximum stress on the components to determine their performance under stress and determine performance parameters; compatibility testing refers to checking whether software can interact and share information correctly.
[0092] Figure 4 This is a diagram of the main functional architecture of a server provided in an embodiment of the present application. Figure 4 As shown, in the implementation of the server (that is, the service end), the main functional architecture of this solution is mainly divided into the business scenario layer, the business application layer, and the business service layer. The business scenario layer mainly meets the needs of improving the execution efficiency of automated testing in full regression testing, emergency full regression testing, module testing, stability testing, compatibility testing, etc. during daily testing; the business application layer is mainly used to manage use cases, and when creating test plans and test tasks, it is necessary to specify the version of automated test cases and configure the environment to be executed. When the long link between the client and the server is disconnected and fails, the client will retry. If the retry fails to establish a long link, the client will actively pull the automated test execution task through the application programming interface (API) provided by the server. When multiple clients call the API at the same time to obtain scheduling tasks, the server uses the REDIS cache mechanism to ensure that the automated test tasks obtained by each client are not repeated, and complete the testing of the browser under different test environments; the business service layer is mainly used to configure scheduled execution tasks and continuous integration (CI) automated execution tasks.
[0093] In a specific implementation, the test task includes a test type, at least one test case to be tested, the version of each test case, the test time of each test case and the test type. In detail, the user clicks the test type control on the user interface according to the test requirements, sets the start time and end time of the test on this basis, confirms the versions of multiple test cases to be used according to the specific purpose of the test, and configures multiple execution environments to obtain multiple test tasks. A test case refers to a description of a test task for a specific software product, reflecting the test plan, method, technology and strategy. Its content includes test objectives, input data, test steps, expected results, test scripts, etc., and finally forms a document. The execution environment includes an online environment, a pre-release environment and a test environment. Among them, the online environment refers to the release environment, an environment accessed by real users, which requires no loopholes and cannot be released frequently; the test environment refers to an environment simulated by testers using some tools and data that is close to the real user use environment. The purpose of the test environment is to make the test results more real and effective; the pre-release environment refers to the transition from the test environment to the online environment. The test environment may be subject to some restrictions. If some processes or data are not tested, they can be verified in the pre-release environment to ensure the quality of product launch.
[0094] Optionally, the frequency of the test time can be set to only once, every day, or a custom frequency, which is not restricted by this solution.
[0095] After formulating the test plan, compare the current time with the test time. If the time is inconsistent, the test plan will not take effect and will be compared again after a period of time. For example, the period of time can be a fixed value, such as a comparison every five minutes, or it can be a non-fixed value, such as the first comparison is every five minutes, and each subsequent interval is 30 seconds less than the previous interval. This application does not require this. If the time comparison is consistent, check whether the project line is idle. If the project line is idle at this time and meets the conditions for scheduled execution of tasks and CI automated execution of tasks, create an automated test task based on the execution environment, test type, and version of each test case.
[0096] S102: According to the multiple test tasks, task information is sent to the client that has established a long link with the server respectively.
[0097] In this step, after the server obtains multiple test tasks, it needs to send the multiple test tasks to one or more clients respectively so that the clients can test the browser.
[0098] In order to achieve the transmission of task information or other data interaction through long links, the client first needs to establish a long link with the server. Specifically, when the client needs to test the browser, it first needs to send a long link to the server and request to establish a connection with the server in order to obtain the test task. When the server receives the connection request sent by the client, it accepts the request and establishes a connection with the server, so as to send the test task to the client requesting the connection through the long link.
[0099] There are many ways to establish a long link between the client and the server, for example, (Asynchronous Javascript And XML, AJAX) polling, long polling, iframe long link, WebSocket, etc. This solution does not limit this.
[0100] Figure 5 A schematic diagram of a client interface provided in an embodiment of the present application. Figure 5 As shown, the client interface 02 includes the [Start Service] control, the [Terminate Service] control, and the [Return] control. When the user needs to establish a connection with the client, he needs to click the [Start Service] control so that the client can run normally and record the operation in the record window below. For example, when the service is clicked at 11:26:36 on June 29, 2020, the client can run normally, and the record window will display the connection record: 2020-06-29 11:26:36 Switch to WEB project service.
[0101] S103: Obtain task information of the test task sent by the server.
[0102] In this step, the client needs to obtain the task information of the test task sent by the server in order to test the browser to be tested. Specifically, after the client establishes a long link with the server, the server sends the test task to the client through the long link, and the client obtains the test task through the long link to test the browser. Among them, the task information includes the use case information, version information and environment information of the test task.
[0103] When the long connection between the client and the server is disconnected, the client will resend a long connection request to the server. If the retry to establish the long connection is successful, the server will send the task information to the client as usual. If the re-establishment of the long connection fails, the client will actively pull the automated test execution task through the API provided by the server. Specifically, when the server and the client cannot connect normally and the client cannot obtain the task information in the server, it can access the API provided by the client, access the task information on the server through the program interface, and pull the automated test execution task.
[0104] When multiple clients call the API at the same time to obtain automated test execution tasks, in order to ensure that the automated test tasks obtained by each client are not repeated, the Remote Dictionary Server (REDIS) caching mechanism is used to cache the automated test tasks and complete the testing of the browser in different test environments.
[0105] Figure 6 This is a client main function architecture diagram provided in the embodiment of the present application. Figure 6 As shown in the figure, the main functional architecture of the client mainly includes business applications and business service center. Business applications mainly include starting services, terminating services, Mac, and Windows; the business service center mainly includes task analysis and environment initialization, where task analysis includes obtaining tasks, downloading resources, task analysis, and modifying Host; environment initialization includes checking ports, building packages, compiling projects, starting services, executing scripts, and log monitoring.
[0106] S104: Download the script to be run according to the use case information and the version information, compile and build the script to be run, and generate a configuration file and an execution file.
[0107] In this step, the client analyzes the acquired execution tasks and configuration data to obtain the use case version used in this test. According to the use case version, the client selects and downloads the corresponding script to be run and the release package from the script library, compiles them, and generates a binary language that can be recognized by the computer to facilitate the computer to read the script content. Then, it is constructed to generate configuration files and execution files.
[0108] Optionally, the execution file includes an execution script and script data.
[0109] S105: Testing the browser according to the environment information, the configuration file and the execution file to obtain a test result.
[0110] In this step, the browser is tested according to the configuration file and the execution file generated. Specifically, the configuration file and the execution file are loaded into the driver, and the driver parses and executes the script through the API, drives the browser and sends the script data to the browser.
[0111] The browser receives the script data and tests the browser according to the script data information. For example, taking module testing as an example, the browser receives the script data information, and performs module testing on the corresponding module of the browser according to the script data information to test whether the function of the corresponding module of the browser is normal, and generates test results. The status of the test results includes success, failure, and skip. Specifically, when a certain function fails to run, the following use cases are use cases that depend on this function. If the first step fails, there is no need to execute the following use cases, and they can be skipped directly.
[0112] Optionally, the test result includes the execution result and execution log of the test task. The execution log can help users view historical records and facilitate statistical sorting of historical data.
[0113] S106: Send the test result to the server.
[0114] In this step, after the client obtains the test result of the browser, it needs to transmit the test result to the server for storage.
[0115] Optionally, the test result includes the execution result and execution log of the test task.
[0116] S107: The server receives the test results sent by the multiple clients.
[0117] In this step, the server receives the test results sent by multiple clients, analyzes and processes the execution results, extracts the corresponding parameters according to the pre-set categories, such as order number, order time, reason for return, etc., and generates the corresponding visual test report, which is convenient for users to intuitively obtain the corresponding parameter information and facilitate the subsequent statistics of automated test data. The visual test report is divided into all results, successful results, failed results, and skipped results according to the result type, and displayed on the test result interface according to different result types, and the use case information of this test is synchronized. At the same time, the server monitors and aggregates the execution logs in the test results, where the execution logs include execution steps, execution time, execution results, execution use cases, etc. After this test plan, you can extract the execution logs of failed automated executions, view the specific information during the execution process, and troubleshoot the failure reasons of the failed use cases, so as to modify the use cases according to the failure reasons.
[0118] Figure 7 A schematic diagram of a report details interface provided in an embodiment of the present application, such as Figure 7As shown, in the implementation of this solution on the server (i.e., the service end), the report details interface includes the [All] control, the [Success] control, the [Failure] control, and the [Skip] control. When the [All] control is clicked, the results of all tests will be displayed on the interface, and the color will be displayed before the test results. For example, blue represents success, red represents failure, and yellow represents skip. This solution does not impose specific restrictions on this. Select the test list you want to view in the test result list on the left to view the specific test results.
[0119] For example, taking the ordinary business of canceling an order as the main focus, when you click on the test result list on the left and select the test result you want to view, the purchase details page of this order and the merchant backend page will be displayed in the display box on the right. The detailed information of this order will be displayed in the merchant backend interface, such as the order number, customer account number, customer name and other information.
[0120] Figure 8 A flowchart of another embodiment of the Web UI testing method provided in the present application embodiment. Figure 8 As shown in the figure, the client first establishes a long link to the platform, and the platform sends the execution task and configuration data to the client through the long link. After receiving the execution task and configuration data, the client downloads the script and release package from the script library, compiles and builds the configuration file and execution file, synchronizes the task status to the server, loads the configuration file and execution file into the driver, parses the execution script, and drives the browser to test. After the browser test is completed, the test results are loaded into the script information through the driver and sent by the client to the platform for storage.
[0121] In the embodiment of the present application, the server obtains the test task according to the test plan and the configured execution environment, and sends the task information to the client that has established a long link with the server. The client obtains the task information of the test task issued by the server, downloads the script to be run according to the use case information and version information, and compiles and builds the script to be run to generate a configuration file and an execution file. The browser is tested according to the environment information, the configuration file and the execution file, and the test results are obtained and sent to the server. The existing testing method can solve the problem that it cannot test multiple environments and has large limitations.
[0122] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0123] Fig. 9 This is a structural diagram of a first embodiment of a Web UI testing device provided in an embodiment of the present application, as shown in FIG. Fig. 9 As shown, the Web UI testing device 10 includes:
[0124] An acquisition module 11 is used to acquire multiple test tasks according to the test plan and the configured multiple execution environments, each test task corresponding to a different test environment;
[0125] A sending module 12 is used to send task information to multiple clients that have established long links with the server according to the multiple test tasks, and the task information received by each client includes use case information, version information, and environment information of the corresponding test task;
[0126] The receiving module 13 is used to receive the test results returned by the multiple clients, and the test result returned by each client includes the execution result and execution log of the test task executed by the client.
[0127] In one possible design, the acquisition module 11 is specifically used to determine, for each execution environment, whether the test plan meets the pre-configured task time or CI execution condition based on the current time and the test time of each test case in the test plan; if the test plan meets the task time or CI execution condition, then determine the test task for automated testing corresponding to each test case based on the execution environment, the test type and the version of each test case.
[0128] In a possible design, the receiving module 13 can also be used to receive long link establishment requests sent by the multiple clients.
[0129] Fig.10 A schematic diagram of the structure of the second embodiment of the Web UI testing device provided in the embodiment of the present application is shown in FIG. Fig.10 As shown, based on the above embodiment, the Web UI testing device 10 includes:
[0130] The processing module 14 is used to configure the multiple execution environments in response to the user's operation, and the execution environments include at least two of the following: an online environment, a pre-release environment, and a test environment.
[0131] In a possible design, the processing module 14 can also be used to cache the test task corresponding to each test case through Redis.
[0132] Optionally, the test type includes at least one of the following: full regression test, emergency full regression test, module test, stability test, and compatibility test.
[0133] The processing module 14 may also be configured to establish a long link with the client according to the long link establishment request.
[0134] Fig.11 This is a schematic diagram of the structure of the third embodiment of the Web UI testing device provided in the embodiment of the present application, as shown in FIG. Fig.11 As shown, based on the above embodiment, the Web UI testing device 10 includes:
[0135] Display module 15, used to display the visual test report;
[0136] The processing module 14 can also be used to analyze and process the test results returned by the multiple clients to obtain a visual test report.
[0137] The Web UI testing device 10 provided in the embodiment of the present application is used to execute the technical solution on the server side in the aforementioned embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0138] Fig.12 This is a structural diagram of a fourth embodiment of a Web UI testing device provided in an embodiment of the present application, as shown in FIG. Fig.12 As shown, based on the above embodiment, the Web UI testing device 20 includes:
[0139] The acquisition module 21 is used to acquire the task information of the test task issued by the server, wherein the task information includes the use case information, version information and environment information of the test task;
[0140] The processing module 22 is used to download the script to be run according to the use case information and the version information, and compile and build the script to be run to generate a configuration file and an execution file, wherein the execution file includes the execution script and script data;
[0141] The processing module 22 is also used to test the browser according to the environment information, the configuration file and the execution file to obtain a test result, wherein the test result includes an execution result and an execution log of the test task;
[0142] The sending module 23 is used to send the test result to the server.
[0143] In a possible design, the processing module 22 is specifically used to load the configuration file and the execution file into the driver, parse the execution script to drive the browser; send the script data to the browser so that the browser runs the script data according to the environment information to obtain the test result.
[0144] In a possible design, the acquisition module 21 is specifically used to receive the task information of the test task sent by the server that establishes a long link with the client.
[0145] In a possible design, the acquisition module 21 is specifically used to obtain the task information of the test task from the Redis of the server.
[0146] In response to the operation of starting the automated testing service, a long link establishment request is sent to the service.
[0147] In a possible design, the acquisition module 21 is also used to obtain the task information of the test task from the Redis of the server.
[0148] The Web UI testing device 20 provided in the embodiment of the present application is used to execute the technical solution on the client side in the aforementioned embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0149] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the determination module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0150] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0151] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state hard disk solid state disk, SSD)) and the like.
[0152] Fig.13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.13 As shown, the electronic device 100 may include: a processor 110, a memory 120, and computer program instructions stored in the memory and executable on the processor, wherein the memory 120 is used to store computer executable instructions.
[0153] The system bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk storage.
[0154] The processor 110 mentioned above can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0155] Optionally, an embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-readable storage medium is run on a computer, the computer executes the method of the above embodiment.
[0156] An embodiment of the present application also provides a computer program product, which includes a computer program. The computer program is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When the at least one processor executes the computer program, the method of the above embodiment can be implemented.
[0157] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0158] It is to be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not intended to limit the scope of the embodiments of the present application. In the embodiments of the present application, the size of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A Web UI testing method, characterized in that: Applied to a server, the method comprises: According to the test plan and multiple execution environments configured, multiple test tasks are obtained, each test task corresponds to a different test environment; According to the multiple test tasks, task information is sent to multiple clients that have established long links with the server respectively, and the task information received by each client includes use case information, version information, and environment information of the corresponding test task, so that the client downloads the script to be run according to the use case information and the version information, compiles and builds the script to be run, generates a configuration file and an execution file, and tests the browser according to the environment information, the configuration file, and the execution file to obtain a test result; Receive the test results returned by the multiple clients, where the test result returned by each client includes an execution result and an execution log of the test task executed by the client; The test plan includes a test type, at least one test case to be tested, a version of each test case, and a test time of each test case. The method of obtaining multiple test tasks according to the test plan and the configured multiple execution environments includes: For each execution environment, determine whether the test plan meets the pre-configured task time or continuous integration CI execution condition according to the current time and the test time of each test case in the test plan; If the test plan meets the task time or CI execution condition, then determine the test task for automated testing corresponding to each test case according to the execution environment, the test type and the version of each test case; The method further comprises: The test tasks corresponding to each test case are cached through Redis.
2. The method according to claim 1, characterized in that The method further comprises: In response to the user's operation, the multiple execution environments are configured, and the execution environments include at least two of the following: an online environment, a pre-release environment, and a test environment.
3. The method according to claim 1 or 2, characterized in that: The test type includes at least one of the following: full regression test, emergency full regression test, module test, stability test, and compatibility test.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: Receiving a long link establishment request sent by the client; A long link is established with the client according to the long link establishment request.
5. The method according to claim 1 or 2, characterized in that: The method further comprises: Analyze and process the test results returned by the multiple clients to obtain a visual test report; The visual test report is displayed.
6. A Web UI testing method, characterized in that: Applied to a client, the method comprises: Obtain task information of the test task issued by the server, the task information including the test case information, version information and environment information of the test task; the test task is determined by the server for each execution environment, according to the current time and the test time of each test case in the test plan, after determining that the test plan meets the pre-configured task time or continuous integration CI execution condition, and when the test plan meets the task time or CI execution condition, according to the execution environment, test type and version of each test case; wherein the test task corresponding to each test case is cached through Redis; According to the use case information and the version information, download the script to be run, compile and build the script to be run, generate a configuration file and an execution file, and the execution file includes the execution script and script data; Testing the browser according to the environment information, the configuration file and the execution file to obtain a test result, wherein the test result includes an execution result and an execution log of the test task; Sending the test result to the server; The step of testing the browser according to the environment information, the configuration file and the execution file to obtain a test result includes: Loading the configuration file and the execution file into a driver, parsing the execution script to drive the browser; The script data is sent to the browser so that the browser runs the script data according to the environment information to obtain the test result.
7. The method according to claim 6, characterized in that The step of obtaining the task information of the test task sent by the server includes: Receive the task information of the test task sent by the server that establishes a long link with the client.
8. The method according to claim 7, characterized in that The method further comprises: In response to the operation of starting the automated testing service, a long link establishment request is sent to the server.
9. The method according to claim 7 or 8, characterized in that: When the long link with the server is disconnected or re-establishing the long link fails, the task information of the test task sent by the server is obtained, including: The task information of the test task is obtained from the Redis of the server.
10. A Web UI testing device, characterized in that: include: An acquisition module is used to acquire multiple test tasks according to the test plan and multiple execution environments configured, each test task corresponding to a different test environment; A sending module is used to send task information to multiple clients that have established long links with the server according to the multiple test tasks, respectively. The task information received by each client includes the use case information, version information, and environment information of the corresponding test task, so that the client downloads the script to be run according to the use case information and the version information, compiles and builds the script to be run, generates a configuration file and an execution file, and tests the browser according to the environment information, the configuration file, and the execution file to obtain a test result; A receiving module, used to receive the test results returned by the multiple clients, wherein the test result returned by each client includes an execution result and an execution log of the test task executed by the client; The test plan includes a test type, at least one test case to be tested, a version of each test case, a test time of each test case and a test type. The acquisition module is specifically used to: For each execution environment, determine whether the test plan meets the pre-configured task time or continuous integration CI execution condition according to the current time and the test time of each test case in the test plan; If the test plan meets the task time or CI execution condition, then determine the test task for automated testing corresponding to each test case according to the execution environment, the test type and the version of each test case; The processing module is also used to: The test tasks corresponding to each test case are cached through Redis.
11. A Web UI testing device, characterized in that: include: An acquisition module is used to acquire task information of a test task issued by a server, wherein the task information includes use case information, version information and environment information of the test task; The test task is determined by the server for each execution environment, according to the current time and the test time of each test case in the test plan, after determining that the test plan meets the pre-configured task time or continuous integration CI execution condition, and when the test plan meets the task time or CI execution condition, according to the execution environment, the test type and the version of each test case; wherein the test task corresponding to each test case is cached through Redis; A processing module, used for downloading the script to be run according to the use case information and the version information, and compiling and building the script to be run to generate a configuration file and an execution file, wherein the execution file includes the execution script and script data; The processing module is also used to test the browser according to the environment information, the configuration file and the execution file to obtain a test result, wherein the test result includes an execution result and an execution log of the test task; A sending module, used for sending the test result to the server; The processing module is also used to load the configuration file and the execution file into the driver, parse the execution script to drive the browser; send the script data to the browser so that the browser runs the script data according to the environment information to obtain the test result.
12. An electronic device comprising: A processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor implements the Web UI testing method as described in any one of claims 1 to 9 when executing the computer program instructions.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the Web UI testing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Visual automatic test method and system
CN104834595A
Application test method and apparatus
CN107305528A
Testing method and device, computer-readable storage medium and computer equipment
CN107832206A