CN111435329A - Automatic testing method and device - Google Patents

Automatic testing method and device Download PDF

Info

Publication number
CN111435329A
CN111435329A CN201910032061.9A CN201910032061A CN111435329A CN 111435329 A CN111435329 A CN 111435329A CN 201910032061 A CN201910032061 A CN 201910032061A CN 111435329 A CN111435329 A CN 111435329A
Authority
CN
China
Prior art keywords
test
node
task
result set
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910032061.9A
Other languages
Chinese (zh)
Inventor
樊宇
王晓琦
邱鹏
刘俐洋
杨丽涛
曾丹
黄泽琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910032061.9A priority Critical patent/CN111435329A/en
Publication of CN111435329A publication Critical patent/CN111435329A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing

Abstract

The invention discloses an automatic testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: the method comprises the steps that a server side selects a test task, wherein the test task comprises one or more test cases; the server side establishes a test result set according to the test task; and the server side sends a test message, wherein the test message comprises the identification of the test result set. The implementation mode can increase the expandability of the automatic test system, reduce the workload of daily maintenance of the automatic test system and the system complexity caused by requirement change, and the execution end and the server end can realize automatic association without binding.

Description

Automatic testing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an automated testing method and apparatus, an electronic device, and a computer-readable medium.
Background
Automated testing is a process that translates human-driven test behavior into machine execution. Typically, after the test case is designed and passed for review, the test is performed step by the tester according to the procedures described in the test case, resulting in actual results that are compared to expected results. In the process, in order to save manpower, time or hardware resources and improve the testing efficiency, automatic testing is introduced.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the existing storage and organization method of the automatic test configuration information is classified according to system dimensions, one system has a plurality of test plans, one test plan has a plurality of test tasks, one test task has a plurality of test cases, one test case also has a plurality of test scenes, and one test scene has a plurality of test data. The test plan, test tasks, test cases, test scenarios and test data are stored using relational data tables. Horizontal extension is not easy to perform, for example, a test plan is a data table, a test task is a data table, a multi-level test sub-plan is added between the test plan and the test task, a plurality of sub-plan data tables need to be added, corresponding codes are realized, and modification cost is extremely high. The test tasks are not easy to multiplex, if one test plan wants to directly use the test tasks in the other test plan, the test tasks need to be copied to the test plan for use, and if the original test tasks are changed, the test tasks cannot be synchronized to the test tasks in the test plan.
The existing execution organization method of the automatic test is realized by binding execution terminals, and during the execution of the automatic test, an automatic test scheduling service (namely a server terminal) randomly selects from available execution terminals according to the execution information of test tasks, or dispatches the test tasks to the execution terminals of fixed network addresses for execution. The execution end and the automated test scheduling service need to be manually associated to realize the subsequent automated test execution, and the automatic association cannot be established. This is not possible for some scenarios where there is no fixed network address for scheduling of the execution machines. Meanwhile, the corresponding relation between different types of test tasks and different types of execution machines is difficult to process, and generally only one type of execution machine with fixed network addresses can be processed.
Disclosure of Invention
In view of this, embodiments of the present invention provide an automatic testing method and apparatus, which can increase expandability of an automatic testing system, reduce workload of daily maintenance of the automatic testing system and system complexity caused by requirement change, and enable an execution end and a server end to implement automatic association without binding.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an automated testing method including: the method comprises the steps that a server side selects a test task, wherein the test task comprises one or more test cases; the server side establishes a test result set according to the test task; and the server side sends a test message, wherein the test message comprises the identification of the test result set.
Optionally, the method further comprises: the execution end determines the identification of the test result set from the test message; the execution end inquires the test result set according to the identification of the test result set; the execution end executes the test case in the test task; and the execution end stores the execution result of the test case to the test result set.
Optionally, the method further comprises: under the condition that the test case comprises a plurality of test scenes; and the execution end establishes threads according to each test scene, executes the threads, and the number of the threads which are executed concurrently does not exceed a preset threshold value.
Optionally, the method further comprises: storing the test tasks in a tree structure, wherein the test tasks are stored in nodes of the tree structure, and the nodes have unique identifiers;
the node is provided with a father node and/or a son node, wherein the father node and/or the son node stores the testing task related to the testing task.
Optionally, the method further comprises: and changing the incidence relation among the test tasks by changing the father node and/or the child node of the node.
To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided an automated testing apparatus including: the selection module of the server side is used for selecting a test task, and the test task comprises one or more test cases; the initial module of the server end is used for establishing a test result set according to the test task; and the message module of the server side is used for sending a test message, wherein the test message comprises the identification of the test result set.
Optionally, the apparatus further comprises: the receiving module of the execution end is used for determining the identification of the test result set from the test message; the positioning module of the execution end is used for inquiring the test result set according to the identification of the test result set; the execution module of the execution end is used for executing the test case in the test task; and the storage module of the execution end is used for storing the execution result of the test case to the test result set.
Optionally, the apparatus further includes a thread module of the execution end, configured to establish a thread according to each test scenario when the test case includes multiple test scenarios; the execution module of the execution end is further used for executing the threads, wherein the number of the threads which are executed concurrently does not exceed a preset threshold value.
Optionally, the apparatus further comprises: the test task organization module is used for storing the test tasks in a tree structure, the test tasks are stored in nodes of the tree structure, and the nodes have unique identifiers;
the node is provided with a father node and/or a son node, wherein the father node and/or the son node stores the testing task related to the testing task.
Optionally, the selection module of the server is further configured to change the association relationship between the test tasks by changing a parent node and/or a child node of the node.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus including: one or more processors; a storage device for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement any of the methods of an automated testing method.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program, when executed by one or more processors, implementing any one of the automated testing methods.
One embodiment of the above invention has the following advantages or benefits: because the technical means of sending the test message by the server is adopted, the technical problem that the execution end needs to be bound in the traditional method is solved, and the technical effect of realizing automatic association between the execution end and the server is further achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a server side of an automated testing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a tree structured test plan according to an embodiment of the invention;
FIG. 3 is a diagram illustrating major steps of an execution end of an automated testing method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the server-side main portion of an automated testing apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of the main part of the execution end of an automated testing method device according to the embodiment of the invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of an automated testing method according to an embodiment of the present invention, as shown in fig. 1:
step S101 represents that a server side selects a test task, wherein the test task comprises one or more test cases. A test task is to perform a certain operation with a test target, for example, to execute a program on a computer and test the execution of the program on the computer. The test task may include one or more test subtasks, the one or more test tasks may further form a test plan (the test plan is substantially identical to the test task), the test task includes one or more test cases, and the test cases may further include data of one or more test scenarios. The server is used for managing and organizing the test tasks or the test plans so that the test targets complete specific test tasks. The server side selects the test task and simultaneously determines the test case included in the test task and the data of the test scene included in the test case.
The method further comprises the following steps: storing the test tasks in a tree structure, wherein the test tasks are stored in nodes of the tree structure, and the nodes have unique identifiers; the node is provided with a father node and/or a son node, wherein the father node and/or the son node stores the testing task related to the testing task. The test tasks stored in the tree structure may be stored in an external database. If one test task comprises a plurality of test subtasks, the test task can be stored in a father node of the tree structure, the test subtasks are stored in child nodes of the father node, and each node has a unique identifier. It should be apparent that parent and child nodes are a relative concept. Further, the unique identification of its corresponding child node is saved in the parent node. The tree structure is a data structure in which a one-to-many tree relationship exists between data elements, and is a nonlinear data structure. The parent node and/or the child nodes store the test tasks related to the test tasks, namely the test tasks are related to the test child tasks, and a plurality of test tasks or test child tasks construct a complete test task plan by taking the execution logic of the test tasks as the recursive relation of a tree structure. For example, if the execution logic of the test task 1 includes the test subtask 1.1, in the tree structure, the node where the test task 1 is located is a parent node of the test subtask 1.1, and the node where the test subtask 1.1 is located is a child node of the test task 1.
And the tree structure is used for storing the test tasks or the test subtasks, so that the horizontal and horizontal extension of the automatic test tasks is realized. Because the tree structure has multiple levels of nodes, the root node of the tree can be a test plan, each node can be a test task, and the leaf nodes of the tree can be a specific test case, namely the problem of horizontal lateral expansion without limitation of the level size is realized. Further, the nodes of the tree may be linked to each other to establish a recursive relationship. And changing the incidence relation among the test tasks by changing the father node and/or the child node of the node. For example, if the child node B (in which the test task Y is stored) of the node a (in which the test task X is stored) is changed to the child node C (in which the test task Z is stored), the test subtask Y of the test task X is changed to the test subtask Z. Since recursion is generally performed from the root node to the leaf node when the tree structure is recursed, the recursion relationship between the parent node and the child node can be established by storing the unique identifier (such as node name, node number, and the like) of the child node in the parent node. It should be understood by those skilled in the art that if there are children nodes (referred to as grandchildren nodes herein for distinction), the recursive relationship between the parent node and the child node can be established by only storing the unique identifier of the child node in the parent node, and if the unique identifier of the grandchildren node is stored in the parent node, the recursive relationship established in this way may cause confusion of the relationship between the nodes, that is, only the unique identifier of the next node corresponding to the node is stored in one node. When the test task is selected, only the nodes of the required test task or the test subtask need to be selected, the execution logic of the test task is used as the recursion relation of the tree structure to construct the test plan of the tree structure, or the recursion relation between the nodes of the test task is modified on the basis of the existing test plan to construct the test plan of the tree structure. This step solves the problem of performing automated testing across root test plans.
For example, node A is the data of the embedded list of Map data type (Map is a data structure with key-value pair key-value), and Map data is { id: id value, name: name, children: [ child id1, child id2, child id3] }, wherein the id part stores the unique identifier (such as id value) of the node, the name part stores the name of the node, the children part stores the unique identifiers of the child nodes of node A, such as child id1, child id2 and child id3, wherein the child nodes also can have data of an independent Map data type (i.e. the grandchild node of node A) corresponding to the unique identifiers, and the information of all child nodes contained in the node can be obtained by recursively traversing the node.
For another example, fig. 2 is a schematic diagram of a tree-structured test plan according to an embodiment of the present invention, and as shown in the figure, node 1 is a root node; node 3, node 5 and node 6 are leaf nodes; node 4 is a child of node 2; nodes 5 and 6 are children of node 4 and grandchildren of node 2. The unique identifiers of the nodes 2 and 3, the unique identifier of the node 4 and the unique identifier of the node 5 and 6 are stored in the node 2 and the node 4 in the node 1, and the information of the nodes 2, 3, 4, 5 and 6 can be obtained by the node 1 in a recursion mode according to the recursion relation.
Furthermore, when the content of the node is changed, the content of the parent node and the root node of the node is not influenced. Furthermore, because different types of automated test frames have different attribute values, but the configuration process of the automated test system is a relatively abstract process and is not related to specific test task types, for example, the tree structure is shown, only node information with permission (permission for query) needs to be recursively traversed, the tree structure information is assembled into JSON data and returned to a foreground page, only the unique identifier of the node and the stored information such as the unique identifier of the child node, the node name and the like need to be concerned with the node information of the tree, and for different types of automated test frames, additional compound type data can be stored in the root node of the test plan. Such as the type of test task and the attribute values of the test task, etc., these characteristic values may be placed in the basic configuration information child nodes under the root node of the test plan. The tree structure has the characteristic of no fixed structure, so that different types of automatic test tasks can be conveniently stored without creating an additional data structure, the change of software requirements in the software development process can bring about the increase and the change of system fields, the tree structure storage does not need to create an additional database structure, and the process of designing and modifying the database structure is omitted. Due to the characteristic that the tree structure has no fixed structure, the number of tables of the database system can be greatly reduced.
The invention provides a flexible test configuration information storage scheme, solves the requirement of variable automatic test, provides various information organization modes for automatic test personnel, reduces the design complexity of an automatic test system and reduces the related development workload. Because the traditional automatic test system adopts a relational database for storage, the traditional automatic test system is difficult to adapt to the configuration and execution requirements of variable automatic tests and realize the customization requirements of automatic test personnel (different automatic test frames, different tested items have great difference and are usually difficult to be compatible), and the secondary development and modification cost of the system is higher. For executing the same test task under different test environments, the method for linking the child nodes by the root node of the test plan solves the problem. For example, when the link is created, the link is created by the related personnel of the root node of the test plan, the root node information and the target root node are selected, all child nodes under the root node are synchronized and copied to the target root node, new test task child node information does not need to be created, and the test task child node information can be reused. Therefore, when the automatic testing personnel modify the information under the test task sub-node, the test plan can be automatically updated, the problem that two sets of test plans need to be maintained at the same time is avoided, and the problem that the same task is executed at the same time can be avoided because the test tasks generated synchronously are still the same task.
The automated test system may also present all information of the test plan. The test plan is used for representing root node information of a group of test plans, and the root node information comprises a related affiliate mailbox, basic configuration information, executive machine network address information and the like. All child nodes of the root node of the test plan, namely the task node and the nodes such as the subtask node, share the configuration information of the root node. A plurality of child nodes can exist under a root node of the test plan, the child nodes can be test child plans or test tasks, and unique identifiers of the child nodes are stored in the root node. The detailed information of the child node can be stored as another independent node. There may still be child nodes under the test sub-plan node, and the node where the test case is located may be used as the final leaf node. The test case node stores test case data and test scene data. And specifying a required test scenario data name during test case editing, wherein the number of the scenario data names can be multiple. The test cases and the test scenario data may be stored in a table, as shown in table 1, and when different test case combinations are selected in the test task, corresponding table data may be displayed in the test scenario data table according to the scenario names.
TABLE 1
Scene name Use case data item name 1 Use case data item name 2
Scene 1 Use case data item value 1 Use case data item value 2
Scene 2 Use case data item value 1 Use case data item value 2
Wherein, the root node of the test plan may include:
a root node unique identifier;
a root node name;
testing the mail box information of the dry person;
basic configuration information(s);
a message queue name;
a test plan type;
test plan creation modifier information (including corresponding organizational information);
and the child node is uniquely identified.
The test sub-plan nodes may include:
a node unique identifier;
a node name;
the test sub-plan creates modifier information (including corresponding organizational structure information);
a child node unique identifier.
The test task node can comprise:
a node unique identifier;
a node name;
the test task creates modifier information (including corresponding organization information); and (3) associating the test case sequence:
the test case node unique identifier 1 and the case name;
the test case node unique identifier 2 and the case name;
the test case node unique identifier 1 and the case name;
scene data.
The automatic tester can add information required for maintenance in the system according to the test plan of the tree structure, and select one or more test plans and test tasks to be executed from the tree structure. Different nodes may have additional data items to satisfy the execution requirements of different test frameworks.
Recursively traversing the tree structure example code as follows:
Figure BDA0001944593510000101
Figure BDA0001944593510000111
step S102 represents that the server establishes a test result set according to the test task. The test result set is used for storing the relevant data in the execution process of the test task and after the execution is finished. Further, the test result set may also be stored in the node, and the test result set may be initialized first when the test result set is established.
The test result set node may include:
node unique identifier
Creation of reviewer information (with corresponding organizational information)
And (3) associating the test case sequence:
unique identifier 1 of test case node and case name
Unique identifier 2 of test case node and case name
Unique identifier 1 of test case node and case name
Scene data.
Wherein a checkpoint result list may be included in the scene data.
Step S103 represents that the server sends a test message, where the test message includes an identifier of the test result set.
The server end and the execution end of the automatic test communicate through the test message, and the test message can be stored in the test message queue. The test task node may include a message queue name in a root node of the test plan where the test task node is located, and when a corresponding test task is executed, the test task node may be distributed to the test terminal according to the message queue name, and the test message includes an identifier of a test result set that has been initialized and is corresponding to the test task node to be executed.
If the execution end does not execute the test information when the automatic test is executed, the test information is put into the information queue, and the execution end automatically processes the corresponding test information after starting.
Example codes for the server side to send messages are as follows:
Figure BDA0001944593510000121
FIG. 3 is a diagram illustrating major steps of an execution end of an automated testing method according to an embodiment of the present invention;
step S301 represents that the execution end determines the identifier of the test result set from the test message; step S302 represents that the execution end inquires the test result set according to the identification of the test result set; step S303 represents that the execution end executes the test case in the test task; step S304 represents that the execution end stores the execution result of the test case to the test result set. The execution end is used for sharing the calculated amount of the server end, and when the number of the execution ends is large, the pressure on the automatic system is small.
After receiving the test message sent by the server, the test execution end analyzes the test message to obtain the identifier of the test result set, queries the test result set according to the identifier of the test result set, can establish a catalog in the test result set, initializes a corresponding test environment according to the data of the root node of the test plan, and downloads the test code included in the test task (the test code is the realization of the test case). And generating corresponding calling configuration information in a corresponding directory of the test code according to the test case and the test scene data. And executing the test code according to the configuration information. After the execution is finished, the required execution result is analyzed according to the execution log of the test code, the result is stored in the test result set, the corresponding value in the scene data is written into the checkpoint result list under different scenes, and the value of the test case data item is changed in the test code execution process, so that the value is updated together. And finishing the execution of the test task. The execution end can continue to execute and wait for receiving the test message sent by the server end so as to execute other test tasks. In the traditional automatic test, the execution end scheduling needs an execution end resource pool, the network address of the execution end is bound, and a new execution end cannot be dynamically specified.
The method further comprises the following steps: in the case that the test task includes a plurality of test scenarios; the execution end establishes a thread according to each test scene; and the execution end executes the threads, wherein the number of the threads which are executed concurrently does not exceed a preset threshold value.
If a plurality of test scenarios exist in one test task and the test cases are non-interface operation test cases, the test cases are executed in parallel on the execution end.
Under the condition that the test task comprises a plurality of scenes, the execution end establishes subdirectories in a directory established by the initialized test result set according to the identifiers of the test scenes (such as scene names, scene numbers and the like), and downloads the configured test case codes into the subdirectories corresponding to the test scenes, wherein each scene corresponds to one subdirectory. When test scene data is initialized, the data under different test scenes are generated into configuration information under corresponding test scenes. Each test scenario may correspond to a thread of execution of the test code, and each thread is used for executing the test code in the corresponding test scenario directory.
The automatic testing of a plurality of scenes can be started in a thread pool mode, and a threshold value is set for the concurrency number of threads in advance, so that the problem that the system is halted due to too many threads which are started due to too many testing scenes is avoided. After the test code is executed, analyzing a required execution result according to the code execution log, writing the result into different test scene result data in the test result set according to the identification of the test scene, releasing the thread, and continuously executing the thread of the next test scene to be executed by the thread pool. And ending the current test task until no test scene thread to be executed exists in the thread pool and the current thread is executed.
Further, in the case of no available execution end, the virtual machine or container may be started locally (i.e., on the server side), and the configuration of the execution end, i.e., the execution of the local automated test task, may be deployed in its system. The local network can access the corresponding test environment (i.e. execution end) network, the test environment network can not access the local network, the virtual machine or the container can share the same network authority with the local network by adopting a network sharing mode, and the communication mode of the test message is a mode that a consumer pulls the message to a producer, so that the test task can be executed in the local virtual machine or the container, and meanwhile, when the existing execution end environment does not meet the requirement of the corresponding automatic test environment, the automatic test can be realized by adopting the mode.
Example code for the execution end to receive the test message and execute the test case is as follows:
Figure BDA0001944593510000141
Figure BDA0001944593510000151
Figure BDA0001944593510000161
fig. 4 is a schematic diagram of the main part of the server side of an automatic testing device 400 according to an embodiment of the present invention, as shown in fig. 4:
the selection module 401 at the server side is configured to select a test task, where the test task includes one or more test cases. The server side selects the test task and simultaneously determines the test case included in the test task and the data of the test scene included in the test case.
An initial module 402 of the server side, configured to establish a test result set according to the test task. Further, the test result set may also be stored in the node, and the test result set may be initialized first when the test result set is established.
A message module 403 of the server side, configured to send a test message, where the test message includes an identifier of the test result set. The server end and the execution end of the automatic test communicate through the test message, and the test message can be stored in the test message queue. The test task node may include a message queue name in a root node of the test plan where the test task node is located, and when a corresponding test task is executed, the test task node may be distributed to the test terminal according to the message queue name, and the test message includes an identifier of a test result set that has been initialized and is corresponding to the test task node to be executed.
The selection module 401 at the server is further configured to change the association relationship between the test tasks by changing the parent node and/or the child node of the node.
The apparatus 400 further comprises: the test task organization module is used for storing the test tasks in a tree structure, the test tasks are stored in nodes of the tree structure, and the nodes have unique identifiers; the node is provided with a father node and/or a son node, wherein the father node and/or the son node stores the testing task related to the testing task. When the selection module 401 at the server side selects the test task, only the required test task or the node of the test subtask needs to be selected, the execution logic of the test task is used as the recursion relation of the tree structure to construct the test plan of the tree structure, or the recursion relation between the nodes of the test task is modified on the basis of the existing test plan to construct the test plan of the tree structure, so that the problem of executing the automated test by crossing the root test plan is solved. Furthermore, when the content of the node is changed, the content of the parent node and the root node of the node is not influenced. Furthermore, because different types of automated test frames have different attribute values, but the configuration process of the automated test system is a relatively abstract process and is not related to a specific test task type, when an automated tester modifies information under a test task sub-node, a test plan can be automatically updated, the problem that two sets of test plans need to be maintained simultaneously is solved, and the problem that the same task is executed simultaneously can be solved because the test tasks generated synchronously are still the same task.
Fig. 5 is a schematic diagram of a main part of an execution end of an automated testing method apparatus 400 according to an embodiment of the present invention, as shown in fig. 5:
the receiving module 501 of the executing end is configured to determine the identity of the test result set from the test message.
And the positioning module 502 of the execution end is configured to query the test result set according to the identifier of the test result set.
And the execution module 503 of the execution end is configured to execute the test case in the test task.
And the storage module 504 of the execution end is configured to store the execution result of the test case to the test result set.
After receiving the test message sent by the server, the receiving module 501 of the execution end parses the test message to obtain an identifier of the test result set, and the positioning module 502 of the execution end queries the test result set according to the identifier of the test result set, so that a directory can be established in the test result set, a corresponding test environment is initialized according to data of a root node of the test plan, and a test code included in the test task is downloaded (the test code is an implementation of a test case). And generating corresponding calling configuration information in a corresponding directory of the test code according to the test case and the test scene data. According to the configuration information, the execution module 503 of the execution end executes the test code. After the execution is completed, the required execution result is analyzed according to the execution log of the test code, the storage module 504 of the execution end stores the result into the test result set, and writes the corresponding value in the scene data into the checkpoint result list under different scenes. And finishing the execution of the test task. The execution end can continue to execute and wait for receiving the test message sent by the server end so as to execute other test tasks. In the traditional automatic test, the execution end scheduling needs an execution end resource pool, the network address of the execution end is bound, and a new execution end cannot be dynamically specified. The execution end is used for sharing the calculated amount of the server end, and when the number of the execution ends is large, the pressure on the automatic system is small.
The apparatus 400 further includes a thread module of the execution end, configured to establish a thread according to each test scenario when the test case includes multiple test scenarios. The execution module 503 of the execution end is further configured to execute the threads, where the number of concurrently executing the threads does not exceed a preset threshold. The automatic testing of a plurality of scenes can be started in a thread pool mode, and a threshold value is set for the concurrency number of threads in advance, so that the problem that the system is halted due to too many threads which are started due to too many testing scenes is avoided. After the test code is executed, analyzing a required execution result according to the code execution log, writing the result into different test scene result data in the test result set according to the identification of the test scene, releasing the thread, and continuously executing the thread of the next test scene to be executed by the thread pool. And ending the current test task until no test scene thread to be executed exists in the thread pool and the current thread is executed.
Fig. 6 illustrates an exemplary system architecture 600 of an automated testing method or an automated testing apparatus to which embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. Various communication client applications, such as database applications, automation test applications, etc., may be installed on the terminal devices 601, 602, 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server that provides various services, such as a background management server that provides support for users using the terminal devices 601, 602, 603. The background management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, test task node information) to the terminal device.
It should be noted that, an automated testing method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, an automated testing apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
FIG. 7 is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
To the I/O interface 705, AN input section 706 including a keyboard, a mouse, and the like, AN output section 707 including a keyboard such as a Cathode Ray Tube (CRT), a liquid crystal display (L CD), and the like, a speaker, and the like, a storage section 708 including a hard disk and the like, and a communication section 709 including a network interface card such as a L AN card, a modem, and the like, the communication section 709 performs communication processing via a network such as the internet, a drive 710 is also connected to the I/O interface 705 as necessary, a removable medium 711 such as a magnetic disk, AN optical disk, a magneto-optical disk, a semiconductor memory, and the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, the processes described in the above step diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, the disclosed embodiments of the invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the step diagrams. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable media shown in the present invention include computer readable signal media or computer readable storage media, or any combination of the two. A computer readable storage medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, semiconductor system, apparatus, or device, or any combination of the foregoing. Computer-readable storage media specifically include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any combination of the foregoing. In the present invention, a computer readable storage medium includes any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device; a computer readable signal medium includes a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave, which may take many forms, including, but not limited to, electromagnetic signals, optical signals, or any combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF (radio frequency), etc., or any combination of the preceding.
The block diagrams or step diagrams in the figures, which illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention, may each represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or step diagrams, and combinations of blocks in the block diagrams or step diagrams, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware. The described modules or units may also be provided in a processor, and may be described as: a processor comprises a selection module of a server end, an initial module of the server end and a message module of the server end. Where the names of these modules or units do not in some cases constitute a definition of the module or unit itself, for example, the initial module on the server side may also be described as a "module for building a test result set from the test tasks".
On the other hand, the embodiment of the present invention also provides a computer-readable medium, which may be included in the apparatus described in the above embodiment; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: the method comprises the steps that a server side selects a test task, wherein the test task comprises one or more test cases; the server side establishes a test result set according to the test task; and the server side sends a test message, wherein the test message comprises the identification of the test result set.
According to the technical scheme of the embodiment of the invention, the expandability of the automatic test system can be increased, the workload of daily maintenance of the automatic test system and the system complexity caused by requirement change are reduced, and the execution end and the server end can realize automatic association without binding.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. An automated testing method, comprising:
the method comprises the steps that a server side selects a test task, wherein the test task comprises one or more test cases;
the server side establishes a test result set according to the test task;
and the server side sends a test message, wherein the test message comprises the identification of the test result set.
2. The method of claim 1, further comprising:
the execution end determines the identification of the test result set from the test message;
the execution end inquires the test result set according to the identification of the test result set;
the execution end executes the test case in the test task;
and the execution end stores the execution result of the test case to the test result set.
3. The method of claim 2, further comprising:
under the condition that the test case comprises a plurality of test scenes;
the execution end establishes a thread according to each test scene;
and the execution end executes the threads, wherein the number of the threads which are executed concurrently does not exceed a preset threshold value.
4. The method of claim 1, further comprising:
storing the test tasks in a tree structure, wherein the test tasks are stored in nodes of the tree structure, and the nodes have unique identifiers;
the node is provided with a father node and/or a son node, wherein the father node and/or the son node stores the testing task related to the testing task.
5. The method of claim 4, further comprising:
and changing the incidence relation among the test tasks by changing the father node and/or the child node of the node.
6. An automated testing apparatus, comprising:
the selection module of the server side is used for selecting a test task, and the test task comprises one or more test cases;
the initial module of the server end is used for establishing a test result set according to the test task;
and the message module of the server side is used for sending a test message, wherein the test message comprises the identification of the test result set.
7. The apparatus of claim 6, further comprising:
the receiving module of the execution end is used for determining the identification of the test result set from the test message;
the positioning module of the execution end is used for inquiring the test result set according to the identification of the test result set;
the execution module of the execution end is used for executing the test case in the test task;
and the storage module of the execution end is used for storing the execution result of the test case to the test result set.
8. The apparatus according to claim 7, wherein the apparatus further comprises a thread module of the execution end, configured to establish a thread according to each test scenario when the test case includes multiple test scenarios;
the execution module of the execution end is further used for executing the threads, wherein the number of the threads which are executed concurrently does not exceed a preset threshold value.
9. The apparatus of claim 6, further comprising:
the test task organization module is used for storing the test tasks in a tree structure, the test tasks are stored in nodes of the tree structure, and the nodes have unique identifiers;
the node is provided with a father node and/or a son node, wherein the father node and/or the son node stores the testing task related to the testing task.
10. The apparatus according to claim 9, wherein the selection module at the server side is further configured to change the association relationship between the test tasks by changing the parent node and/or the child node of the node.
11. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by one or more processors, carries out the method according to any one of claims 1-5.
CN201910032061.9A 2019-01-14 2019-01-14 Automatic testing method and device Pending CN111435329A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910032061.9A CN111435329A (en) 2019-01-14 2019-01-14 Automatic testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910032061.9A CN111435329A (en) 2019-01-14 2019-01-14 Automatic testing method and device

Publications (1)

Publication Number Publication Date
CN111435329A true CN111435329A (en) 2020-07-21

Family

ID=71579860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910032061.9A Pending CN111435329A (en) 2019-01-14 2019-01-14 Automatic testing method and device

Country Status (1)

Country Link
CN (1) CN111435329A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860581A (en) * 2021-03-18 2021-05-28 浙江诺诺网络科技有限公司 Test case execution method, device, equipment and storage medium
CN114138725A (en) * 2021-12-08 2022-03-04 北京志凌海纳科技有限公司 Hierarchical log storage processing method
CN114812695A (en) * 2022-06-27 2022-07-29 芯耀辉科技有限公司 Product testing method and device, computer equipment and storage medium
CN112860581B (en) * 2021-03-18 2024-04-26 浙江诺诺网络科技有限公司 Execution method, device, equipment and storage medium of test case

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860581A (en) * 2021-03-18 2021-05-28 浙江诺诺网络科技有限公司 Test case execution method, device, equipment and storage medium
CN112860581B (en) * 2021-03-18 2024-04-26 浙江诺诺网络科技有限公司 Execution method, device, equipment and storage medium of test case
CN114138725A (en) * 2021-12-08 2022-03-04 北京志凌海纳科技有限公司 Hierarchical log storage processing method
CN114812695A (en) * 2022-06-27 2022-07-29 芯耀辉科技有限公司 Product testing method and device, computer equipment and storage medium
CN114812695B (en) * 2022-06-27 2022-10-28 芯耀辉科技有限公司 Product testing method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US10171377B2 (en) Orchestrating computing resources between different computing environments
CN107391629B (en) Method, system, server and computer storage medium for data migration between clusters
CN109408205B (en) Task scheduling method and device based on hadoop cluster
CN107807815B (en) Method and device for processing tasks in distributed mode
US9823991B2 (en) Concurrent workload simulation for application performance testing
CN109032796B (en) Data processing method and device
CN111897633A (en) Task processing method and device
CN111324606B (en) Data slicing method and device
CN113298503A (en) Government affair-oriented workflow management system and database and table dividing method thereof
CN111475564A (en) Streaming data processing method, system, computer equipment and storage medium
CN107133231B (en) Data acquisition method and device
CN110471754A (en) Method for exhibiting data, device, equipment and storage medium in job scheduling
CN111399764A (en) Data storage method, data reading device, data storage equipment and data storage medium
CN113076304A (en) Distributed version management method, device and system
CN111984505A (en) Operation and maintenance data acquisition engine and acquisition method
CN111435329A (en) Automatic testing method and device
CN110795332A (en) Automatic testing method and device
CN109117199B (en) Configuration management method and device for distributed program
CN111414422B (en) Data distribution method, device, equipment and storage medium
CN111444148B (en) Data transmission method and device based on MapReduce
CN111159207B (en) Information processing method and device
Wang et al. Federated MapReduce to transparently run applications on multicluster environment
CN113535220A (en) Code packet management method and device
CN114443294B (en) Big data service component deployment method, system, terminal and storage medium
US9059992B2 (en) Distributed mobile enterprise application platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination