Disclosure of Invention
In view of the above, an object of the present invention is to provide a method and a system for automatically requesting a test, which are capable of facilitating and using test cases, ensuring smooth execution of a test on a business process related to software before online, and achieving a technical effect of saving test time of a business process interface before online.
In a first aspect, an embodiment of the present invention provides an automated test request method, applied to a test management server, including: obtaining a test case to be tested; acquiring a test service flow model, and executing test operation on each test case based on flow parameters carried in the test service flow model, wherein the flow parameters comprise an execution sequence and/or an execution condition of the test case; in the process of executing test operation on the test cases, comparing the test result data of each test case with the corresponding expected result data; and if the comparison is successful, executing the test operation on the next test case according to the test service flow model.
Further, executing the test operation on each test case includes: acquiring a uniform resource locator in the test case; sending a test request and test parameters in the test case to a target server through the uniform resource locator; and obtaining test result data fed back by the target server based on the test parameters.
Further, executing the test operation on the next test case according to the test service flow model includes: judging whether the next test operation of the test service flow model is a jump operation test or not according to the jump information in the test case; if the test is the jump operation test, executing the jump operation, and executing the test operation of the next test case according to the execution sequence under the condition that the execution of the jump operation is successful; if the execution of the skip operation fails, interrupting the test of the test service flow model and sending alarm information; wherein the alarm information comprises at least one of: recording test failure and test case information of the test failure; and if the test result is not the jump operation test, executing the test operation of the next test case according to the execution sequence.
Further, the method further comprises: if the comparison between the test result data of each test case and the corresponding expected result data fails, interrupting the test of the test service flow model and sending alarm information, wherein the alarm information comprises at least one of the following: test failure records and test case information when the test fails.
Further, the method further comprises: and storing the test record of each test case, the test result data of each test case and the comparison result between the test result data of each test case and the corresponding expected result data in the test management server in a database of the test management server.
In a first aspect, an embodiment of the present invention further provides an automated test request system, which is applied to a test management platform, and includes: the device comprises an acquisition module, an execution module, a comparison module and a result processing module, wherein the acquisition module is used for acquiring a test case to be tested; the execution module is used for acquiring a test service flow model and executing test operation on each test case based on flow parameters carried in the test service flow model, wherein the flow parameters comprise an execution sequence and/or an execution condition of the test case; the comparison module is used for comparing the test result data of each test case with the corresponding expected result data in the process of executing the test operation on the test cases; and the result processing module is used for executing the test operation on the next test case according to the test service flow model if the comparison is successful.
Further, the execution module includes: the device comprises an acquisition unit, a sending unit and a receiving unit, wherein the acquisition unit is used for acquiring the uniform resource locator in the test case; the sending unit is used for sending the test request and the test parameters in the test case to a target server through the uniform resource locator; and the receiving unit is used for acquiring the test result data fed back by the target server based on the test parameters.
Further, if the comparison is successful, the result processing module further includes a first result processing unit configured to: judging whether the next test operation of the test service flow model is a jump operation test or not according to the jump information in the test case; if the test is the jump operation test, executing the jump operation, and executing the test operation of the next test case according to the execution sequence under the condition that the execution of the jump operation is successful; if the execution of the skip operation fails, interrupting the test of the test service flow model and sending alarm information; wherein the alarm information comprises at least one of: recording test failure and test case information of the test failure; and if the test result is not the jump operation test, executing the test operation of the next test case according to the execution sequence.
Further, the result processing module further includes a second result processing unit, configured to interrupt the test of the test service flow model and send an alarm message if the test result data of each test case fails to be compared with the expected result data corresponding to the test case, where the alarm message includes at least one of: test failure records and test case information when the test fails.
Further, the system further includes a storage module, configured to store the test record of each test case in the test service flow model, the test result data of each test case, and the comparison result between the test result data of each test case and the expected result data corresponding to the test case in the database of the test management server.
In the embodiment of the invention, the test management server adopts the method to facilitate and use the test management of the test case, realize the full-automatic execution of the test of the service flow related to the software before the online, and achieve the technical effect of saving the test time of the service flow interface of the software before the online.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
in accordance with an embodiment of the present invention, there is provided an embodiment of a method for automated request testing, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than presented herein.
Fig. 1 is a flowchart of a method for automatically requesting a test according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, a test case to be tested is obtained.
The test case information to be tested comprises at least one of the following: the test result matching rule comprises a number, a Uniform Resource Locator (URL), a test parameter, a request result matching rule, a request result data structure, jump information and a jump link, wherein the URL is the test request link, the request result data structure is a field value list of expected result data, and the request result matching rule refers to a matching rule between the expected result data and the test result data in the field value list of the expected result data.
It should be noted that the test case to be tested is entered and stored in the database through the test management server.
Step S104, obtaining a test service flow model, and executing test operation on each test case based on flow parameters carried in the test service flow model, wherein the flow parameters comprise an execution sequence and/or an execution condition of the test case.
The test case execution conditions, the test case execution sequence, the time schedule and the like in the test service flow model can be set on a service flow model configuration panel in the test management server, and a plurality of test service flow models can be created.
And step S106, comparing the test result data of each test case with the corresponding expected result data in the process of executing the test operation on the test cases.
And step S108, if the comparison is successful, executing the test operation on the next test case according to the test service process model.
According to the method and the system for automatically requesting the test, the test case is conveniently and easily managed through the test management server, the full-automatic execution of the test of the service flow related to the software before the software is online is realized, and the technical effect of saving the test time of the service flow interface of the software before the software is online is achieved.
Specifically, as shown in fig. 2, the process of executing the test operation on each test case in step S104 includes the following steps:
step S201, a Uniform Resource Locator (URL) in a test case is obtained, wherein the test case is one of the test cases executed according to a test sequence in the test service flow model.
Step S202, sending the test request and the test parameters in the test case to the target server through the URL.
Step S203, obtaining test result data fed back by the target server based on the test parameters. The test result data is obtained after the target server tests the test parameters under the condition of responding to the test request.
Specifically, in step S108, executing a test operation on the next test case according to the test service flow model includes the following steps:
step S1081, judging whether the next test operation of the test service flow model is a skip operation test according to the skip information in the test case;
step S1082, if the jump operation test is performed, executing the jump operation, and executing the test operation of the next test case according to the execution sequence under the condition that the jump operation is successfully executed; if the execution of the skip operation fails, interrupting the test of the test service flow model and sending alarm information; wherein, the alarm information comprises at least one of the following: recording test failure and test case information of the test failure;
and step S1083, if the test is not the jump operation test, executing the test operation of the next test case according to the execution sequence.
In an optional implementation manner of the embodiment of the present invention, the method for automatically requesting a test further includes the following steps:
if the comparison between the test result data of each test case and the corresponding expected result data fails, interrupting the test of the test service flow model and sending out alarm information, wherein the alarm information comprises at least one of the following: test failure records and test case information when the test fails.
The embodiment of the invention timely feeds back the service flow with problems through the alarm information sent out when the test fails, and meanwhile, the test case information contained in the alarm information can accurately position the problem when the test fails.
It should be noted that, after the relevant personnel have repaired the found problem, the testing task of the testing business process model can be reinitiated as required.
In an embodiment of the present invention, the method further includes: and storing the test record of each test case, the test result data of each test case and the comparison result between the test result data of each test case and the corresponding expected result data in a database of the test management server in the test service flow model.
The working process of the embodiment of the present invention is described below with reference to specific examples, for example:
two obtained test cases are respectively:
test case 1:
numbering: 1
Test request chaining: jsp (i.e., login interface)
Testing parameters: root, password, ytest
Request result matching rules: equal
Request result data structure: type String value success
Jump information: is that
Jump linking: jsp
Test case 2:
numbering: 2
Test request chaining: jsp (i.e., query page)
Testing parameters: the mobile phone number is as follows: 139, identity card: 33010*
Request result matching rules: mobile phone number match139\ d {8} and identity card number match33010\ d {13}
Request result data structure: type String value mobile phone number; type String value identification number; number of lines of type int value;
jump information: is that
Jump linking: showdetail.jsp;
in the obtained test service flow model, the execution sequence of the test cases is as follows:
number 1- > number 2;
and then executing the test cases from the test case with the number 1 according to the execution sequence of the test cases:
and executing the number 1, if the returned test result is not 'success', directly interrupting the test of the test business process model, sending alarm information and informing related personnel.
And if the returned test result is 'success', executing a jump operation according to the jump information, and jumping to info.
And if the jump operation is successful, continuing to execute the test operation of the next test case according to the execution sequence, namely executing the test case 2.
Executing the number 2, returning a test result that the mobile phone number is 139-started, starting the identity number with 33010, and executing a jump operation according to the jump information to a showdetail.jsp in 28 lines; if the jump operation fails to be executed, the test of the test business process model is directly interrupted, and warning information is sent out to inform relevant personnel.
And after the test of the test service flow model is completely executed, storing the records of the two test cases, the test result data and other information into a database of the test management server.
As can be seen from the above description, the embodiment of the present invention can facilitate and facilitate management of the test case through the above method steps, and at the same time, when executing the service model to be tested, the model can be customized as needed, and when a problem occurs in the test process, the problem occurrence can be fed back and notified to the relevant technical staff, and the embodiment of the present invention can bring the following beneficial effects:
(1) the test case is convenient, easy to use and visual to manage;
(2) the creation of the test service flow model is the socket joint of the test case, and the creation is simple, easy to use, visual and high in efficiency;
(3) when the test business process model is executed, the test business process model can be executed according to needs, and when a problem occurs, an alarm can be fed back in real time, the problem is fed back, and relevant persons can be informed, so that the relevant persons can respond to the problem and quickly locate the problem at the first time, and the problem is processed;
(4) the test management server can send the execution request to the target server for multiple times as required according to the test service flow model, so that the test time of the service flow interface before the service flow interface is on line can be greatly saved, and the efficiency is improved.
Example two:
the embodiment of the present invention further provides an automatic test request system, which is mainly used for executing the method for automatic test request provided by the above-mentioned content of the embodiment of the present invention, and the following describes the system for automatic test request provided by the embodiment of the present invention in detail.
Fig. 3 is a schematic diagram of an automated request test system according to an embodiment of the present invention, and as shown in fig. 3, the automated request test system mainly includes: an acquisition module 10, an execution module 20, a comparison module 30 and a result processing module 40, wherein,
an obtaining module 10, configured to obtain a test case to be tested; wherein, the test case is the test case in the embodiment 1;
the execution module 20 is configured to obtain a test service flow model, and execute a test operation on each test case based on flow parameters carried in the test service flow model, where the flow parameters include an execution sequence and/or an execution condition of the test case;
the comparison module 30 is configured to compare the test result data of each test case with the expected result data corresponding to the test result data in the process of executing the test operation on the test case;
and the result processing module 40 is configured to, if the comparison is successful, execute a test operation on a next test case according to the test service flow model.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Fig. 4 is a block diagram of another execution module 20 according to an embodiment of the present invention, which includes: an acquisition unit 21, a transmission unit 22 and a reception unit 23, wherein,
an obtaining unit 21, configured to obtain a uniform resource locator URL in a test case;
a sending unit 22, configured to send a test request and test parameters in the test case to the target server through the URL;
and the receiving unit 23 is configured to obtain test result data fed back by the target server based on the test parameters.
Optionally, the result processing module 40 further comprises a first result processing unit 41 configured to:
if the test result data of each test case is successfully compared with the corresponding expected result data, judging whether the next test operation of the test service flow model is a skip operation test or not according to the skip information in the test case;
if the test is the jump operation test, executing the jump operation, and executing the test operation of the next test case according to the execution sequence under the condition that the execution of the jump operation is successful; if the execution of the skip operation fails, interrupting the test of the test service flow model and sending alarm information; wherein, the alarm information comprises at least one of the following: recording test failure and test case information of the test failure;
and if the test is not the jump operation test, executing the test operation of the next test case according to the execution sequence.
Optionally, the result processing module 40 further includes a second result processing unit 42, configured to interrupt the test of the test service flow model and send an alarm message if the test result data of each test case fails to be compared with the expected result data corresponding to the test case, where the alarm message includes at least one of: test failure records and test case information when the test fails.
Optionally, the system further includes a storage module 50, configured to store the test record of each test case in the test service flow model, the test result data of each test case, and the comparison result between the test result data of each test case and the expected result data corresponding to the test case in a database of the test management server.
As can be seen from the above description, the embodiment of the present invention can facilitate and facilitate management of the test case through the above method steps, and simultaneously, when the service model to be tested is executed, the model can be customized as needed, and when a problem occurs in the test process, the problem can be fed back and related technicians can be notified, thereby achieving the technical effect of saving the test time of the service flow interface before software is on-line.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also 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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.