Automated testing method, device, electronic device and storage medium

Through automated testing methods, the test task creation events are monitored, the target test tasks and test files are obtained, and the target test room is determined based on the target key value, the target test task is generated, and the subtest tasks and test files are sent to the target test room, which solves the problem that existing tools cannot effectively support the full testing of cloud product instance functions, and realizes flexible test environment switching and full-room automation testing.

CN114153668BActive Publication Date: 2025-05-23BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111361549.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-17
Publication Date
2025-05-23
Estimated Expiration
2041-11-17

AI Technical Summary

Technical Problem

Existing OpenAPI automation testing tools, such as postman, httprunner and YApi, cannot effectively support full testing of cloud product instance functions, and are flexible and maintenance costs are high.

Method used

Provide an automated testing method, which creates events by listening to test tasks, obtains target test tasks and test files, and determines the target test room based on the target key value, generates subtest tasks, and sends subtest tasks and test files to the target test room to realize distributed testing.

Benefits of technology

It realizes the rapid switching of the test room and the test environment through key values ​​when executing test tasks, supports automated testing of the entire computer room, and reduces the complexity of the test environment and user configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153668B_ABST
    Figure CN114153668B_ABST
Patent Text Reader

Abstract

The present application discloses an automated testing method, device, electronic device and storage medium. The method includes: obtaining a target test task to be executed and a test file corresponding to the target test task based on a monitored test task creation event; obtaining a target key value corresponding to the target test task, and determining a target test room for executing the target test task based on the target key value; generating a sub-test task corresponding to the target test room based on the target test task; sending the sub-test task and the test file to the target test room so that the target test room calls the test file according to the sub-test task to obtain the test result. The embodiment of the present application can realize the rapid switching of the test room and the test environment through the key value when executing different test tasks by pre-configuring the key value corresponding to the test task, so as to realize the automated testing of the whole room, and the key value can support various test environments and user configurations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] OpenAPI automated testing is essentially interface testing, and mainly uses HTTP interfaces. The purpose of OpenAPI automated testing is to connect individual interfaces in series, form functional units, systematically test the corresponding functions on the product console, and verify the request expectations of each interface.

[0003] The mainstream testing tools for current businesses are: postman (GUI tool), suitable for single interface testing, httprunner (command line tool), suitable for interface-level and process-level testing, and YApi (WEB platform), suitable for interface-level and process-level testing.

[0004] However, the above technical solution has the following disadvantages:

[0005] 1) Postman has too many limitations and insufficient flexibility in interface verification and functional process testing. It is difficult to create interfaces, organize interface use cases, and mock data, and the maintenance cost is high.

[0006] 2) Although httprunner provides relatively complete functions, it is not suitable for the testing process of cloud products and cannot meet the full testing of cloud product instance functions.

[0007] 3) YApi is similar to httprunner and cannot cover all functions of cloud product instances. Summary of the invention

[0008] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides an automated testing method, device, electronic device and storage medium.

[0009] According to one aspect of an embodiment of the present application, an automated testing method is provided, which is applied to a server, and the method includes:

[0010] Based on the monitored test task creation event, obtain the target test task to be executed and the test file corresponding to the target test task;

[0011] Acquire a target key value corresponding to the target test task, and determine a target test room for executing the target test task based on the target key value;

[0012] Generate a sub-test task corresponding to the target test room based on the target test task;

[0013] The sub-test task and the test file are sent to the target test room, so that the target test room calls the test file according to the sub-test task to obtain a test result.

[0014] Further, the acquiring the target key value corresponding to the target test task and determining the target test room for executing the target test task based on the target key value includes:

[0015] Parse the target test task, obtain configuration information corresponding to the target test task, and obtain path configuration information;

[0016] In the case where the configuration information is path configuration information, reading a region identifier and a computer room identifier associated with the region identifier from the path configuration information;

[0017] The target region and the target test room are determined according to the region identifier and the room identifier.

[0018] Further, the acquiring the target key value corresponding to the target test task and determining the target test room for executing the target test task based on the target key value includes:

[0019] Parse the target test task, obtain configuration information corresponding to the target test task, and obtain template configuration information;

[0020] In the case that the configuration information belongs to template configuration information, a target key value corresponding to the template configuration information is obtained, and a target region is determined according to the target key value, and the target region corresponds to a target test room.

[0021] Further, the acquiring the target key value corresponding to the template configuration information and determining the target region and the target test room according to the target key value includes:

[0022] Acquire association information, wherein the association information stores preset template configuration information and corresponding key values;

[0023] In the case where the target key value corresponding to the template configuration information exists in the association information, the template configuration information is converted into a template dictionary according to the target key value, and the target region and the target test room corresponding to the target region are obtained from the template dictionary.

[0024] Further, converting the template configuration information into a template dictionary according to the target key value, and acquiring the target region and the target test room from the template dictionary, includes:

[0025] Obtain the test environment and test object carried by the target key value;

[0026] Querying a first test list corresponding to the test environment and a second test list corresponding to the test object, wherein both the first test list and the second test list include multiple test rooms;

[0027] The computer room that exists in both the first test list and the second test list is determined as the target test computer room.

[0028] Further, sending the sub-test task and the test file to the target test room so that the target test room calls the test file according to the sub-test task to obtain the test result includes:

[0029] Acquire a message queue, wherein the message queue includes a plurality of subqueues, and each subqueue corresponds to a target test room;

[0030] The sub-test tasks and the test files are distributed to the sub-queues, so that the target test room obtains the sub-test tasks and the test files from the sub-queues, and calls the test files according to the sub-test tasks to obtain test results.

[0031] According to another aspect of an embodiment of the present application, there is also provided an automated testing method applied to a message queue, the method comprising:

[0032] Receive subtest tasks and test files sent from the server;

[0033] Query the target test room corresponding to the sub-test task;

[0034] The sub-test task and the test file are stored in the sub-queue corresponding to the target test room, so that the target test room obtains the sub-test task and the test file from the sub-queue, and calls the test file according to the sub-test task to obtain the test result.

[0035] Furthermore, the method further comprises:

[0036] Obtaining test results obtained by each of the target test rooms;

[0037] Traversing the key information in the test result, and encapsulating the key information to obtain a task log;

[0038] Send the task log.

[0039] According to another aspect of the embodiment of the present application, there is also provided an automated testing device, including:

[0040] An acquisition module, used to acquire a target test task to be executed and a test file corresponding to the target test task based on a monitored test task creation event;

[0041] A parsing module, used for obtaining a target key value corresponding to the target test task, and determining a target test room for executing the target test task based on the target key value;

[0042] A determination module, configured to generate a sub-test task corresponding to the target test room based on the target test task;

[0043] The sending module is used to send the sub-test task and the test file to the target test room, so that the target test room calls the test file according to the sub-test task to obtain the test result.

[0044] According to another aspect of the embodiment of the present application, there is also provided an automated testing device, including:

[0045] The receiving module is used to receive sub-test tasks and test files sent from the server;

[0046] A query module, used to query the target test room corresponding to the sub-test task;

[0047] A storage module is used to store the sub-test task and the test file in the sub-queue corresponding to the target test room, so that the target test room obtains the sub-test task and the test file from the sub-queue, and calls the test file according to the sub-test task to obtain the test result.

[0048] According to another aspect of the embodiment of the present application, there is also provided an automated testing system, including: a server, a message queue, and a testing room;

[0049] The server is used to execute the above method;

[0050] The message queue is used to execute the above method;

[0051] The test room is used to call the test file according to the sub-test task to obtain the test result.

[0052] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.

[0053] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.

[0054] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0055] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages compared with the prior art: the embodiment of the present application pre-configures the key values ​​corresponding to the test tasks, so that the test room and the test environment can be quickly switched through the key values ​​when executing different test tasks, thereby realizing automated testing of the entire room. At the same time, the key values ​​can support various test environments and user configurations. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0058] Figure 1 A flowchart of an automated testing method provided in an embodiment of the present application;

[0059] Figure 2 A flowchart of an automated testing method provided by another embodiment of the present application;

[0060] Figure 3 A flowchart of an automated testing method provided by another embodiment of the present application;

[0061] Figure 4 A block diagram of an automated testing device provided in an embodiment of the present application;

[0062] Figure 5 A block diagram of an automated testing device provided in another embodiment of the present application;

[0063] Figure 6 A block diagram of an automated testing device provided in another embodiment of the present application;

[0064] Figure 7A block diagram of an automated testing system provided in an embodiment of the present application;

[0065] Figure 8 A block diagram of an automated testing system provided in an embodiment of the present application;

[0066] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0067] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0068] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another similar entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0069] The embodiment of the present application provides an automated testing method. The method provided in the embodiment of the present application can be applied to any required electronic device, for example, it can be a server, a terminal or other electronic device, which is not specifically limited here, and for the convenience of description, it is referred to as an electronic device in the following.

[0070] According to one aspect of an embodiment of the present application, a method embodiment of an automated testing method is provided, which is applied to a server. Figure 1 A flowchart of an automated testing method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0071] Step S11, based on the monitored test task creation event, obtain the target test task to be executed and the test file corresponding to the target test task.

[0072] In an embodiment of the present application, the main process set on the server is used to monitor the test task creation event. After monitoring the test task creation event, the uploaded target test task and test file will be obtained. Among them, the test task can be an interface test task, a performance test task, a configuration test task, etc. Each test task will correspond to a test file, and the test file can be a test case.

[0073] Step S12, obtaining a target key value corresponding to the target test task, and determining a target test room for executing the target test task based on the target key value.

[0074] The above-mentioned target test task can be executed by one or more target test computer rooms (that is, the technical solution of the present application can use one task to test a group of identical or similar computer rooms). The following description will be given using the example of execution by one target test computer room. When executed by multiple target test computer rooms, each target test computer room executes in the same manner.

[0075] In the embodiment of the present application, step S12, obtaining the target key value corresponding to the target test task, and determining the target test room for executing the target test task based on the target key value, includes the following steps A1-A3:

[0076] Step A1, parse the target test task, obtain the configuration information corresponding to the target test task, and obtain the path configuration information.

[0077] Step A2: when the configuration information is path configuration information, read the region identifier and the computer room identifier associated with the region identifier from the path configuration information.

[0078] Step A3, determining the target region and the target test room according to the region identifier and the room identifier.

[0079] In the embodiment of the present application, when the configuration information is path configuration information, the path configuration information carries a region identifier-computer room identifier, for example: SH (Shanghai)-computer room 2, HK (Hong Kong)-computer room 6, etc. Then, the target test computer room for executing the target test task can be determined based on the region identifier-computer room identifier.

[0080] In the embodiment of the present application, step S12, determining a target test room for executing a target test task, includes the following steps B1-B2:

[0081] Step B1, parse the target test task, obtain the configuration information corresponding to the target test task, and obtain the template configuration information.

[0082] Step B2, when the configuration information belongs to template configuration information, obtain the target key value corresponding to the template configuration information, and determine the target region according to the target key value, and the target region corresponds to the target test room.

[0083] In the embodiment of the present application, step B2, obtaining the target key value corresponding to the template configuration information, and determining the target region and the target test room according to the target key value, includes the following steps B201-B202:

[0084] Step B201, obtaining association information, in which preset template configuration information and corresponding key values ​​are stored.

[0085] In the embodiment of the present application, in order to improve the test efficiency, the developer pre-sets the key value corresponding to the template configuration information, which mainly includes configuration information such as the test object and the test environment of the test room. As an example, the target test task is database performance testing, the test object is: database redis, the test environment is: online room / offline test, and other configurations required for the test.

[0086] Step B202: when there is a target key value corresponding to the template configuration information in the associated information, the template configuration information is converted into a template dictionary according to the target key value, and the target region and the target test room corresponding to the target region are obtained from the template dictionary.

[0087] In an embodiment of the present application, step B202 converts the template configuration information into a template dictionary according to the target key value, and obtains the target region and the target test room from the template dictionary, including: obtaining the test environment and the test object carried by the target key value, querying the first test list corresponding to the test environment, and the second test list corresponding to the test object, wherein the first test list and the second test list both include multiple test rooms, and the room that exists in both the first test list and the second test list is determined as the target test room.

[0088] It should be noted that different test tasks and different computer room environments correspond to different template configuration information. Template configuration information and key values ​​can be pre-set according to the test task and the test environment of the test computer room, such as: ServiceName = redis, Environment = online, Xxx = xxx and Yyy = yyy, etc.

[0089] Step S13, generating a sub-test task corresponding to each target test room based on the target test task.

[0090] In an embodiment of the present application, generating a sub-test task corresponding to each target test room based on the target test task may be to generate multiple identical sub-test tasks based on the target test task, or to split the target test task into multiple different sub-test tasks.

[0091] Each sub-test task can be used to test a function of a test room. A test room can run one or more sub-test tasks during a test. This application takes the target test room running a sub-test task as an example. When the target test room runs multiple sub-test tasks, each sub-test task runs in the same way.

[0092] Step S14, sending the sub-test task and the test file to the target test room, so that the target test room calls the test file according to the sub-test task to obtain the test result.

[0093] In the embodiment of the present application, step S14, sending the sub-test task and the test file to the target test room, so that the target test room calls the test file according to the sub-test task to obtain the test result, includes the following steps C1-C2:

[0094] Step C1, obtaining a message queue, wherein the message queue includes multiple sub-queues, and each sub-queue corresponds to a target test room.

[0095] Step C2, distribute the sub-test tasks and test files to the sub-queues, so that the target test room obtains the sub-test tasks and test files from the sub-queues, and calls the test files according to the sub-test tasks to obtain the test results.

[0096] In order to realize the distributed testing of each sub-test task, the embodiment of the present application sends the sub-test task and the test file to the message queue, distributes the sub-test task through the message queue, and finally realizes the distributed testing by each computer room reading the corresponding self-test task from the message queue.

[0097] In addition, the embodiment of the present application sets an auxiliary function in the interface between the server and the message queue. When sending a sub-test task, the auxiliary function intercepts the sub-test task and the test file and verifies them. When the verification is passed, the interface is used to send the sub-test task and the test file to the message queue. The verification method includes: obtaining the storage path of each sub-test task, and when the storage paths are the same, confirming that the verification is passed.

[0098] The present application also provides an automated testing method, which is applied to a message queue. Figure 2 As shown, the method includes:

[0099] Step S21, receiving the sub-test task and the test file sent from the server.

[0100] Step S22, query the target test room corresponding to the sub-test task.

[0101] Step S23, storing the sub-test tasks and test files in the sub-queue corresponding to the target test room, so that the target test room obtains the sub-test tasks and test files from the sub-queue, and calls the test files according to the sub-test tasks to obtain the test results.

[0102] In the embodiment of the present application, a plurality of sub-queues are provided inside the message queue, each sub-queue corresponds to a test room, and the sub-queue is used to store the sub-test tasks and test files received by the corresponding test room. Therefore, when the message queue receives a plurality of sub-test tasks and test files, it judges the target test room corresponding to each sub-test task and test file, and then stores the sub-test task and test file in the sub-queue corresponding to the target test room, so that the test host in the subsequent target test room reads the sub-test task and test file from the sub-queue.

[0103] In the embodiment of the present application, the method further includes the following steps D1-D3:

[0104] Step D1, obtaining the test results obtained by each target test room.

[0105] Step D2, traverse the key information in the test results, and encapsulate the key information to obtain the task log. The key information here is the information that the tester is concerned about, such as: the time consumed by the test, the fault code that appears during the test (used to determine the specific fault), etc.

[0106] Step D3, sending the task log.

[0107] The message queue in the embodiment of the present application can be a rabbitmq message queue, through which the distribution of test tasks is realized to realize distributed testing. The server generates test tasks that can be executed by each regional computer room and pushes them into the message queue (the queue is divided by computer room). The proxy terminal deployed in the computer room can monitor the message queue corresponding to the computer room, take out the task from the queue and then execute the test.

[0108] The present application also provides an automated testing method, which is applied to a testing room. Figure 3 As shown, the method includes:

[0109] Step S31, monitoring the subqueue corresponding to the test room, wherein the subqueue is located in the target message queue.

[0110] Step S32: if the target subtask exists in the subqueue, read the target subtask and the test file.

[0111] Step S33, calling the test file according to the sub-test task to obtain the test result.

[0112] In the embodiment of the present application, the proxy terminal in the test room is used to monitor the sub-queue corresponding to the test room. When the proxy terminal monitors that there is a target sub-task in the sub-queue, it will read the target sub-task and test file from the sub-queue, and send the target sub-task and test file to the test terminal in the test room, so that the test terminal calls and executes the test file according to the sub-test task to obtain the test result. Finally, the obtained test result is stored in the database.

[0113] Figure 4 This is a block diagram of an automated testing device provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 4 As shown, the device comprises:

[0114] The acquisition module 41 is used to acquire the target test task to be executed and the test file corresponding to the target test task based on the monitored test task creation event.

[0115] The parsing module 42 is used to obtain the target key value corresponding to the target test task, and determine the target test room for executing the target test task based on the target key value.

[0116] The determination module 43 is used to generate a sub-test task corresponding to the target test room based on the target test task.

[0117] The sending module 44 is used to send the sub-test task and the test file to the target test room, so that the target test room calls the test file according to the sub-test task to obtain the test result.

[0118] In the embodiment of the present application, the parsing module 42 is used to parse the target test task, obtain the configuration information corresponding to the target test task, and obtain the path configuration information. In the case where the configuration information belongs to the path configuration information, the region identifier and the computer room identifier associated with the region identifier are read from the path configuration information. The target region and the target test computer room are determined according to the region identifier and the computer room identifier.

[0119] In the embodiment of the present application, the parsing module 42 is used to parse the target test task, obtain the configuration information corresponding to the target test task, and obtain the template configuration information. In the case where the configuration information belongs to the template configuration information, the target key value corresponding to the template configuration information is obtained, and the target region is determined according to the target key value, and the target region corresponds to the target test room.

[0120] In the embodiment of the present application, the parsing module 42 is used to obtain the associated information, in which the preset template configuration information and the corresponding key value are stored. In the case where there is a target key value corresponding to the template configuration information in the associated information, the template configuration information is converted into a template dictionary according to the target key value, and the target region and the target test room corresponding to the target region are obtained from the template dictionary.

[0121] In the embodiment of the present application, the parsing module 42 is used to obtain the test environment and the test object carried by the target key value. The first test list corresponding to the test environment and the second test list corresponding to the test object are queried, wherein the first test list and the second test list both include multiple test computer rooms. The computer room that exists in both the first test list and the second test list is determined as the target test computer room.

[0122] In the embodiment of the present application, the sending module 44 is used to obtain a message queue, wherein the message queue includes multiple sub-queues, each sub-queue corresponding to a target test room. The sub-test tasks and test files are distributed to the sub-queues, so that the target test room obtains the sub-test tasks and test files from the sub-queues, and calls the test files according to the sub-test tasks to obtain the test results.

[0123] Figure 5 This is a block diagram of an automated testing device provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 5 As shown, the device comprises:

[0124] The receiving module 51 is used to receive the sub-test tasks and test files sent from the server.

[0125] The query module 52 is used to query the target test room corresponding to the sub-test task.

[0126] The storage module 53 is used to store the sub-test tasks and test files in the sub-queue corresponding to the target test room, so that the target test room obtains the sub-test tasks and test files from the sub-queue, and calls the test files according to the sub-test tasks to obtain the test results.

[0127] In the embodiment of the present application, the device further includes: a sending module, which is used to obtain the test results obtained by each target test room, traverse the key information in the test results, and encapsulate the key information to obtain a task log, and send the task log.

[0128] Figure 6 This is a block diagram of an automated testing device provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 6 As shown, the device comprises:

[0129] The monitoring module 61 is used to monitor the subqueue corresponding to the test room, wherein the subqueue is located in the target message queue.

[0130] The reading module 62 is used to read the target subtask and the test file when the target subtask exists in the subqueue.

[0131] The calling module 63 is used to call the test file according to the sub-test task to obtain the test result.

[0132] Figure 7 This is a block diagram of an automated testing system provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 7 As shown, the system includes: a server 71, a message queue 72 and a target test room 73.

[0133] As an example, Figure 8 As shown, the server (i.e., the service node api-testerServerNode of the interface test) monitors the test task creation event in the message queue rabbitmq (such as the queue "Queue: cn-beijing-6" of the computer room Beijing-6, China, the queue "Queue: cn-shanghai-2" of the computer room Shanghai-2, China, the queue "Queue: cn-hongkong-2" of the computer room Hong Kong-2, China, etc.), obtains the target test task to be executed and the test file corresponding to the target test task, determines the target test computer room for executing the target test task, and sends the task to the agent of the computer room (such as the agent "AgentNode: cn-beijing-6" of the computer room Beijing-6, China, the agent "AgentNode: cn-shanghai-2" of the computer room Shanghai-2, China, the agent "AgentNode: cn-hongkong-2" of the computer room Hong Kong-2, China, etc.); generates a sub-test task corresponding to the target test computer room based on the target test task. The sub-test tasks and test files are sent to the message queue corresponding to the target test room. The target test room monitors the message queue, reads the sub-test tasks and test files from the message queue, and calls the test files according to the sub-test tasks to obtain the test results.

[0134] The present application also provides an electronic device, such as Fig. 9 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .

[0135] Memory 1503, used for storing computer programs;

[0136] The processor 1501 is used to implement the steps of the above embodiment when executing the computer program stored in the memory 1503.

[0137] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0138] The communication interface is used for communication between the above terminal and other devices.

[0139] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0140] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0141] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the automated testing method described in any one of the above embodiments.

[0142] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the automated testing method described in any one of the above embodiments.

[0143] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk), etc.

[0144] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

[0145] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. An automated testing method, It is characterized in that Applied to the server, the method includes: Based on the monitored test task creation event, obtain the target test task to be executed and the test file corresponding to the target test task; Obtaining a target key value corresponding to the target test task, and determining a target test room for executing the target test task based on the target key value, including: parsing the target test task, obtaining configuration information corresponding to the target test task, and obtaining template configuration information; in a case where the configuration information belongs to template configuration information, obtaining association information, wherein the association information stores preset template configuration information and corresponding key values; in a case where the target key value corresponding to the template configuration information exists in the association information, obtaining a test environment and a test object carried by the target key value; querying a first test list corresponding to the test environment and a second test list corresponding to the test object, wherein the first test list and the second test list both include multiple test rooms; determining a room that exists in both the first test list and the second test list as the target test room; Generate a sub-test task corresponding to the target test room based on the target test task; The sub-test task and the test file are sent to the target test room, so that the target test room calls the test file according to the sub-test task to obtain a test result.

2. The method according to claim 1, It is characterized in that The step of obtaining a target key value corresponding to the target test task and determining a target test room for executing the target test task based on the target key value includes: Parse the target test task, obtain configuration information corresponding to the target test task, and obtain path configuration information; In the case where the configuration information belongs to path configuration information, reading a region identifier and a computer room identifier associated with the region identifier from the path configuration information, wherein the target key value includes the region identifier; The target region and the target test room are determined according to the region identifier and the room identifier.

3. The method according to claim 1, It is characterized in that The sending the sub-test task and the test file to the target test room so that the target test room calls the test file according to the sub-test task to obtain the test result includes: Acquire a message queue, wherein the message queue includes a plurality of subqueues, and each subqueue corresponds to a target test room; The sub-test tasks and the test files are distributed to the sub-queues, so that the target test room obtains the sub-test tasks and the test files from the sub-queues, and calls the test files according to the sub-test tasks to obtain test results.

4. An automated testing method, It is characterized in that Applied to a message queue, the method comprises: Receiving a sub-test task and a test file sent from a server, wherein the server is used to run the automated testing method according to any one of claims 1 to 3; Query the target test room corresponding to the sub-test task; The sub-test task and the test file are stored in the sub-queue corresponding to the target test room, so that the target test room obtains the sub-test task and the test file from the sub-queue, and calls the test file according to the sub-test task to obtain the test result.

5. The method according to claim 4, It is characterized in that The method further comprises: Obtaining test results obtained by each of the target test rooms; Traversing the key information in the test result, and encapsulating the key information to obtain a task log; Send the task log.

6. An automated testing device, It is characterized in that include: An acquisition module, used to acquire a target test task to be executed and a test file corresponding to the target test task based on a monitored test task creation event; A parsing module, used to obtain a target key value corresponding to the target test task, and determine a target test room for executing the target test task based on the target key value, including: parsing the target test task, obtaining configuration information corresponding to the target test task, and obtaining template configuration information; in a case where the configuration information belongs to template configuration information, obtaining association information, wherein the association information stores preset template configuration information and corresponding key values; in a case where the target key value corresponding to the template configuration information exists in the association information, obtaining a test environment and a test object carried by the target key value; querying a first test list corresponding to the test environment and a second test list corresponding to the test object, wherein the first test list and the second test list both include multiple test rooms; determining a room that exists in both the first test list and the second test list as the target test room; A determination module, configured to generate a sub-test task corresponding to the target test room based on the target test task; The sending module is used to send the sub-test task and the test file to the target test room, so that the target test room calls the test file according to the sub-test task to obtain the test result.

7. An automated testing device, It is characterized in that include: A receiving module, used for receiving a sub-test task and a test file sent from a server, wherein the server is used for running the automated testing method according to any one of claims 1 to 3; A query module, used to query the target test room corresponding to the sub-test task; A storage module is used to store the sub-test task and the test file in the sub-queue corresponding to the target test room, so that the target test room obtains the sub-test task and the test file from the sub-queue, and calls the test file according to the sub-test task to obtain the test result.

8. An automated testing system, It is characterized in that include: Server, message queue and target test room; The server is used to execute the method described in any one of claims 1 to 3 above; The message queue is used to execute the method described in any one of claims 4 to 5 above; The target test room is used to call the test file according to the sub-test task to obtain the test result.

9. A storage medium, It is characterized in that The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1 to 5 when executed.

10. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the method steps of any one of claims 1 to 5 by running a program stored in a memory.

Citation Information

Patent Citations

  • Cross-machine room test method and apparatus

    CN105868058A

  • Test method and test system

    CN111444097A