Automatic server testing method and device
By receiving server test requests and generating test tasks, the problems of low server testing efficiency and poor automation in the existing technology are solved, and automated test and report generation of large-scale servers are realized, and testing efficiency and compatibility are improved.
Patent Information
- Application Number
- CN202411320472.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
AI Technical Summary
The existing server testing methods are inefficient and have poor automation, making it difficult to achieve efficient automated testing of large-scale servers, difficult to manage test results, and inconsistent compatibility and report output.
By receiving server test requests, obtaining the identification information of the server to be tested, creating test tasks and sending them to the message queue, the server to be tested performs tasks and generates reports, supporting automated tests of various operating systems and hardware types to achieve full process automation.
It improves server testing efficiency and quality, reduces the time cost of managing test data, supports large-scale parallel testing, realizes automated generation and unified output of test reports, and improves test flexibility and compatibility.
Smart Images

Figure CN119172271A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a server automation testing method and device. Background Art
[0002] With the widespread application of cloud computing and large-scale server deployment, the demand for servers continues to increase. Before deploying servers, effective server testing can ensure server performance and quality, improve operation and maintenance efficiency, and reduce the risk of failure.
[0003] In the related technologies, most of them use manual testing with scripts, but this testing method has low testing efficiency and high labor costs. In addition, when testing multiple servers, it is difficult for testers to monitor the status of each server in real time. The test results and test reports need to be recorded and dimensioned offline, and the error rate is high. The compatibility of existing automated testing systems is poor, and test data needs to be manually organized, and test reports cannot be uniformly output. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a server automated testing method and device, which can realize automated testing of large-scale servers, improve testing efficiency and testing quality, and reduce the time cost and workload of managing test data.
[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a server automated testing method is provided, comprising:
[0006] Receive a server test request; the server test request includes an identifier of each server to be tested among a plurality of servers to be tested;
[0007] For each server to be tested, obtaining script information corresponding to the identifier of the server to be tested, and creating a test task corresponding to the server to be tested according to the script information;
[0008] Sending the test task to a message queue corresponding to the server to be tested according to the identifier of the server to be tested, so that the server to be tested obtains the test task from the message queue and executes the test task;
[0009] Obtain a test result of the server to be tested executing the test task, and generate a test report corresponding to the test task according to the test result.
[0010] Optionally, before receiving the server test request, the method further includes:
[0011] Adding the server to be tested to the test network;
[0012] The basic information of the server to be tested is obtained through the test network, where the basic information includes an identifier of the server to be tested.
[0013] Optionally, obtaining script information corresponding to the identifier of the server to be tested includes:
[0014] Acquire configuration information of the server to be tested according to the identifier of the server to be tested;
[0015] Acquire script information corresponding to the configuration information of the server to be tested.
[0016] Optionally, the configuration information includes one or more hardware types; before obtaining the script information corresponding to the configuration information of the server to be tested, the method further includes:
[0017] For each hardware type, construct a test script corresponding to the hardware type, and configure test parameters of the test script;
[0018] For each hardware type, a mapping relationship between the hardware type and script information is configured, where the script information includes a test script corresponding to the hardware type and test parameters of the test script.
[0019] Optionally, before receiving the server test request, the method further includes:
[0020] An operating system is installed on the server to be tested through a remote protocol, and various plug-ins are installed based on the operating system. The various plug-ins include a collection plug-in; the collection plug-in is used to obtain configuration information of the server to be tested according to the identifier of the server to be tested.
[0021] Optionally, the method further comprises:
[0022] Receiving a server termination request, wherein the server termination request indicates a target test task and a target server to be tested corresponding to the target test task;
[0023] A termination instruction of the target task to be tested is sent to the target server to be tested, so that the target server to be tested terminates execution of the target test task.
[0024] Optionally, before obtaining the test result of the server to be tested executing the test task, the method further includes:
[0025] Determining that the execution status of the test task is successful;
[0026] When the execution status of the test task is execution failure, the test task is resent to the message queue so that the server to be tested re-executes the test task.
[0027] According to another aspect of an embodiment of the present invention, there is provided a server automated testing device, comprising:
[0028] A receiving module receives a server test request; the server test request includes an identifier of each server to be tested among a plurality of servers to be tested;
[0029] An acquisition module, for each server to be tested, acquires script information corresponding to the identifier of the server to be tested, and creates a test task corresponding to the server to be tested according to the script information;
[0030] A sending module, which sends the test task to a message queue corresponding to the server to be tested according to the identifier of the server to be tested, so that the server to be tested obtains the test task from the message queue and executes the test task;
[0031] The generating module obtains the test result of the server to be tested executing the test task, and generates a test report corresponding to the test task according to the test result.
[0032] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0033] one or more processors;
[0034] a storage device for storing one or more programs,
[0035] When the one or more programs are executed by the one or more processors, the one or more processors implement the server automation testing method provided by the present invention.
[0036] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the server automatic testing method provided by the present invention is implemented.
[0037] One embodiment of the above invention has the following advantages or beneficial effects: the server automation testing method of the embodiment of the present invention, after receiving the server test request, obtains the script information corresponding to each server to be tested for each server to be tested, so as to create a corresponding test task according to the script information; sends the test task to the message queue of the server to be tested, so that the server to be tested executes the test task in sequence, obtains the test result, and generates a test report according to the test result. The method realizes the platformization and automation of the test method by obtaining the script information corresponding to the identifier of each server to be tested, creating a test task based on the script information and sending it to the message queue of the server to be tested; the method can support large-scale servers for parallel testing, shorten the test cycle, and improve the test efficiency of the server; the test report can be automatically generated according to the test results, reducing the time cost and workload of the test personnel to manually organize the test data; the method can cover the test process of the server that does not need to replace the hardware equipment, and can realize the full process of automated testing of the server hardware.
[0038] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0040] Figure 1 is a schematic diagram of the main process of a server automation testing method according to an embodiment of the present invention;
[0041] Figure 2 is a schematic diagram of a system network architecture of a server automation testing method according to an embodiment of the present invention;
[0042] Figure 3 is a schematic diagram of a system architecture of a server automation testing method according to an embodiment of the present invention;
[0043] Figure 4 is a flow chart of a server automation testing method according to an embodiment of the present invention;
[0044] Figure 5 is a stability test performance curve diagram obtained by a server automation test method according to an embodiment of the present invention;
[0045] Figure 6 is a schematic diagram of main modules of a server automated testing device according to an embodiment of the present invention;
[0046] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0047] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0049] With the popularity of cloud computing and large-scale server deployment, enterprises' demand for servers is also increasing. As the core of enterprise data centers, the performance and stability of servers have an important impact on the business and service quality of enterprises. From R&D to delivery, effective server testing can ensure the performance and quality of servers, improve operation and maintenance efficiency, and reduce the risk of failure. In the actual testing process, since most of the test content is strongly related to hardware and the test coverage is wide, most of the existing server tests are performed manually with scripts. This semi-automatic testing method has many disadvantages. Manual testing of servers and deployment tasks are limited, and there are many repeated testing tasks, which takes a long time and requires a lot of manpower, and the testing efficiency is low. When testing multiple servers, it is difficult for testers to monitor the status of each server in real time. Test results and test reports can only be recorded and maintained offline, the data volume is large and complex, the probability of low-level errors is high, and it is difficult to manage test data. Web-based automated server testing systems have also developed to a certain extent, but these automated testing systems have poor compatibility. Most test systems are developed for their own server equipment, and most automated testing systems only support server testing. The operating system needs to be installed manually, and the test data also needs to be manually sorted, and it is impossible to centrally and uniformly output test reports. In summary, the server testing methods in the prior art have problems such as frequent manual intervention, low automation, low testing efficiency, difficulty in managing data, poor compatibility and single function.
[0050] Based on the above problems, an embodiment of the present invention provides a server automation testing method, which can perform full-process automated testing on the server, automatically install the operating system, and automatically generate test reports, thereby improving testing efficiency, reducing the time for manual installation of the operating system, and saving the time of testers in organizing test data.
[0051] Figure 1 FIG. 1 is a schematic diagram of the main process of a server automation testing method according to an embodiment of the present invention. Figure 1 As shown, the server automated testing method comprises the following steps:
[0052] Step S101: receiving a server test request; the server test request includes an identifier of each server to be tested among a plurality of servers to be tested;
[0053] Step S102: for each server to be tested, obtain script information corresponding to the identifier of the server to be tested, and create a test task corresponding to the server to be tested according to the script information;
[0054] Step S103: sending the test task to the message queue corresponding to the server under test according to the identifier of the server under test, so that the server under test obtains the test task from the message queue and executes the test task;
[0055] Step S104: obtaining the test result of the test task executed by the server to be tested, and generating a test report corresponding to the test task according to the test result.
[0056] In an embodiment of the present invention, the server automation testing method is a web-based automated server testing method, which can be used for the full-process automated testing of server hardware and can be implemented through an automated testing platform. First, a server test request is received, that is, a user can send a server test request through a web page API on an automated testing web page. The server test request includes the identifier of each server to be tested in a plurality of servers to be tested, that is, the user can select the identifier of the server to be tested on the page according to the test requirements or input the identifier of the server to be tested to send a server test request, or select the identifier of the server to be tested from the list of servers to be tested to send a server test request, thereby realizing automated testing of batch servers. The list of servers to be tested includes the identifiers of each server added to the test machine resource pool, and the configuration information of each server. The test machine resource pool includes all servers that need to be tested. The user can also create a test project in advance, specify the identifier of the server to be tested in the test project, and send a server test request. The identifier of each server to be tested may be the serial number and / or IP information (including in-band IP and / or out-band IP) of each server to be tested, the in-band IP is the IP address of the service network of the server to be tested, and the out-band IP is the management IP address of the server to be tested that is remotely configured.
[0057] In the embodiment of the present invention, before receiving the server test request, the method further includes: adding the server to be tested to the test network; and obtaining basic information of the server to be tested through the test network, wherein the basic information includes an identifier of the server to be tested.
[0058] In the embodiment of the present invention, Figure 2As shown, after each server enters the computer room, it is added to the arrival resource pool, and then the server to be tested is transferred from the arrival resource pool to the test machine resource pool, and the server list corresponding to the arrival resource pool and the server list of the test machine resource pool are updated at the same time; each server in the test machine resource pool is added to the test network, which is also the network used by the automated test platform, so that each server in the test machine resource pool and the automated test platform deployed in the computer room can communicate and access resources in the same local area network. The server to be tested is part or all of the servers in the test machine resource pool. After the server to be tested is connected and powered on, the server to be tested can actively report its basic information to the automated test platform through the test network, or the automated test platform sends a basic information acquisition request to the server to be tested after detecting the server to be tested newly added to the test network or the test machine resource pool, and obtains the basic information of the server to be tested through the test network, so that the host management module in the automated test platform manages the basic information of the server to be tested. The basic information of the server to be tested may include the server's serial number, IP information (including in-band and / or out-of-band IP), server manufacturer, model, account and password, host name, port number and other information.
[0059] In an embodiment of the present invention, for each server to be tested, corresponding script information is obtained according to the identifier of each server to be tested, so as to create a test task corresponding to the server to be tested using the script information. Obtaining the script information corresponding to the identifier of the server to be tested includes: obtaining the configuration information of the server to be tested according to the identifier of the server to be tested; obtaining the script information corresponding to the configuration information of the server to be tested.
[0060] In an embodiment of the present invention, the automated testing platform includes a resource management module, which is used to manage the configuration information of the server to be tested, that is, including the identification of each server to be tested and the configuration information corresponding to the identification of each server to be tested, so that the configuration information of the server to be tested can be obtained from the resource management module according to the identification of the server to be tested, and the configuration information of the server to be tested in the resource management module is collected by the collection plug-in of the server to be tested. Alternatively, the configuration information collected by the collection plug-in can also be obtained from the server to be tested according to the identification of the server to be tested. After the configuration information of the server to be tested is obtained, the script information can be obtained according to the configuration information of the server to be tested and the test content, and the script information can be manually selected by the tester, or the script information corresponding to the configuration information of the server to be tested can be obtained according to the corresponding relationship between the configuration information and the script information. Alternatively, the script information corresponding to the identification of the server to be tested can be parsed from the server test request, that is, the tester selects multiple identifications of the servers to be tested and the script information corresponding to each server to be tested on the web page and then sends the server test request.
[0061] In an embodiment of the present invention, before receiving a server test request, it also includes: installing an operating system on the server to be tested through a remote protocol, and installing various plug-ins based on the operating system, each plug-in including a collection plug-in; the collection plug-in is used to obtain configuration information of the server to be tested according to the identifier of the server to be tested.
[0062] In an embodiment of the present invention, before receiving a server test request, the server to be tested needs to install an operating system and various plug-ins. The operating system and various plug-ins can be installed after each server in the test machine resource pool is connected and powered on, so as to provide a basis for subsequent execution of test tasks.
[0063] Specifically, operation and maintenance tools such as Ansible can be used to access the server to be tested, such as all servers in the test machine resource pool, through a remote protocol such as the SSH protocol, and the operating system and various plug-ins, as well as dependent software libraries, can be installed on the server to be tested.
[0064] First, install the operating system on the server to be tested. The automated testing platform can support the installation of multiple versions of operating systems, such as CentOS, Ubantu, openEuler, Rocky, Vessel and other versions of operating systems. The operating system can be installed on the memory of the server to be tested through PXE technology. Among them, PXE technology allows the client to download the operating system image from the remote server through the network and boot it. It operates by using the boot function of the network card when the system starts. PXE is initialized before network booting, and can assign an IP address through the DHCP server and download necessary files from the server, such as boot images, drivers, and operating system images.
[0065] Then install each plug-in on the test server. Specifically, you can use the BMC IP to install the plug-in for the server to be tested, and return the execution status of the plug-in. Among them, each plug-in includes a collection plug-in, which is used to collect the configuration information of the server to be tested. The collection plug-in can be implemented through tools such as ipmitool and lspci.
[0066] After installing the operating system and various plug-ins, the environment is initialized, and then the collection plug-in of the server to be tested is accessed through the SSH protocol to obtain the configuration information of the server to be tested collected by the collection plug-in, and stored in the resource management module of the automated test platform, and the configuration information of the server to be tested is managed by the resource management module. Among them, the configuration information of the server to be tested includes hardware configuration information and may also include software configuration information. The hardware configuration information may include information such as the CPU, memory, hard disk, network card, RAID, HBA, GPU, etc. of the server to be tested, and the software configuration information may include information such as BMC, BIOS or driver.
[0067] In an embodiment of the present invention, after obtaining the configuration information of the server to be tested collected by the collection plug-in, before obtaining the script information corresponding to the configuration information of the server to be tested, it is necessary to compare the collected configuration information with the actual configuration information of the server to be tested. If the comparison result indicates that the two are different, a reminder message is sent to remind the operation and maintenance or development personnel. If the comparison result indicates that the two are the same, the corresponding script information is obtained according to the configuration information of the server to be tested, so as to facilitate timely discovery of problems.
[0068] In an embodiment of the present invention, the configuration information includes one or more hardware types; before obtaining the script information corresponding to the configuration information of the server to be tested, the method further includes:
[0069] For each hardware type, build a test script corresponding to the hardware type and configure the test parameters of the test script;
[0070] For each hardware type, a mapping relationship between the hardware type and script information is configured, where the script information includes a test script corresponding to the hardware type and test parameters of the test script.
[0071] In an embodiment of the present invention, the hardware type of the server to be tested may be one of the CPU, memory, hard disk, network card, RAID, HBA, GPU, etc. of the server to be tested. Before obtaining the script information corresponding to the configuration information of the server to be tested, a test script corresponding to each hardware type is constructed. The test script may be in shell or Python language, and each hardware type may correspond to one or more test scripts. Since the test parameters of the same test script are different, the test results obtained are also different, so it is necessary to pre-configure the test parameters corresponding to each test script. The test parameters can be modified according to the test requirements, and then, for each hardware type, the mapping relationship between the hardware type and the script information is configured. The script information includes the test script and the test parameters corresponding to the test script, and then the script information corresponding to the configuration information of the server to be tested is obtained according to the mapping relationship. In the actual test process, in order to improve the test efficiency, the same test script can be issued to multiple servers, or multiple test scripts can be issued to one server.
[0072] In an embodiment of the present invention, a test set can be constructed according to the test scripts corresponding to the hardware types and the test parameters of each test script, and a mapping relationship between the hardware type set composed of the hardware types and the test set can be configured. If the configuration information of the server to be tested successfully matches one of the hardware type sets, the script information corresponding to the configuration information can be obtained according to the mapping relationship.
[0073] The automated testing platform includes a script management module and a test set management module. The script management module includes multiple test scripts and the test parameters of each test script. Testers can modify the test parameters according to different test requirements and configure the execution order of each test script to achieve flexible configuration of automated testing deployment; the test set management includes the test set corresponding to each hardware type set and the test parameters of each test script in the test set. Of course, obtaining the script information corresponding to the configuration information of the server to be tested can be the tester configuration information or the test content selecting one or more test scripts from the script management, or selecting a pre-configured test set from the test set management.
[0074] In an embodiment of the present invention, after obtaining the script information of each server to be tested, a test task of the server to be tested is created according to the script information. The script information includes one or more test scripts and the test parameters of each test script. A test task can be created according to each test script and the test parameters corresponding to the test script. Each test task can correspond to a test type. The test type can include stability test, function test, performance test, etc., which can be flexibly set according to specific test requirements. If the configuration information of the server to be tested includes multiple hardware types, multiple test tasks can be created according to multiple test scripts corresponding to the multiple hardware types and the test parameters of each test script. For a test set, each test task can be created according to each test script and its test parameters in the test set.
[0075] In the embodiment of the present invention, after creating the test task of the server under test, the test task is sent to the message queue corresponding to the server under test, so that the server under test can obtain each test task from the message queue and execute each test task.
[0076] Specifically, each plug-in in the server to be tested includes a task plug-in, which can be used to send test tasks and instructions to the server to be tested, that is, the automated testing platform can send test tasks to the server to be tested through the task plug-in, thereby sending the test tasks to the message queue corresponding to the server to be tested; the task plug-in can also monitor the execution status of each test task in the server to be tested, and send the task execution results, that is, the test results and execution logs, to the automated testing platform. Among them, the execution status of the test task may include: task execution is successful, task execution fails, task is being executed; task is in the queue, not executed, task terminated and no longer executed, task execution timed out, etc. Each plug-in of the server to be tested also includes a utilization plug-in, which can be used to monitor the temperature and pressure test data of each hardware type in real time during the stability test of the server to be tested.
[0077] In an embodiment of the present invention, the server to be tested monitors the message queue through a polling process. When a test task in the message queue is monitored, the scheduler is notified to create one or more task execution processes through a control process, and the task execution processes are used to sequentially execute each test task in the message queue to obtain the test results of the test tasks, and the test results are stored in a database.
[0078] In an embodiment of the present invention, the server automated testing method also includes: receiving a server abort request, the server abort request indicating a target test task and a target server to be tested corresponding to the target test task; sending an abort instruction of the target task to be tested to the target server to be tested so that the target server to be tested aborts executing the target test task.
[0079] In an embodiment of the present invention, the server automation testing method may further include: receiving a server abort request, and sending an abort instruction of the target test task to the target server to be tested indicated by the server abort request; after receiving the abort instruction, the target server to be tested aborts the execution of the target test task; if the target test task is in a message queue, the target test task is skipped and no longer executed, and the execution status of the target test task is updated to abort execution; if the target test task is being executed, the task execution process executing the target test task is notified to abort the execution of the target test task.
[0080] The method may also include: receiving a server deletion request, the server deletion request may include the target server to be tested and its corresponding target test task, and issuing a deletion instruction of the target test task to the target server to be tested indicated by the server deletion request, so as to delete the target test task from the message queue. It may also include: receiving a server skip request, the server skip request includes the target server to be tested and the target test task, and issuing a skip instruction of the target test task to the target server to be tested indicated in the server skip request, that is, when the task execution process executes the target test task, it directly skips the execution of the next test task.
[0081] In an embodiment of the present invention, before obtaining the test result of the test task executed by the server under test, it also includes: determining that the execution status of the test task is successful execution; when the execution status of the test task is failed execution, resending the test task to the message queue so that the server under test re-executes the test task.
[0082] In an embodiment of the present invention, after executing the test task, if it is confirmed that the execution status of the test task is successfully executed, the server to be tested returns the test result of the test task to the automated test platform, so that the automated test platform can obtain the test result and display it intuitively on the web page, which is convenient for testers to view. At the same time, the test result can be parsed, such as extracting key information and converting the format, to obtain the parsed test result, and then generate the corresponding test report according to the preset test report template and the parsed test result.
[0083] If the execution status of the test task is execution failure, which can be stop, failure, timeout, etc., you can check the task execution log to check the failure reason. After eliminating the failure reason, you can execute it again without sending the test task again. That is, add the failed test task to the message queue again so that the server to be tested can re-execute the test task. If the number of executions of the test task exceeds the preset number threshold, stop retrying.
[0084] In the embodiment of the present invention, the test tasks that fail to execute will be automatically transferred to the BUG management module of the automated testing platform, and the test personnel will assess the fault level according to the execution log of the test task for manual resolution.
[0085] In an embodiment of the present invention, the test results may include the hardware type of the server to be tested and the measured data corresponding to the hardware type, and then a benchmark value of the hardware type is obtained, and the actual data is compared with the benchmark, so that the performance data of multiple servers to be tested, such as multiple components of the same specification (i.e., hardware type), can be horizontally evaluated. If the measured data meets the benchmark value, the component test passes; if not, the test fails, and then a horizontal evaluation analysis result is output, which includes component information, measured data, benchmark values, and an analysis result indicating whether the test passes.
[0086] The server automated testing method of the embodiment of the present invention is implemented based on an automated testing platform or an automated testing system. The automated testing system can realize the automated installation of multiple operating systems, test set management, batch distribution of test tasks, automatic output of test reports, real-time monitoring of test task execution status and server performance data and other functions. The automated testing system mainly includes a host management module, a resource management module, a warehouse management module, a project management module, a BUG management module and a data analysis module. Among them, the host management module is mainly used to manage all servers that need to be tested in the computer room, that is, the servers in the test machine resource pool, and record the basic information of the server, such as server manufacturer, model, SN (Serial Number), in-band and out-of-band IP, account and password, etc. The resource management module is used to manage the detailed hardware configuration information and software configuration information of all servers that need to be tested. The warehouse management module includes script management, test set management, template management and image management; script management is mainly used to store various types of test scripts and test parameters; test set management can flexibly configure test scripts according to different test purposes or test scenarios, and uniformly manage multiple different and ordered test script sets; template management is used to store different types of test report templates; image management stores operating system versions and kernel versions of different architectures. The project management module is the core module of the automated testing system. It manages the test tasks of all servers to be tested, issues and executes test tasks, checks test status, test results and logs, and generates and exports test reports. The bug management module will uniformly track and resolve bugs encountered during the test process. After being evaluated by the tester, failed or problematic test tasks during the test process will be automatically transferred to the bug management module, facilitating timely location, troubleshooting and resolution of problems. The data analysis module is divided into two parts. One part is used to manage the benchmark values of various hardware types, and the other part can horizontally evaluate the performance of components from different manufacturers under the same specification configuration. The data analysis module can compare and analyze the performance data of multiple servers with the same configuration or components of the same specification to evaluate the performance differences between different servers or components.
[0087] Figure 3The system architecture diagram of a server automation testing method of an embodiment of the present invention. The tester sends a request through the web API to call the backend service, i.e., the automation testing platform. The front-end and back-end of the automation testing platform can be developed using Vue and GO. The back-end service processes the test task of the server to be tested based on the request. If the request can be a test request, the script information of the server to be tested is obtained based on the server to be tested indicated by the test request, and the test task is created based on the script information and sent to the message queue. It can also be an abort instruction, a retry instruction, a delete or skip instruction for the test task of the server to be tested. Before the server to be tested executes the test task, the back-end service uses the operation and maintenance tool to access and install the operating system, plug-ins, and dependent software libraries through SSH. The polling process of the server to be tested monitors the message queue. After detecting the test tasks in the message queue, it notifies the scheduler. The control process of the scheduler creates a task execution process. The task execution process executes the test tasks in the message queue in sequence, monitors the execution status in real time, obtains the test results after successful execution, parses the test results, and generates a test report for the parsed test results according to the preset test report template; it can also perform data analysis based on the test results to obtain cross-comparison analysis results; it can also transfer the failed test tasks to BUG management; it can also perform real-time performance monitoring of the server to be tested based on the test results. The parsed test results and execution logs are stored in the database (such as MySQL and Redis), and the real-time status of the tracked server to be tested and test tasks is stored in the database. The database also records the operation log of the entire process.
[0088] Figure 4 The following is a flow chart of a server automation testing method according to an embodiment of the present invention. The method includes:
[0089] Add the SN and IP information of the servers in the test machine resource pool to the host management module of the automated test platform;
[0090] Install the operating system on each server in the host management, determine whether the operating system is installed successfully, if not, return the log and reinstall the operating system; if yes, install the plug-in, determine whether the plug-in is installed successfully, if not, return the log and reinstall the plug-in, if yes, create a test project, select the server to be tested from the host management module, obtain the test script or test set of the server to be tested according to the test requirements or tests of the server to be tested, and then create a test task, send the test task to the server to be tested, and the server to be tested executes the test task;
[0091] Determine whether the test task is executed successfully. If not, return the execution log, automatically transfer the test task to the BUG management module, and make the server under test re-execute the test task; if so, output the test results and logs, select the corresponding benchmark value according to the test task and the hardware type corresponding to the test task, compare the test results with the benchmark, and obtain the horizontal evaluation results; determine whether it meets the requirements based on the horizontal evaluation results. If it meets the requirements, return passed and generate a test report according to the test report template; if it does not meet the requirements, return failed, and you can update the server under test selected by the test project.
[0092] Figure 5 This is a performance curve obtained by using the server automation test method of the embodiment of the present invention to perform a 24-hour stability test on the HDD of the server to be tested. The horizontal axis represents time in minutes, the vertical axis represents the number of IOPS captured by the FIO tool, and each curve (such as sda, sdb...sdw, etc.) represents the drive letter of the slot where each HH is located in the server to be tested. It can be seen from the figure that each point of each curve is between the set stability range of 500-600, and the floating range above and below the average value of 550 is small, indicating that the stability of the HDD is good.
[0093] The server automation test method of the embodiment of the present invention, after receiving the server test request, for each server to be tested, obtains the script information corresponding to each server to be tested, so as to create a corresponding test task according to the script information; sends the test task to the message queue of the server to be tested, so that the server to be tested executes the test task in sequence, obtains the test result, and generates a test report according to the test result. The method obtains the corresponding script information through the identification of each server to be tested, realizes the platformization and automation of the test method, shortens the test cycle and improves the test efficiency of the server by supporting large-scale server parallel testing; the method supports the automated testing of servers of various types of operating systems, expands the scope of application of the automated testing platform, has good compatibility, can remotely and automatically install the operating system for multiple servers at the same time, and reduces the time for manually installing the operating system; can realize the unified management of test data, automatically generate test reports, and reduce the time cost and workload of test personnel to manually organize test data; the method can also view the test progress, test results and execution log of the test task in real time, improve the test efficiency and test quality; the method supports test personnel to flexibly configure the test content, test parameters and test task execution order, and improves the flexibility of automated test deployment. This method can cover the test process that does not require the replacement of hardware equipment, and realize the full-process automated testing of server hardware, overcoming the defects of the prior art in the server R&D and testing phase, such as frequent manual intervention, poor automation, low testing efficiency, difficulty in managing data, single function of the existing platform, and poor compatibility.
[0094] According to another aspect of the embodiment of the present invention, Figure 6 As shown, a server automated testing device 600 is provided, comprising:
[0095] The receiving module 601 receives a server test request; the server test request includes an identifier of each server to be tested among multiple servers to be tested;
[0096] The acquisition module 602 acquires, for each server to be tested, script information corresponding to the identifier of the server to be tested, and creates a test task corresponding to the server to be tested according to the script information;
[0097] The sending module 603 sends the test task to the message queue corresponding to the server under test according to the identification of the server under test, so that the server under test obtains the test task from the message queue and executes the test task;
[0098] The generating module 604 obtains the test result of the test task executed by the server to be tested, and generates a test report corresponding to the test task according to the test result.
[0099] In the embodiment of the present invention, the receiving module 601 is further used to: before receiving the server test request, add the server to be tested to the test network; obtain basic information of the server to be tested through the test network, the basic information including the identification of the server to be tested.
[0100] In the embodiment of the present invention, the acquisition module 602 is further used to: acquire configuration information of the server to be tested according to the identifier of the server to be tested; and acquire script information corresponding to the configuration information of the server to be tested.
[0101] In an embodiment of the present invention, the configuration information includes one or more hardware types; the acquisition module 602 is also used to: before obtaining the script information corresponding to the configuration information of the server to be tested, for each hardware type, construct a test script corresponding to the hardware type and configure the test parameters of the test script; for each hardware type, configure the mapping relationship between the hardware type and the script information, the script information includes the test script corresponding to the hardware type and the test parameters of the test script.
[0102] In an embodiment of the present invention, the receiving module 601 is also used to: before receiving a server test request, install an operating system on the server to be tested through a remote protocol, and install various plug-ins based on the operating system, wherein the various plug-ins include a collection plug-in; the collection plug-in is used to obtain configuration information of the server to be tested according to the identifier of the server to be tested.
[0103] In an embodiment of the present invention, the receiving module 601 is also used to: receive a server termination request, which indicates a target test task and a target server to be tested corresponding to the target test task; and send a termination instruction of the target task to the target server to be tested so that the target server to be tested terminates execution of the target test task.
[0104] In an embodiment of the present invention, the generation module 604 is also used to: before obtaining the test result of the server under test executing the test task, determine that the execution status of the test task is successful execution; when the execution status of the test task is failure, resend the test task to the message queue so that the server under test re-executes the test task.
[0105] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the server automation testing method provided by the present invention.
[0106] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the server automatic testing method provided by the present invention is implemented.
[0107] Figure 7 An exemplary system architecture 700 is shown to which the server automated testing method or server automated testing apparatus according to the embodiment of the present invention can be applied.
[0108] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0109] The user can use the terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 701, 702, 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0110] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0111] The server 705 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 701, 702, and 703. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0112] It should be noted that the server automation testing method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the server automation testing device is generally disposed in the server 705 .
[0113] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0114] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0115] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0116] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0117] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0118] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0119] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0120] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be arranged in a processor, for example, they may be described as: a processor includes a receiving module, an acquiring module, a sending module and a generating module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the receiving module may also be described as a "module for receiving server test requests".
[0121] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving a server test request; the server test request includes the identification of each server to be tested among multiple servers to be tested; for each server to be tested, obtaining script information corresponding to the identification of the server to be tested, and creating a test task corresponding to the server to be tested according to the script information; sending the test task to the message queue corresponding to the server to be tested according to the identification of the server to be tested, so that the server to be tested obtains the test task from the message queue and executes the test task; obtaining the test result of the server to be tested executing the test task, and generating a test report corresponding to the test task according to the test result.
[0122] According to the technical solution of the embodiment of the present invention, the server automation test method of the embodiment of the present invention, after receiving the server test request, for each server to be tested, obtains the script information corresponding to each server to be tested, so as to create the corresponding test task according to the script information; sends the test task to the message queue of the server to be tested, so that the server to be tested executes the test task in sequence, obtains the test result, and generates a test report according to the test result. The method obtains the corresponding script information through the identification of each server to be tested, realizes the platformization and automation of the test method, shortens the test cycle and improves the test efficiency of the server by supporting large-scale server parallel testing; the method supports the automated testing of servers of various types of operating systems, expands the scope of application of the automated testing platform, and has good compatibility; can automatically generate a test report, and reduces the time cost and workload of the tester to manually organize the test data; the method can also view the test progress, test results and execution log of the test task in real time, and improve the test efficiency and test quality. The method can cover the test process that does not require the replacement of hardware equipment, realize the full process automated testing of server hardware, and overcome the defects of much manual intervention, poor automation, low test efficiency, difficulty in managing data, single function of the existing platform and poor compatibility in the server R&D test stage in the prior art.
[0123] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A server automation testing method, It is characterized in that include: Receive server test request; The server test request includes an identifier of each server to be tested among a plurality of servers to be tested; For each server to be tested, obtaining script information corresponding to the identifier of the server to be tested, and creating a test task corresponding to the server to be tested according to the script information; Sending the test task to a message queue corresponding to the server to be tested according to the identifier of the server to be tested, so that the server to be tested obtains the test task from the message queue and executes the test task; Obtain a test result of the server to be tested executing the test task, and generate a test report corresponding to the test task according to the test result.
2. The method according to claim 1, It is characterized in that Before receiving the server test request, it also includes: Adding the server to be tested to the test network; The basic information of the server to be tested is obtained through the test network, where the basic information includes an identifier of the server to be tested.
3. The method according to claim 1, It is characterized in that Obtaining script information corresponding to the identifier of the server to be tested, including: Acquire configuration information of the server to be tested according to the identifier of the server to be tested; Acquire script information corresponding to the configuration information of the server to be tested.
4. The method according to claim 3, It is characterized in that The configuration information includes one or more hardware types; Before obtaining the script information corresponding to the configuration information of the server to be tested, the method further includes: For each hardware type, construct a test script corresponding to the hardware type, and configure test parameters of the test script; For each hardware type, a mapping relationship between the hardware type and script information is configured, where the script information includes a test script corresponding to the hardware type and test parameters of the test script.
5. The method according to claim 3, It is characterized in that Before receiving the server test request, it also includes: An operating system is installed on the server to be tested through a remote protocol, and various plug-ins are installed based on the operating system. The various plug-ins include a collection plug-in; the collection plug-in is used to obtain configuration information of the server to be tested according to the identifier of the server to be tested.
6. The method according to claim 3, It is characterized in that The method further comprises: Receiving a server termination request, wherein the server termination request indicates a target test task and a target server to be tested corresponding to the target test task; A termination instruction of the target task to be tested is sent to the target server to be tested, so that the target server to be tested terminates execution of the target test task.
7. The method according to claim 1, It is characterized in that Before obtaining the test result of the server to be tested executing the test task, the method further includes: Determining that the execution status of the test task is successful; When the execution status of the test task is execution failure, the test task is resent to the message queue so that the server to be tested re-executes the test task.
8. A server automated testing device, It is characterized in that include: Receiving module, receiving server test request; The server test request includes an identifier of each server to be tested among a plurality of servers to be tested; An acquisition module, for each server to be tested, acquires script information corresponding to the identifier of the server to be tested, and creates a test task corresponding to the server to be tested according to the script information; A sending module, which sends the test task to a message queue corresponding to the server to be tested according to the identifier of the server to be tested, so that the server to be tested obtains the test task from the message queue and executes the test task; The generating module obtains the test result of the server to be tested executing the test task, and generates a test report corresponding to the test task according to the test result.
9. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Test system and testing method
US20260259807A1
