Automatic testing method and device, computer equipment and storage medium
By simulating user operations through automated testing tools, combined with browser control and data packet sending and receiving, the combination of UI interface and interface automated testing is achieved, which solves the problem that traditional technology cannot be applied to complex test scenarios and improves testing efficiency and scope of application.
Patent Information
- Application Number
- CN202410799855.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-10-01
AI Technical Summary
Traditional software dynamic testing methods cannot be applied to complex testing scenarios, especially when the positions of page elements are dynamic, automated testing cannot be achieved, and manual intervention is required, affecting testing efficiency.
Provide an automated testing method that simulates user operations through automated testing tools, combined with browser control and data packet sending and receiving, to achieve the combination of UI interface automated testing and interface automated testing, and can conduct automated testing in scenarios where page elements cannot be located.
It realizes automated testing of complex test scenarios, broadens the applicable scope of testing, improves testing efficiency, and reduces test complexity and maintenance costs.
Smart Images

Figure CN118733452A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automated testing technology, and in particular to an automated testing method, apparatus, computer equipment and storage medium. Background Art
[0002] Software testing is a process of evaluating software quality that involves running the software under controlled conditions to check whether it meets the expected requirements, specifications, and standards. The purpose of software testing is to discover errors, defects, or vulnerabilities in the software and provide information about the software's functionality, performance, reliability, and security. The software testing process includes dynamic testing, which means running the software under specific conditions to check whether it meets the expected output and functional requirements.
[0003] In traditional technical solutions, when performing dynamic testing of software, the software page testing is generally implemented by controlling the browser. However, this method is not applicable to some more complex testing scenarios. For example, when the position of page elements is dynamic, testing cannot be implemented, or manual intervention is required, affecting test efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide an automated testing method, device, computer equipment and storage medium that can take into account both UI automated testing and interface automated testing in order to address the above technical problems.
[0005] In a first aspect, an embodiment of the present disclosure provides an automated testing method, comprising:
[0006] Calling an automated testing tool to simulate a user operating the software under test, so as to send a data request to the server of the software under test, wherein the automated testing tool is used to locate the object to be operated on the page of the software under test and perform a corresponding operation, and / or to carry the object to be operated in the data request and send it to the server of the software under test;
[0007] Monitor the results of the server of the software under test responding to the data request feedback;
[0008] Generate test results for the software under test based on the monitoring results.
[0009] In some embodiments, the automated testing tool includes a first object class and a second object class, the first object class is used to operate a browser, and the second object class is used to send a data packet, and the automated testing tool simulates a user operating the software to be tested to send a data request to a server of the software to be tested, including:
[0010] Locating the object to be operated on the page of the software to be tested through the first object class and performing corresponding operations to send a data request to the server of the software to be tested; and / or
[0011] The object to be operated is carried in the data request through the second object class and sent to the server of the software to be tested, so as to send the data request to the server of the software to be tested.
[0012] In some embodiments, the automated testing method further comprises:
[0013] Generate login information through the first object class when logging into the user account for the first time;
[0014] Sharing login information via a second object class;
[0015] The object to be operated is carried in the data request through the second object class and sent to the server of the software to be tested, including:
[0016] The second object class is used to simulate the user in the logged-in state according to the login information, and sends the object to be operated in the data request to the server of the software to be tested.
[0017] In some embodiments, the automated testing method further comprises:
[0018] Launch multiple browsers through automated testing tools;
[0019] Use automated testing tools to simulate user operations on the software under test, including:
[0020] Calling automated testing tools through various threads to simulate users operating the software under test through multiple browsers, wherein each thread is used to operate a different browser to perform different tasks;
[0021] Automated testing methods also include:
[0022] Monitor the execution status of each thread, and send notification information to other threads based on the monitored execution status to notify other threads to start executing corresponding tasks;
[0023] Monitor the results of the server of the software under test responding to the data request feedback, including:
[0024] Monitor the results of the server of the software under test responding to the data request feedback during the execution of each thread.
[0025] In some embodiments, the task is a failure mode and impact analysis task between automobile structures, and the failure mode and impact analysis task between automobile structures includes a first task, a second task, and a third task. The first task includes an impact analysis task of the first structure on the second structure and the third structure respectively, the second task includes an impact analysis task of the second structure on the first structure, and the third task includes an impact analysis task of the third structure on the first structure. Each thread includes a first thread, a second thread, and a third thread, which are respectively used to execute the first task, the second task, and the third task. The execution status of each thread is monitored, and notification information is sent to other threads according to the monitored execution status to notify other threads to start executing corresponding tasks, including:
[0026] Monitoring the execution of the first thread, and when it is monitored that the first thread starts to execute the task of analyzing the impact of the first structure on the second structure, sending notification information to the second thread to notify the second thread to start executing the second task;
[0027] When it is monitored that the first thread starts to execute the task of analyzing the impact of the first structure on the third structure, a notification message is sent to the third thread to notify the third thread to start executing the third task;
[0028] Monitor the execution of the second thread, and send a notification message to the first thread when the second thread is completed.
[0029] The execution status of the third thread is monitored, and when the execution of the third thread is completed, a notification message is sent to the first thread.
[0030] In some embodiments, monitoring the execution status of the first thread includes:
[0031] Monitoring an interface call request initiated by the first thread, where the interface call request is used to request execution of the first task;
[0032] When the interface call request is a request to execute the task of analyzing the impact of the first structure on the second structure, determining that the first thread starts to execute the task of analyzing the impact of the first structure on the second structure;
[0033] When the interface call request is a request to execute the task of analyzing the impact of the first structure on the third structure, it is determined that the first thread starts to execute the task of analyzing the impact of the first structure on the third structure.
[0034] In some embodiments, the automated testing further includes:
[0035] A pre-built database on the server of the software under test is monitored, and the database is used to store information about the vehicle structure;
[0036] When a new structure is detected, a new thread is created to perform an impact analysis task between the new structure and the original structure.
[0037] In a second aspect, an embodiment of the present disclosure provides an automated testing device, comprising:
[0038] A calling module is used to call an automated testing tool to simulate a user operating the software under test, so as to send a data request to the server of the software under test, wherein the automated testing tool is used to locate the object to be operated on the page of the software under test and perform the corresponding operation, and / or carry the object to be operated in the data request and send it to the server of the software under test;
[0039] A monitoring module, used to monitor the result of the server of the software under test responding to the data request feedback;
[0040] In a third aspect, an embodiment of the present disclosure provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the automated testing method provided in any embodiment of the present disclosure in the first aspect are implemented.
[0041] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the automated testing method provided in any embodiment of the present disclosure in the first aspect.
[0042] The above-mentioned automated testing method, device, computer equipment and storage medium call an automated testing tool to simulate user operation of the software to be tested, so as to send a data request to the server of the software to be tested, wherein the automated testing tool is used to locate the object to be operated on the page of the software to be tested, and perform corresponding operations, and / or carry the object to be operated in the data request and send it to the server of the software to be tested, monitor the result of the server of the software to be tested responding to the data request feedback, and generate the test result of the software to be tested according to the monitoring result. The present application realizes the combination of browser control and data packet sending and receiving by calling the automated testing tool, and can not only realize the UI (User Interface) interface automated testing by controlling the browser, that is, simulating the user operation behavior by locating the page elements, but also realize the interface automated testing by simulating the user operation behavior by sending and receiving data packets, so that the present application can realize the combination of UI interface automated testing and interface automated testing, and can also realize the automated testing of the software to be tested in some scenarios where the page elements cannot be located, so that a set of test cases can test more and more complex test scenarios, broaden the scope of application of the test, and thus improve the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1An application environment diagram of an automated testing method in an embodiment;
[0044] Figure 2 A schematic diagram of a flow chart of an automated testing method in one embodiment;
[0045] Figure 3 A schematic diagram of the flow of interaction between threads in one embodiment;
[0046] Figure 4 A schematic diagram of a flow chart of an automated testing method in another embodiment;
[0047] Figure 5 is a structural block diagram of an automated testing device in one embodiment;
[0048] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] Please refer to Figure 1 , Figure 1 A schematic diagram of an application environment of an automated testing method provided by an exemplary embodiment of the present application. Figure 1 As shown, the application environment includes a terminal 100 and a server 101 of the software to be tested, wherein the software to be tested and the test cases are deployed on the terminal 100, and a communicative connection can be achieved between the terminal 100 and the server 101 of the software to be tested through a network 102, and the automated testing method of the present application is implemented by running the test cases deployed on the terminal 100.
[0051] Terminal 100 is used to execute test cases to call an automated testing tool to simulate user operations on the software under test, so as to send a data request to the server 101 of the software under test, wherein the automated testing tool is used to locate the object to be operated on the page of the software under test and perform corresponding operations, and / or carry the object to be operated in the data request and send it to the server 101 of the software under test, monitor the results of the response of the server 101 of the software under test to the data request feedback, and generate test results of the software under test according to the monitoring results.
[0052] The terminal 100 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
[0053] The server 101 of the software to be tested is used to receive the data request sent by the terminal 100, and feed back corresponding results in response to the data request.
[0054] The server 101 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0055] The network 102 is used to realize the network connection between the terminal 100 and the server 101 of the software to be tested. Specifically, the network 102 may include various types of wired or wireless networks.
[0056] In a first aspect, an embodiment of the present disclosure provides an automated testing method, such as Figure 2 As shown, this method is applied to Figure 1 The terminal 100 in FIG. 1 is taken as an example to illustrate the method, which includes the following steps:
[0057] Step S11 is used to call an automated testing tool to simulate user operation of the software under test, so as to send a data request to the server of the software under test, wherein the automated testing tool is used to locate the object to be operated on the page of the software under test and perform corresponding operations, and / or carry the object to be operated in the data request and send it to the server of the software under test.
[0058] Among them, an automated testing tool is a type of software application that is designed to automatically execute test cases, verify software functions, and generate test reports. Specifically, the automated testing tool used in this application is a testing tool that can both control the browser and send and receive data packets.
[0059] Specifically, the automated testing tool used in this application may be drissionpage. Among them, drissionpage is a web automation tool based on Python (a computer program programming language). Drissionpage is an emerging Python library that allows developers to control and interact with web pages by combining traditional browser automation and network data packet manipulation. Unlike traditional browser automation tools such as Selenium (automated testing tool for the web) or Pyppeteer (automated testing tool for the web), drissionpage provides the function of directly sending and receiving network data packets, which is similar to the operation performed using the HTTP (Hypertext Transfer Protocol) library.
[0060] The software under test mentioned above refers to the software that needs to be tested. Before the software under test is updated or officially put into use, a series of tests, such as interface testing and performance testing, are required.
[0061] The above-mentioned simulation of user operation of the software under test refers to, for example, simulation of user click, input and drag operations. The object to be operated refers to the object acted upon by the user operation or the object carried in the request. Exemplarily, the object to be operated can be a page element, for example, a virtual button on the page.
[0062] The protocol types of the above data requests may include HTTP protocol, CDP protocol (Chrome DevTools Protocol, Chrome debugging protocol) and websoket (a full-duplex communication protocol based on TCP), etc.
[0063] Specifically, when simulating a user operating a page of the software to be tested, the present application locates the object to be operated on the page of the software to be tested and performs corresponding operations if the position of the object to be operated on the page can be located; when the position of the object to be operated on the page cannot be located, the object to be operated is carried in a data request and sent to the server of the software to be tested.
[0064] When there are multiple objects to be operated, some of which can be located, these objects are operated by positioning, and other objects cannot be located, so they are operated by sending and receiving data packets.
[0065] Specifically, the present application can pre-configure multiple test cases, each test case is used to test different scenarios, each test case is stored in a different directory, and each runs independently. The test cases and the software to be tested in the present application can be deployed on the same computer device or different computer devices, such as deployed on the same terminal or different terminals. When the terminal runs the test case, the automated testing method of the present application is implemented. When running the test case, the automated testing tool can be called to simulate the user's operation of the software to be tested to send a data request to the server of the software to be tested.
[0066] Step S12, monitoring the result fed back by the server of the software under test in response to the data request.
[0067] In this application, the situation during the running of the test case is monitored. Specifically, when a data request is sent to the server of the software under test, the result of the server of the software under test responding to the data request is monitored. For example, when a name modification request is sent to the server of the software under test, the server of the software under test will feedback the corresponding modified name, and the terminal will display the modified name in the corresponding position after receiving it. This application can monitor this interactive process.
[0068] Step S13: Generate test results of the software to be tested according to the monitoring results.
[0069] The monitoring results include the feedback from the server of the software under test during the running of the test case and the display of the front-end page of the software under test, which may include the test results of successful test and failed test. For example, a possible application scenario of test failure may be as follows:
[0070] Assume that thread 1 simulates engineer 1 analyzing structure A, and thread 2 simulates engineer 2 analyzing structure B. Thread 1 specifically simulates engineer 1 backfilling into the FMEA software, specifically backfilling the contact analysis results of structure A to structure B. The automated testing method of the present application can monitor thread 1 and thread 2. When it is monitored that the page corresponding to the browser operated by thread 2 simulating engineer 2 does not display the contact analysis results of structure A to structure B backfilled by thread 1 in real time, a test result of test failure is generated.
[0071] In some embodiments, the automated testing tool includes a first object class and a second object class, the first object class is used to operate a browser, and the second object class is used to send a data packet, and the automated testing tool simulates a user operating the software to be tested to send a data request to a server of the software to be tested, including:
[0072] Locating the object to be operated on the page of the software to be tested through the first object class and performing corresponding operations to send a data request to the server of the software to be tested; and / or
[0073] The object to be operated is carried in the data request through the second object class and sent to the server of the software to be tested, so as to send the data request to the server of the software to be tested.
[0074] Specifically, when the automated testing tool is a drissionpage, the first object class may be a ChromiumPage object class, and the second object class may be a SessionPage object class. When the position of the page element can be located, the page element is located and operated through the ChromiumPage object class, and when the position of the page element cannot be located, the page element is operated by calling the SessionPage object class through the method of sending and receiving data packets.
[0075] Exemplarily, taking logging in to a user account as an example, the ChromiumPage object class can locate the account text box, obtain the account text box element, enter the corresponding user account based on the obtained account text box, then locate the password text box, enter the password based on the obtained password text box, locate the login button, click login, and thus implement the account login process.
[0076] Exemplarily, when the canvas element P cannot be positioned, such as when the position of element P changes dynamically each time the page is opened, the operation of element P can be implemented by simulating the front end sending an HTTP request through the SessionPage object class, wherein the HTTP request carries the identification information of element P.
[0077] The beneficial effects of this embodiment are:
[0078] The present application locates and operates page elements through the first object class. When the position of the page element cannot be located, the page element is operated through the second object class by sending and receiving data packets. This achieves simulation of user operation of page elements regardless of whether the position of the page element can be located. This makes the automated testing method of the present application applicable to more and more complex testing scenarios, solves the complexity of traditional technologies that require the use of multiple testing tools for testing, and improves testing efficiency.
[0079] In some embodiments, the automated testing method may further include:
[0080] Generate login information through the first object class when logging into the user account for the first time;
[0081] Sharing login information via a second object class;
[0082] The object to be operated is carried in the data request through the second object class and sent to the server of the software to be tested, including:
[0083] The second object class is used to simulate the user in the logged-in state according to the login information, and sends the object to be operated in the data request to the server of the software to be tested.
[0084] The login information may include login token information or cookies. The login token information may include the user's identity information and permission information. Specifically, when the terminal submits a login request to the server of the software to be tested, the login request carries login credentials, such as account information and password. The server performs identity authentication based on the login credentials, and returns the login token information to the terminal after successful authentication. The terminal can then carry the login token information to request data from the server of the software to be tested without carrying the account number and password.
[0085] Among them, cookie refers to data (usually encrypted) stored on the user's local terminal in order for some websites to identify the user and conduct session tracking. It is information temporarily or permanently saved by the user's client computer.
[0086] In this application, the ChromiumPage object class and the SessionPage object class both belong to the WebPage object. When a simulated user logs in for the first time, the ChromiumPage object class can be called to simulate the user's login operation. During the login process, login information is generated and stored in the WebPage object. The SessionPage object class can share the login information. By sharing the login information, the SessionPage object class can simulate the user sending a data request to the server of the software under test in the logged-in state.
[0087] In traditional technology, only UI automation testing is generally implemented. In some scenarios where the object to be operated cannot be located, it is necessary to simulate the terminal to send a request to the server of the software to be tested to implement the test. The request needs to carry information such as cookies obtained during login, which increases the complexity of the test and the maintenance cost.
[0088] By adopting the solution of the present application, the second object class can share the login information generated by the first object class during the simulated login process, thereby realizing the sharing of the login status, reducing the need for repeated logins, and significantly improving the test efficiency of the automated test.
[0089] In some embodiments, the automated testing method may further include:
[0090] Launch multiple browsers through automated testing tools;
[0091] Use automated testing tools to simulate user operations on the software under test, including:
[0092] Calling automated testing tools through various threads to simulate users operating the software under test through multiple browsers, wherein each thread is used to operate a different browser to perform different tasks;
[0093] Automated testing methods can also include:
[0094] Monitor the execution status of each thread, and send notification information to other threads based on the monitored execution status to notify other threads to start executing corresponding tasks;
[0095] Monitor the results of the server of the software under test responding to the data request feedback, including:
[0096] Monitor the results of the server of the software under test responding to the data request feedback during the execution of each thread.
[0097] Specifically, the present application calls the automated testing tool to start multiple browsers, each of which performs different tasks, and calls the automated testing tool through different threads to simulate the user operation of the corresponding browser to display the page to perform different tasks. Each browser is pre-bound to a different user account to simulate user operations with different user identities.
[0098] Among them, the above-mentioned tasks refer to tasks performed by simulating user operations on the software to be tested. Specifically, the present application can execute multiple tasks at the same time, and each task is processed in parallel. Specifically, when executing task M1, it is necessary to rely on the data processing result of task M2, then two browsers can be opened at the same time, wherein task M1 is executed in one browser and task M2 is executed in the other browser, wherein task M1 and task M2 are different tasks.
[0099] Alternatively, when task N specifically includes two subtasks, task N1 and task N2, two browsers may be opened simultaneously, wherein task N1 is executed in one browser and task N2 is executed in the other browser.
[0100] Exemplarily, thread 1 simulates a user operating browser 1 to execute task M1, thread 2 simulates a user operating browser 2 to execute task M2, and thread 3 simulates a user operating browser 3 to execute task M3. When thread 1 executes task M1 and needs to rely on the execution result of thread 2, or when there is a correlation between the execution tasks of thread 1 and thread 2, it will trigger a notification message to be sent to thread 2 to notify thread 2 to start executing task M2. Similarly, when thread 1 executes task M1 and needs to rely on the execution result of thread 3, or when there is a correlation between the execution tasks of thread 1 and thread 3, it will trigger a notification message to be sent to thread 3 to notify thread 2 to start executing task M3.
[0101] The fact that the execution tasks of thread 1 and thread 2 are related means that when the execution result of a task needs to depend on the execution results of thread 1 and thread 2 respectively, it is considered that the execution tasks of thread 1 and thread 2 are related.
[0102] The beneficial effects of this embodiment are:
[0103] The present application can be applied to some complex test scenarios, for example, when the execution of a task needs to depend on the execution of other tasks, or a task includes multiple subtasks, and there are complex test scenarios in which there are interactions between the execution processes of each subtask, so as to achieve mutual collaboration between multiple tasks in complex test scenarios.
[0104] In some embodiments, the task is a failure mode and impact analysis task between automobile structures, and the failure mode and impact analysis task between automobile structures includes a first task, a second task, and a third task. The first task includes an impact analysis task of the first structure on the second structure and the third structure respectively, the second task includes an impact analysis task of the second structure on the first structure, and the third task includes an impact analysis task of the third structure on the first structure. Each thread includes a first thread, a second thread, and a third thread, which are respectively used to execute the first task, the second task, and the third task. The execution status of each thread is monitored, and notification information is sent to other threads according to the monitored execution status to notify other threads to start executing corresponding tasks, including:
[0105] Monitoring the execution of the first thread, and when it is monitored that the first thread starts to execute the task of analyzing the impact of the first structure on the second structure, sending notification information to the second thread to notify the second thread to start executing the second task;
[0106] When it is monitored that the first thread starts to execute the task of analyzing the impact of the first structure on the third structure, a notification message is sent to the third thread to notify the third thread to start executing the third task;
[0107] Monitor the execution of the second thread, and send a notification message to the first thread when the second thread is completed.
[0108] The execution status of the third thread is monitored, and when the execution of the third thread is completed, a notification message is sent to the first thread.
[0109] Among them, the above-mentioned failure mode and effect analysis task refers to the FMEA (Failure Mode and Effects Analysis) task. Failure mode and effect analysis refers to "potential failure mode and consequence analysis", which is a systematic activity in the product design stage and process design stage to analyze the subsystems and parts that constitute the product and each process of the constituent process one by one, find out all potential failure modes, and analyze their possible consequences, so as to take necessary measures in advance to improve the quality and reliability of the product.
[0110] Specifically, the software to be tested in the present application may be FMEA software, which is used to perform failure mode and effects analysis tasks, and can be specifically used to perform failure mode and effects analysis tasks between automobile structures. Among them, automobile structure refers to the various parts of the automobile. The failure mode and effects analysis task between automobile structures refers to the task of analyzing the impact of the mutual contact between the various parts of the automobile. For example, the task of analyzing the impact of the mutual contact between the air conditioner of the automobile and the tables and chairs of the automobile, and the task of analyzing the impact of the mutual contact between the lights and lampshades of the automobile. The above-mentioned first structure, second structure and third structure refer to the structure of the automobile, that is, the parts of the automobile.
[0111] The first task mentioned above refers to the task of analyzing the impact of the first structure on other structures, the second task refers to the task of analyzing the impact of the second structure on other structures, and the third task refers to the task of analyzing the impact of the third structure on other structures. In the first task, the first structure is the main analysis object, in the second task, the second structure is the main analysis object, and in the third task, the third structure is the main analysis object.
[0112] Specifically, the first task includes two subtasks, namely, the impact analysis task of the first structure on the second structure and the impact analysis task of the first structure on the third structure. The second task includes the impact analysis task of the second structure on the first structure, and may also include the impact analysis task of the second structure on other structures. The third task includes the impact analysis task of the third structure on the first structure, and may also include the impact analysis task of the third structure on other structures.
[0113] In the present application, multiple threads are pre-created, including a first thread, a second thread and a third thread, wherein the first thread is used to execute a first task, the second thread is used to execute a second task, and the third thread is used to execute a third task, and each thread executes tasks independently and in parallel.
[0114] The present application can monitor the execution of each thread, such as monitoring the first thread. When the first thread is monitored to execute the first subtask, i.e., the impact analysis task of the first structure on the second structure, a notification message can be triggered to be sent to the second thread to notify the second thread to start executing the second task. Because the execution result of the impact analysis task of the first structure on the second structure needs to depend on the execution result of the impact analysis task of the second structure on the first structure, the execution result of the impact analysis task of the first structure on the second structure is more accurate.
[0115] It can be seen that the present application can be used to test more complex test scenarios, namely scenarios where multiple tasks collaborate with each other, for example, a task includes multiple subtasks, or the execution of a task depends on other tasks.
[0116] It should be noted that the present application can also be expanded to simulate scenarios where more tasks collaborate with each other, not limited to the scenario where three tasks collaborate with each other in the above embodiment. For example, for a scenario where N tasks collaborate with each other, N browsers can be opened correspondingly, and N threads can be used to simulate N engineers performing analysis tasks of corresponding structures. N can be set according to actual needs.
[0117] Specifically, the present application can create a management thread, monitor each thread (i.e., the first thread, the second thread, and the third thread) through the management thread, and send notification information to each thread by the management thread, or each thread itself can send notification information to other threads.
[0118] The beneficial effect of this embodiment is: when the execution process of a task depends on the execution of other tasks, multiple browsers can be opened at the same time, and the execution processes of different tasks can be simulated through different threads, and data can be exchanged between the threads to achieve collaborative work between the threads.
[0119] Please refer to Figure 3 , Figure 3 FIG. 1 is a schematic diagram of the interaction process between various threads in one embodiment. Figure 3 In the example, the first thread, the second thread, the third thread and the fourth thread are pre-created. The first thread is used to perform the impact analysis task of structure A on other structures, the second thread is used to perform the impact analysis task of structure B on other structures, the third thread is used to perform the impact analysis task of structure C on other structures, and the fourth thread is used to review the analysis results of the first thread, the second thread and the third thread to determine whether each task has been completed.
[0120] When the first thread starts to perform the task of analyzing the impact of structure A on structure B, it triggers sending notification information to the second thread to notify the second thread to start performing the task of analyzing the impact of structure B on structure A. When the first thread starts to perform the task of analyzing the impact of structure A on structure C, it triggers sending notification information to the third thread to notify the second thread to start performing the task of analyzing the impact of structure C on structure A.
[0121] In some embodiments, monitoring the execution status of the first thread includes:
[0122] Monitoring an interface call request initiated by the first thread, where the interface call request is used to request execution of the first task;
[0123] When the interface call request is a request to execute the task of analyzing the impact of the first structure on the second structure, determining that the first thread starts to execute the task of analyzing the impact of the first structure on the second structure;
[0124] When the interface call request is a request to execute the task of analyzing the impact of the first structure on the third structure, it is determined that the first thread starts to execute the task of analyzing the impact of the first structure on the third structure.
[0125] In the present application, a data request can be specifically sent to the server of the software to be tested through the second object class. Therefore, the present application can monitor the action of the second object class initiating an interface call, such as initiating a function analysis call AI (Intelligent Interface, artificial intelligence) interface, and when the second object class is monitored to initiate an interface call action, when obtaining a specific interface call request, extract the specific information in the interface call request, and when the interface call request contains other structures except the main analysis object, trigger and notify the thread corresponding to the other structure to start executing the task.
[0126] Exemplarily, the first thread is pre-configured to simulate and execute a first task, where the first task includes an impact analysis task of structure A on structure B, wherein structure A is a main analysis object of the first task.
[0127] The second thread is responsible for simulating and executing the second task. The second task includes an analysis task of the impact of structure B on structure A. Structure B is the main analysis object of the second task.
[0128] The first thread is monitored, and when it is monitored that the first thread calls the second object class to initiate an interface call request, the information in the interface call request is extracted. When the extracted information includes structure B in addition to the main analysis object structure A, a notification message is sent to the thread corresponding to structure B, i.e., the second thread, to notify the second thread to start executing the task of analyzing the impact of structure B on structure A.
[0129] The beneficial effect of this embodiment is: by monitoring the interface call requests of each thread, other threads that need to be notified are determined based on the interface call requests, so as to send notification information to other threads, thereby realizing data interaction between various threads.
[0130] In some embodiments, the automated testing method may further include:
[0131] A pre-built database on the server of the software under test is monitored, and the database is used to store information about the vehicle structure;
[0132] When a new structure is detected, a new thread is created to perform an impact analysis task between the new structure and the original structure.
[0133] In this application, the database is used to store information about various structures of the car. This application can monitor the information in the database, and when a new structure is detected in the database, a new thread is created to simulate the user operating the software under test to perform the impact analysis task between the new structure and the original structure, and the results of the impact analysis task between the new structure and the original structure are stored in the database.
[0134] Please refer to Figure 4 , Figure 4 FIG. 1 is a flow chart of an automated testing method in one embodiment. Figure 4 In the example, a framework manager is pre-created to manage various test cases and test processes. Specifically, the process of the automated testing method of the present application may include:
[0135] Execute each test case according to the test case of the current test suite configuration;
[0136] Perform initialization, FMEA tasks, assertions, and restore data through the browser engine;
[0137] Generate reports;
[0138] Send a report notification.
[0139] Among them, the failure mode and effect analysis task execution further includes multi-person collaboration management, workflow automation and task execution. Among them, multi-person collaboration management is used to manage the collaboration process between different threads, including task allocation, progress tracking and real-time communication. Workflow automation is used to define and automate each step in the execution process of the failure mode and effect analysis task to ensure that the process is carried out according to established rules. Task execution is used to execute the failure mode and effect analysis task in the web browser page, specifically by calling the automated testing tool to simulate the user's operation of the software under test to send data requests to the server of the software under test.
[0140] Furthermore, when executing test cases, dirty data from the last execution of the test cases may exist in the software under test, such as the task execution results and some intermediate data generated when the test cases were last executed. This may cause data conflicts when the test cases are subsequently executed, so data restoration is required.
[0141] Generating a report refers to monitoring the results of the server of the software under test in response to the data request feedback, and generating the test results of the software under test based on the monitoring results.
[0142] In a second aspect, an embodiment of the present disclosure provides an automated testing device, such as Figure 3 As shown, the automated testing device includes: a calling module 51, a monitoring module 52 and a generating module 53, wherein:
[0143] The calling module 51 is used to call the automated testing tool to simulate the user's operation on the software to be tested, so as to send a data request to the server of the software to be tested, wherein the automated testing tool is used to locate the object to be operated on the page of the software to be tested, and perform the corresponding operation, and / or carry the object to be operated in the data request and send it to the server of the software to be tested;
[0144] A monitoring module 52, used to monitor the result of the server of the software under test responding to the data request feedback;
[0145] The generating module 53 is used to generate the test result of the software to be tested according to the monitoring result.
[0146] In some of the embodiments, the automated testing tool includes a first object class and a second object class, the first object class is used to operate the browser, and the second object class is used to send data packets. The calling module 51 can locate the object to be operated on the page of the software to be tested through the first object class and perform corresponding operations to send a data request to the server of the software to be tested, and / or carry the operation object in the data request through the second object class and send it to the server of the software to be tested to send a data request to the server of the software to be tested.
[0147] In some of the embodiments, the calling module 51 can also generate login information through the first object class when logging into the user account for the first time, share the login information through the second object class, and simulate the user in the logged-in state through the second object class according to the login information to carry the object to be operated in the data request and send it to the server of the software to be tested.
[0148] In some of the embodiments, the calling module 51 can also start multiple browsers through the automated testing tool, and call the automated testing tool through each thread to simulate the user operating the software to be tested through multiple browsers, wherein each thread is used to operate a different browser to perform different tasks, monitor the execution status of each thread, and send notification information to other threads based on the monitored execution status to notify other threads to start executing corresponding tasks. The monitoring module 52 can monitor the results of the server of the software to be tested responding to data request feedback during the execution of each thread.
[0149] In some embodiments, the task is a failure mode and effect analysis task between automobile structures, and the failure mode and effect analysis task between automobile structures includes a first task, a second task and a third task. The first task includes an impact analysis task of the first structure on the second structure and the third structure respectively, the second task includes an impact analysis task of the second structure on the first structure, and the third task includes an impact analysis task of the third structure on the first structure. Each thread includes a first thread, a second thread and a third thread, which are respectively used to execute the first task, the second task and the third task. The monitoring module 52 can monitor the execution of the first thread. When it is monitored that the first thread starts to execute the impact analysis task of the first structure on the second structure, a notification message is sent to the second thread to notify the second thread to start executing the second task. When it is monitored that the first thread starts to execute the impact analysis task of the first structure on the third structure, a notification message is sent to the third thread to notify the third thread to start executing the third task. The execution of the second thread is monitored. When the second thread is completed, a notification message is sent to the first thread. The execution of the third thread is monitored. When the third thread is completed, a notification message is sent to the first thread.
[0150] In some of the embodiments, the monitoring module 52 may monitor an interface call request initiated by the first thread, where the interface call request is used to request execution of a first task. When the interface call request is a request to execute an impact analysis task of the first structure on the second structure, it is determined that the first thread starts executing the impact analysis task of the first structure on the second structure. When the interface call request is a request to execute an impact analysis task of the first structure on a third structure, it is determined that the first thread starts executing the impact analysis task of the first structure on the third structure.
[0151] In some of the embodiments, the monitoring module 52 may also monitor a pre-built database on the server of the software to be tested, where the database is used to store information about the vehicle structure. When a new structure is detected, a new thread is created to perform an impact analysis task between the new structure and the original structure.
[0152] In a third aspect, an embodiment of the present disclosure provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the automated testing method provided in any embodiment of the present disclosure in the first aspect when executing the computer program.
[0153] In one embodiment, the computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an automated testing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0154] Those skilled in the art will understand that Figure 6 The structure shown in the figure is merely a block diagram of a partial structure related to the embodiment scheme of the present disclosure, and does not constitute a limitation on the computer device to which the embodiment scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0155] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the automated testing method provided in any embodiment of the present disclosure in the first aspect.
[0156] The computer readable storage medium may be Figure 6 A computer-readable storage medium in the computer device shown.
[0157] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0158] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0159] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An automated testing method, characterized in that: The method comprises: The automated testing tool is used to simulate user operations on the software to be tested, so as to send a data request to the server of the software to be tested, wherein the automated testing tool is used to locate the object to be operated on the page of the software to be tested and perform corresponding operations, and / or to carry the object to be operated in the data request and send it to the server of the software to be tested; Monitoring the result fed back by the server of the software under test in response to the data request; The test result of the software to be tested is generated according to the monitoring result.
2. The method according to claim 1, characterized in that The automated testing tool includes a first object class and a second object class, wherein the first object class is used to operate a browser, and the second object class is used to send a data packet. The automated testing tool is used to simulate a user operating the software to be tested to send a data request to a server of the software to be tested, including: Locating the object to be operated on the page of the software to be tested through the first object class and performing corresponding operations to send a data request to the server of the software to be tested; and / or The object to be operated is carried in a data request through the second object class and sent to the server of the software to be tested, so as to send a data request to the server of the software to be tested.
3. The method according to claim 2, characterized in that The method further comprises: Generate login information through the first object class when logging into a user account for the first time; sharing the login information via the second object class; The step of carrying the object to be operated in the data request through the second object class and sending it to the server of the software to be tested includes: The second object class is used to simulate the user in a logged-in state carrying the object to be operated in a data request and sending it to the server of the software to be tested according to the login information.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: Launch multiple browsers through the automated testing tool; The method of simulating user operation of the software to be tested by using an automated testing tool includes: Calling the automated testing tool through each thread to simulate a user operating the software to be tested through the multiple browsers, wherein each thread is used to operate a different browser to perform a different task; The method further comprises: Monitor the execution status of each thread, and send notification information to other threads based on the monitored execution status to notify other threads to start executing corresponding tasks; The result fed back by the server monitoring the software under test in response to the data request includes: Monitor the results fed back by the server of the software under test in response to the data request during the execution of each of the threads.
5. The method according to claim 4, characterized in that The task is a failure mode and impact analysis task between automobile structures, and the failure mode and impact analysis task between automobile structures includes a first task, a second task and a third task. The first task includes an impact analysis task of the first structure on the second structure and the third structure respectively, the second task includes an impact analysis task of the second structure on the first structure, and the third task includes an impact analysis task of the third structure on the first structure. The threads include a first thread, a second thread and a third thread, which are respectively used to execute the first task, the second task and the third task. The execution status of each thread is monitored, and notification information is sent to other threads according to the monitored execution status to notify other threads to start executing corresponding tasks, including: monitoring the execution status of the first thread, and when it is monitored that the first thread starts to execute the task of analyzing the impact of the first structure on the second structure, sending notification information to the second thread to notify the second thread to start executing the second task; When monitoring that the first thread starts to execute the task of analyzing the impact of the first structure on the third structure, sending notification information to the third thread to notify the third thread to start executing the third task; Monitoring the execution status of the second thread, and sending notification information to the first thread when the execution of the second thread is completed; The execution status of the third thread is monitored, and when the execution of the third thread is completed, notification information is sent to the first thread.
6. The method according to claim 5, characterized in that The monitoring of the execution status of the first thread includes: Monitoring an interface call request initiated by the first thread, where the interface call request is used to request execution of the first task; When the interface call request is a request to execute the task of analyzing the impact of the first structure on the second structure, determining that the first thread starts to execute the task of analyzing the impact of the first structure on the second structure; When the interface call request is a request to execute the task of analyzing the impact of the first structure on the third structure, it is determined that the first thread starts to execute the task of analyzing the impact of the first structure on the third structure.
7. The method according to claim 5, characterized in that The method further comprises: A pre-built database on the server of the software under test is monitored, and the database is used to store information about the vehicle structure; When a new structure is detected, a new thread is created to perform an impact analysis task between the new structure and the original structure.
8. An automated testing device, characterized in that: The device comprises: A calling module, used to simulate user operation of the software under test through an automated testing tool to send a data request to the server of the software under test, wherein the automated testing tool is used to locate the object to be operated on the page of the software under test and perform corresponding operations, and / or carry the object to be operated in the data request and send it to the server of the software under test; A monitoring module, used for monitoring the result fed back by the server of the software under test in response to the data request; The generation module is used to generate the test results of the software to be tested according to the monitoring results.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
