CN113064810A - Automatic testing method and device - Google Patents
Automatic testing method and device Download PDFInfo
- Publication number
- CN113064810A CN113064810A CN202010001194.2A CN202010001194A CN113064810A CN 113064810 A CN113064810 A CN 113064810A CN 202010001194 A CN202010001194 A CN 202010001194A CN 113064810 A CN113064810 A CN 113064810A
- Authority
- CN
- China
- Prior art keywords
- test case
- task
- interface
- test
- 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
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 470
- 238000013142 basic testing Methods 0.000 claims abstract description 46
- 238000000034 method Methods 0.000 claims abstract description 25
- 238000012986 modification Methods 0.000 claims description 10
- 230000004048 modification Effects 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 238000010586 diagram Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 238000004458 analytical method Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000010998 test method Methods 0.000 description 4
- 230000008901 benefit Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000012827 research and development Methods 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 239000013589 supplement Substances 0.000 description 2
- 239000000725 suspension Substances 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000012938 design process Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses an automatic testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: after the interface registration is finished, creating a test case generation task according to interface information, interface access rules and task execution time provided by a user; and when the execution time of the test case generation task is reached, executing the test case generation task, generating a test case according to the interface information, the interface parameter entering rule and the basic test case in the template library, and storing the test case into a test case set. The implementation method can solve the technical problem that the automation degree of the interface test is not high.
Description
Technical Field
The invention relates to the technical field of computers, in particular to an automatic testing method and device.
Background
The interface test is mainly used for detecting interaction points between external systems and between each subsystem in the system, and the test is mainly used for checking the exchange, transmission and control management processes of data, mutual logic dependency relations between systems and the like.
At present, interface testing is mainly realized by designing and writing an interface test case by developers or test development engineers, and then writing a program to call or using some tools to execute the interface testing.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
in the design process of the interface test case, the analysis methods such as boundary values, equivalence classes and the like are basically fixed aiming at the input reference case of the original type (data type provided by a programming language) of the interface, and the defects of repeated work and low human efficiency exist in manual writing; the dependence degree of the self-written program on the technical level of testers for interface test is large, the technical capabilities of different testers are different, and errors exist in the execution of test results; the automatic use case that the tester maintains by oneself, non-tester can't operate the corresponding use case, cause the execution rate of automatic use case not high, it is not obvious to improve the effect of whole research and development personnel.
Disclosure of Invention
In view of this, embodiments of the present invention provide an automatic testing method and apparatus to solve the technical problem of low automation degree of interface testing.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an automated testing method including:
after the interface registration is finished, creating a test case generation task according to interface information, interface access rules and task execution time provided by a user;
and when the execution time of the test case generation task is reached, executing the test case generation task, generating a test case according to the interface information, the interface parameter entering rule and the basic test case in the template library, and storing the test case into a test case set.
Optionally, after storing the test case into the test case set, the method further includes:
and responding to the modification operation of the user on the test case, and updating the modified test case to the test case set.
Optionally, when the execution time of the test case generation task is reached, executing the test case generation task, so as to generate a test case according to the interface information, the interface entry rule, and a basic test case in a template library, including:
polling a test case generation task at fixed time, and inserting the test case generation task into a test case generation task queue;
traversing each test case generation task in the test case generation task queue, and locking the test case generation task when the execution time of the test case generation task is reached;
traversing each interface in the test case generation task, and calling a test case generation service, so as to respectively generate corresponding test cases according to the interface information of each interface, the interface parameter entering rule and the basic test cases in the template library;
and after the test case generation task is completed, unlocking the test case generation task.
Optionally, after storing the test case into the test case set, the method further includes:
creating a test case execution task according to a to-be-tested interface, an alarm rule and a task execution rule provided by a user;
and when the execution time of the test case execution task is reached, executing the test case execution task, thereby obtaining the test case corresponding to the interface to be tested from the test case set, executing the test case and receiving the test result.
Optionally, when the execution time of the test case execution task is reached, the test case execution task is executed, so that the test case corresponding to the interface to be tested is obtained from the test case set, and the executing of the test case includes:
polling the test case execution task at regular time, and inserting the test case execution task into a test case execution task queue;
traversing each test case execution task in the test case execution task queue, and locking the test case execution task when the execution time of the test case execution task is reached;
traversing each interface to be tested in the test case generation task, obtaining a test case corresponding to each interface to be tested from the test case set, and executing the test case;
and after the test case execution task is completed, unlocking the test case execution task.
Optionally, the method further comprises:
after completing the execution tasks of all test cases, generating a test result mail according to a test result, and inserting the pushing task of the test result mail into a pushing task queue;
and when the test result is matched with the alarm rule, generating an alarm mail and/or an alarm short message, and inserting a pushing task of the alarm mail and/or the alarm short message into a pushing task queue.
Optionally, before completing the interface registration, the method further includes:
and receiving the basic test cases uploaded by the user and the matching rules corresponding to the basic test cases, wherein the matching rules are used for defining the matching relation between each basic test case and the original type of the interface.
In addition, according to another aspect of an embodiment of the present invention, there is provided an automated testing apparatus including:
the creating module is used for creating a test case generation task according to interface information, interface parameter entering rules and task execution time provided by a user after the interface registration is finished;
and the execution module is used for executing the test case generation task when the execution time of the test case generation task is reached, so that a test case is generated according to the interface information, the interface parameter rule and the basic test case in the template library, and the test case is stored in a test case set.
Optionally, the execution module is further configured to:
and after the test case is stored in the test case set, responding to the modification operation of the user on the test case, and updating the modified test case into the test case set.
Optionally, the execution module is further configured to:
polling a test case generation task at fixed time, and inserting the test case generation task into a test case generation task queue;
traversing each test case generation task in the test case generation task queue, and locking the test case generation task when the execution time of the test case generation task is reached;
traversing each interface in the test case generation task, and calling a test case generation service, so as to respectively generate corresponding test cases according to the interface information of each interface, the interface parameter entering rule and the basic test cases in the template library;
and after the test case generation task is completed, unlocking the test case generation task.
Optionally, the creating module is further configured to:
after the test cases are stored in the test case set, creating test case execution tasks according to the interface to be tested, the alarm rules and the task execution rules provided by the user;
the execution module is further to:
and when the execution time of the test case execution task is reached, executing the test case execution task, thereby obtaining the test case corresponding to the interface to be tested from the test case set, executing the test case and receiving the test result.
Optionally, the execution module is further configured to:
polling the test case execution task at regular time, and inserting the test case execution task into a test case execution task queue;
traversing each test case execution task in the test case execution task queue, and locking the test case execution task when the execution time of the test case execution task is reached;
traversing each interface to be tested in the test case generation task, obtaining a test case corresponding to each interface to be tested from the test case set, and executing the test case;
and after the test case execution task is completed, unlocking the test case execution task.
Optionally, the execution module is further configured to:
after completing the execution tasks of all test cases, generating a test result mail according to a test result, and inserting the pushing task of the test result mail into a pushing task queue;
and when the test result is matched with the alarm rule, generating an alarm mail and/or an alarm short message, and inserting a pushing task of the alarm mail and/or the alarm short message into a pushing task queue.
Optionally, the creating module is further configured to:
before the interface registration is completed, receiving basic test cases uploaded by a user and matching rules corresponding to the basic test cases, wherein the matching rules are used for defining the matching relation between the basic test cases and the original type of the interface.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
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 of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: because the technical means of creating the test case generation task according to the interface information, the interface parameter entering rule and the task execution time provided by the user and executing the test case generation task when the execution time of the test case generation task is reached is adopted, the technical problem that the automation degree of the interface test in the prior art is not high is solved. According to the embodiment of the invention, the test case is generated by combining the basic test case according to the parameter entering rule and the task execution time provided by the user, so that the compiling time of the test case is shortened. In addition, the embodiment of the invention combines the generation of the interface test case with the execution of the interface test case to provide a uniform system and form a complete closed loop; the automatic interface test is automatically executed according to the user specified rule, so that the manual participation is reduced, and the human resources and the human cost are saved; after the interface test is finished, a test result mail is automatically generated and synchronously sent, so that the delay of obtaining the test result is reduced; when the interface test case is returned at regular time, the test case is continuously observed, and the tracking analysis of the interface quality is realized.
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 a main flow of an automated testing method according to an embodiment of the invention;
FIG. 2 is a schematic view showing a main flow of an automated test method according to a referential embodiment of the present invention
FIG. 3 is a schematic view of a main flow of an automated test method according to still another referential embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of an automated test equipment according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 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 a main flow of an automated testing method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the automated testing method may include:
step 101, after the interface registration is completed, creating a test case generation task according to interface information, an interface parameter rule and task execution time provided by a user.
Usually, a developer registers an interface and specifies a registration protocol and an entry rule corresponding to the interface. The interface registration protocol appoints the registration mode of the interface, makes clear rules on how the interface is bound to the system, and the system can acquire interface information according to the mode specified by the protocol. When the interface is released, the release information (such as release time, interface name, interface alias, etc.) is recorded, and the access rule and address information of the interface are stored.
After the interface registration is completed, the tester can continue to provide the task execution time, and the test case generation task is automatically created according to the interface information, the interface parameter entering rule and the task execution time in response to the task generation operation of the tester.
Optionally, before step 101, the method may further include: and receiving the basic test cases uploaded by the user and the matching rules corresponding to the basic test cases, wherein the matching rules are used for defining the matching relation between each basic test case and the original type of the interface. And the basic test cases uploaded by the tester enter the template library, corresponding matching rules are established for the basic test cases in the template library in the rule management, and the case management also comprises a test case set approved by the tester.
And 102, when the execution time of the test case generation task is reached, executing the test case generation task, generating a test case according to the interface information, the interface parameter rule and a basic test case in a template library, and storing the test case into a test case set.
Optionally, when the execution time of the test case generation task is reached, executing the test case generation task, so that generating a test case according to the interface information, the interface entry rule, and the basic test case in the template library may include: polling a test case generation task at fixed time, and inserting the test case generation task into a test case generation task queue; traversing each test case generation task in the test case generation task queue, and locking the test case generation task when the execution time of the test case generation task is reached; traversing each interface in the test case generation task, and calling a test case generation service, so as to respectively generate corresponding test cases according to the interface information of each interface, the interface parameter entering rule and the basic test cases in the template library; and after the test case generation task is completed, unlocking the test case generation task. In the embodiment of the invention, a rule engine polls a test case generation task at regular time, generates a test case generation task queue, locks the test case generation task when a task execution time is reached or a task is not completed, traverses an interface (the task and the interface present a 1: N relationship) in the test case generation task, and calls a test case generation service to generate the test case; and before the test case generation is carried out on each interface, locking the test case generation task, and unlocking the test case generation task after the generation is finished.
After step 102, may further include: and responding to the modification operation of the user on the test case, and updating the modified test case to the test case set. Because the scene coverage of the automatically generated interface test case is not necessarily comprehensive, manual intervention is needed, and a tester adjusts data or supplements the scene according to the generated interface test case to form a final interface test case set.
According to the various embodiments, the technical means that the test case generation task is created according to the interface information, the interface access parameter rule and the task execution time provided by the user and is executed when the execution time of the test case generation task is reached is adopted, and the technical problem that the automation degree of the interface test in the prior art is low is solved. According to the embodiment of the invention, the test case is generated by combining the basic test case according to the parameter entering rule and the task execution time provided by the user, so that the compiling time of the test case is shortened.
Fig. 2 is a schematic view of a main flow of an automated test method according to a referential embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 2, the automated testing method may include:
step 201, receiving basic test cases uploaded by a user and matching rules corresponding to the basic test cases, where the matching rules are used to define matching relationships between the basic test cases and the original types of the interfaces.
Step 202, after the interface registration is completed, creating a test case generation task according to the interface information, the interface parameter entering rule and the task execution time provided by the user.
And 203, when the execution time of the test case generation task is reached, executing the test case generation task, so as to generate a test case according to the interface information, the interface parameter rule and the basic test case in the template library, and storing the test case into a test case set.
And 204, responding to the modification operation of the user on the test case, and updating the modified test case to the test case set.
Step 205, creating a test case execution task according to the interface to be tested, the alarm rule and the task execution rule provided by the user.
After selecting the interface, the user may provide alarm rules and task execution rules for creating test case execution tasks. The task execution rule specifies the specific execution time of the task, and whether the task is repeatedly executed or not, and a similar Cron expression mode can be adopted. Cron expression: is a character string expressing the time dimension, which is composed of 6 (or 7) characters separated by spaces and can represent a time point or a time range. There may be different syntax formats for different timing task frameworks. According to the set task execution rule, one test task can be executed for multiple times, and multiple test records are provided and correspond to different test results respectively.
And setting an alarm rule to alarm when the evaluation result reaches a specified state or threshold value. The user can also specify the receiver of the test result and the alarm information, such as configuring short messages, mails and the like.
And step 206, when the execution time of the test case execution task is reached, executing the test case execution task, thereby obtaining the test case corresponding to the interface to be tested from the test case set, executing the test case, and receiving the test result.
Optionally, when the execution time of the test case execution task is reached, the test case execution task is executed, so that the test case corresponding to the interface to be tested is obtained from the test case set, and the executing of the test case includes: polling the test case execution task at regular time, and inserting the test case execution task into a test case execution task queue; traversing each test case execution task in the test case execution task queue, and locking the test case execution task when the execution time of the test case execution task is reached; traversing each interface to be tested in the test case generation task, obtaining a test case corresponding to each interface to be tested from the test case set, and executing the test case; and after the test case execution task is completed, unlocking the test case execution task. In the embodiment of the invention, a rule engine polls a test case execution task at regular time to generate a test case execution task queue, locks the test case execution task when a task execution time is reached or a task is not completed, traverses an interface to be tested in the test case execution task (the task and the interface present a 1: N relationship), acquires a test case corresponding to each interface to be tested from the test case set, and executes the test case; and after the test case execution task is completed, unlocking the test case execution task.
And step 207, after all test case execution tasks are completed, generating a test result mail according to the test result, and inserting the pushing task of the test result mail into a pushing task queue.
And 208, when the test result is matched with the alarm rule, generating an alarm mail and/or an alarm short message, and inserting a pushing task of the alarm mail and/or the alarm short message into a pushing task queue. The alarm mode can use short message, mail, etc. to send alarm to the appointed receiver.
And the push engine polls the push task queue at regular time and actively pushes information when a task to be pushed exists.
It should be noted that, during the execution of the test task, the user may select whether to suspend the task, and after the user selects suspension, the user detects the task suspension information, that is, suspends the generation or execution of the test case for the interface under the task. The suspended task may perform a resume operation. The user can edit and modify the task information at any time without influencing the task which is currently generated or executed by the test case.
According to the various embodiments, the technical means that the test case execution task is created according to the interface to be tested, the alarm rule and the task execution rule provided by the user and is executed when the execution time of the test case execution task is reached is adopted, and the technical problem that the automation degree of the interface test in the prior art is low is solved. According to the embodiment of the invention, the test case is generated by combining the basic test case according to the parameter entering rule and the task execution time provided by the user, so that the compiling time of the test case is shortened. In addition, the embodiment of the invention combines the generation of the interface test case with the execution of the interface test case to provide a uniform system and form a complete closed loop; the automatic interface test is automatically executed according to the user specified rule, so that the manual participation is reduced, and the human resources and the human cost are saved; after the interface test is finished, a test result mail is automatically generated and synchronously sent, so that the delay of obtaining the test result is reduced; when the interface test case is returned at regular time, the test case is continuously observed, and the tracking analysis of the interface quality is realized.
Therefore, the embodiment of the invention combines the compiling of the test case and the continuous integration of the execution of the test case, improves the execution rate of the automatic case by shortening the time for the tester to compile the interface test case, further improves the efficiency of the tester and reduces the research and development cost of software.
Fig. 3 is a schematic view of a main flow of an automated testing method according to still another referential embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 3, the automated testing method may include:
the method comprises the steps that a tester uploads a test case template library, wherein the test case template library comprises basic test cases and matching rules corresponding to the basic test cases, and the matching rules are used for defining the matching relation between the basic test cases and the original type of an interface.
And the developer registers the interface, submits interface information, an interface parameter entering rule and task execution time, and creates a test case generation task according to the interface information, the interface parameter entering rule and the task execution time of the interface.
Polling a test case generation task at fixed time, and inserting the test case generation task into a test case generation task queue; traversing each test case generation task in the test case generation task queue, and locking the test case generation task when the execution time of the test case generation task is reached; traversing each interface in the test case generation task, and calling a test case generation service, so as to respectively generate corresponding test cases according to the interface information of each interface, the interface parameter entering rule and the basic test cases in the template library; and after the test case generation task is completed, unlocking the test case generation task, and storing the test case into a test case set.
And informing the execution receiver that the test case is generated by a mail or a short message.
And responding to the modification operation of the test case by the tester, and updating the modified test case to the test case set. Because the scene coverage of the automatically generated interface test case is not necessarily comprehensive, manual intervention is needed, and a tester adjusts data or supplements the scene according to the generated interface test case to form a final interface test case set.
And creating a test case execution task according to the interface to be tested, the alarm rule and the task execution rule provided by the user.
Polling the test case execution task at regular time, and inserting the test case execution task into a test case execution task queue; traversing each test case execution task in the test case execution task queue, and locking the test case execution task when the execution time of the test case execution task is reached; traversing each interface to be tested in the test case generation task, obtaining a test case corresponding to each interface to be tested from the test case set, and executing the test case; and after the test case execution task is completed, unlocking the test case execution task.
After all test case execution tasks are completed, generating a test result mail according to a test result, and inserting a pushing task of the test result mail into a pushing task queue.
And when the test result is matched with the alarm rule, generating an alarm mail and/or an alarm short message, and inserting a pushing task of the alarm mail and/or the alarm short message into a pushing task queue. The alarm mode can use short message, mail, etc. to send alarm to the appointed receiver.
In addition, in another embodiment of the present invention, the details of the automatic testing method are described in detail above, and therefore the repeated description is not repeated here.
Fig. 4 is a schematic diagram of main modules of an automatic test apparatus according to an embodiment of the present invention, and as shown in fig. 4, the automatic test apparatus 400 includes a creation module 401 and an execution module 402. The creating module 401 is configured to create a test case generation task according to interface information, an interface entry rule, and a task execution time provided by a user after interface registration is completed; the execution module 402 is configured to execute the test case generation task when the execution time of the test case generation task is reached, so as to generate a test case according to the interface information, the interface entry rule, and a basic test case in a template library, and store the test case in a test case set.
Optionally, the executing module 402 is further configured to:
and after the test case is stored in the test case set, responding to the modification operation of the user on the test case, and updating the modified test case into the test case set.
Optionally, the executing module 402 is further configured to:
polling a test case generation task at fixed time, and inserting the test case generation task into a test case generation task queue;
traversing each test case generation task in the test case generation task queue, and locking the test case generation task when the execution time of the test case generation task is reached;
traversing each interface in the test case generation task, and calling a test case generation service, so as to respectively generate corresponding test cases according to the interface information of each interface, the interface parameter entering rule and the basic test cases in the template library;
and after the test case generation task is completed, unlocking the test case generation task.
Optionally, the creating module 401 is further configured to:
after the test cases are stored in the test case set, creating test case execution tasks according to the interface to be tested, the alarm rules and the task execution rules provided by the user;
the execution module is further to:
and when the execution time of the test case execution task is reached, executing the test case execution task, thereby obtaining the test case corresponding to the interface to be tested from the test case set, executing the test case and receiving the test result.
Optionally, the executing module 402 is further configured to:
polling the test case execution task at regular time, and inserting the test case execution task into a test case execution task queue;
traversing each test case execution task in the test case execution task queue, and locking the test case execution task when the execution time of the test case execution task is reached;
traversing each interface to be tested in the test case generation task, obtaining a test case corresponding to each interface to be tested from the test case set, and executing the test case;
and after the test case execution task is completed, unlocking the test case execution task.
Optionally, the executing module 402 is further configured to:
after completing the execution tasks of all test cases, generating a test result mail according to a test result, and inserting the pushing task of the test result mail into a pushing task queue;
and when the test result is matched with the alarm rule, generating an alarm mail and/or an alarm short message, and inserting a pushing task of the alarm mail and/or the alarm short message into a pushing task queue.
Optionally, the creating module 401 is further configured to:
before the interface registration is completed, receiving basic test cases uploaded by a user and matching rules corresponding to the basic test cases, wherein the matching rules are used for defining the matching relation between the basic test cases and the original type of the interface.
According to the various embodiments, the technical means that the test case execution task is created according to the interface to be tested, the alarm rule and the task execution rule provided by the user and is executed when the execution time of the test case execution task is reached is adopted, and the technical problem that the automation degree of the interface test in the prior art is low is solved. According to the embodiment of the invention, the test case is generated by combining the basic test case according to the parameter entering rule and the task execution time provided by the user, so that the compiling time of the test case is shortened. In addition, the embodiment of the invention combines the generation of the interface test case with the execution of the interface test case to provide a uniform system and form a complete closed loop; the automatic interface test is automatically executed according to the user specified rule, so that the manual participation is reduced, and the human resources and the human cost are saved; after the interface test is finished, a test result mail is automatically generated and synchronously sent, so that the delay of obtaining the test result is reduced; when the interface test case is returned at regular time, the test case is continuously observed, and the tracking analysis of the interface quality is realized.
It should be noted that, in the implementation of the automated testing apparatus of the present invention, the above automated testing method has been described in detail, and therefore, the repeated description is not repeated here.
Fig. 5 illustrates an exemplary system architecture 500 to which the automated test method or automated test apparatus of embodiments of the invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 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 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the automated testing method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the automated testing apparatus is generally disposed in the server 505. The automatic testing method provided by the embodiment of the invention can also be executed by the terminal equipment 501, 502 and 503, and correspondingly, the automatic testing device can be arranged in the terminal equipment 501, 502 and 503.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 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. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may 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 suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable 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, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs 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 or flowchart illustration, and combinations of blocks in the block diagrams 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a creation module and an execution module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; 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: after the interface registration is finished, creating a test case generation task according to interface information, interface access rules and task execution time provided by a user; and when the execution time of the test case generation task is reached, executing the test case generation task, generating a test case according to the interface information, the interface parameter entering rule and the basic test case in the template library, and storing the test case into a test case set.
According to the technical scheme of the embodiment of the invention, because the technical means that the test case generation task is created according to the interface information, the interface parameter entering rule and the task execution time provided by the user and the test case generation task is executed when the execution time of the test case generation task is reached is adopted, the technical problem that the automation degree of the interface test in the prior art is not high is solved. According to the embodiment of the invention, the test case is generated by combining the basic test case according to the parameter entering rule and the task execution time provided by the user, so that the compiling time of the test case is shortened. In addition, the embodiment of the invention combines the generation of the interface test case with the execution of the interface test case to provide a uniform system and form a complete closed loop; the automatic interface test is automatically executed according to the user specified rule, so that the manual participation is reduced, and the human resources and the human cost are saved; after the interface test is finished, a test result mail is automatically generated and synchronously sent, so that the delay of obtaining the test result is reduced; when the interface test case is returned at regular time, the test case is continuously observed, and the tracking analysis of the interface quality is realized.
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 (10)
1. An automated testing method, comprising:
after the interface registration is finished, creating a test case generation task according to interface information, interface access rules and task execution time provided by a user;
and when the execution time of the test case generation task is reached, executing the test case generation task, generating a test case according to the interface information, the interface parameter entering rule and the basic test case in the template library, and storing the test case into a test case set.
2. The method of claim 1, wherein after storing the test cases into a test case set, further comprising:
and responding to the modification operation of the user on the test case, and updating the modified test case to the test case set.
3. The method of claim 1, wherein executing the test case generation task when the execution time of the test case generation task is reached, so as to generate a test case according to the interface information, the interface reference rule, and a basic test case in a template library, comprises:
polling a test case generation task at fixed time, and inserting the test case generation task into a test case generation task queue;
traversing each test case generation task in the test case generation task queue, and locking the test case generation task when the execution time of the test case generation task is reached;
traversing each interface in the test case generation task, and calling a test case generation service, so as to respectively generate corresponding test cases according to the interface information of each interface, the interface parameter entering rule and the basic test cases in the template library;
and after the test case generation task is completed, unlocking the test case generation task.
4. The method of claim 1, wherein after storing the test cases into a test case set, further comprising:
creating a test case execution task according to a to-be-tested interface, an alarm rule and a task execution rule provided by a user;
and when the execution time of the test case execution task is reached, executing the test case execution task, thereby obtaining the test case corresponding to the interface to be tested from the test case set, executing the test case and receiving the test result.
5. The method according to claim 4, wherein when the execution time of the test case execution task is reached, the test case execution task is executed, so that the test case corresponding to the interface to be tested is obtained from the test case set, and the executing of the test case includes:
polling the test case execution task at regular time, and inserting the test case execution task into a test case execution task queue;
traversing each test case execution task in the test case execution task queue, and locking the test case execution task when the execution time of the test case execution task is reached;
traversing each interface to be tested in the test case generation task, obtaining a test case corresponding to each interface to be tested from the test case set, and executing the test case;
and after the test case execution task is completed, unlocking the test case execution task.
6. The method of claim 4, further comprising:
after completing the execution tasks of all test cases, generating a test result mail according to a test result, and inserting the pushing task of the test result mail into a pushing task queue;
and when the test result is matched with the alarm rule, generating an alarm mail and/or an alarm short message, and inserting a pushing task of the alarm mail and/or the alarm short message into a pushing task queue.
7. The method of claim 1, prior to completing interface registration, further comprising:
and receiving the basic test cases uploaded by the user and the matching rules corresponding to the basic test cases, wherein the matching rules are used for defining the matching relation between each basic test case and the original type of the interface.
8. An automated testing apparatus, comprising:
the creating module is used for creating a test case generation task according to interface information, interface parameter entering rules and task execution time provided by a user after the interface registration is finished;
and the execution module is used for executing the test case generation task when the execution time of the test case generation task is reached, so that a test case is generated according to the interface information, the interface parameter rule and the basic test case in the template library, and the test case is stored in a test case set.
9. 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-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010001194.2A CN113064810A (en) | 2020-01-02 | 2020-01-02 | Automatic testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010001194.2A CN113064810A (en) | 2020-01-02 | 2020-01-02 | Automatic testing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113064810A true CN113064810A (en) | 2021-07-02 |
Family
ID=76558126
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010001194.2A Pending CN113064810A (en) | 2020-01-02 | 2020-01-02 | Automatic testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113064810A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017113912A1 (en) * | 2015-12-30 | 2017-07-06 | 中兴通讯股份有限公司 | Physical layer software automation test method and device |
CN108334449A (en) * | 2018-01-26 | 2018-07-27 | 北京京东金融科技控股有限公司 | A kind of method and apparatus of interface automatic test |
CN108984388A (en) * | 2018-06-01 | 2018-12-11 | 平安壹钱包电子商务有限公司 | A kind of method and terminal device generating automatic test cases |
CN110245090A (en) * | 2019-06-24 | 2019-09-17 | 四川首汽交投汽车共享科技有限公司 | A kind of interface test method |
CN110532169A (en) * | 2019-07-08 | 2019-12-03 | 平安科技(深圳)有限公司 | Interface testing case generation method, device, computer equipment and storage medium |
-
2020
- 2020-01-02 CN CN202010001194.2A patent/CN113064810A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017113912A1 (en) * | 2015-12-30 | 2017-07-06 | 中兴通讯股份有限公司 | Physical layer software automation test method and device |
CN108334449A (en) * | 2018-01-26 | 2018-07-27 | 北京京东金融科技控股有限公司 | A kind of method and apparatus of interface automatic test |
CN108984388A (en) * | 2018-06-01 | 2018-12-11 | 平安壹钱包电子商务有限公司 | A kind of method and terminal device generating automatic test cases |
CN110245090A (en) * | 2019-06-24 | 2019-09-17 | 四川首汽交投汽车共享科技有限公司 | A kind of interface test method |
CN110532169A (en) * | 2019-07-08 | 2019-12-03 | 平安科技(深圳)有限公司 | Interface testing case generation method, device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111679990B (en) | Test data generation method and device, readable medium and electronic equipment | |
CN107526623B (en) | Data processing method and device | |
CN111813685B (en) | Automatic test method and device | |
CN110879776A (en) | Test case generation method and device | |
CN110795331A (en) | Software testing method and device | |
CN112631590A (en) | Component library generation method and device, electronic equipment and computer readable medium | |
CN111414154A (en) | Method and device for front-end development, electronic equipment and storage medium | |
CN115268964A (en) | Data reinjection method and system, electronic device and readable storage medium | |
CN112860538B (en) | Method and device for carrying out interface regression test based on online log | |
CN113032004B (en) | Method, apparatus and program product for managing development jobs in a development environment | |
CN113672671A (en) | Method and device for realizing data processing | |
CN111382953A (en) | Dynamic process generation method and device | |
CN112052152A (en) | Simulation test method and device | |
CN113704079B (en) | Protobuf-based interface testing method and device | |
CN111026629A (en) | Method and device for automatically generating test script | |
CN113064810A (en) | Automatic testing method and device | |
CN114168485A (en) | Test method, device, equipment and medium | |
CN113434382A (en) | Database performance monitoring method and device, electronic equipment and computer readable medium | |
CN113011858A (en) | Audit project configuration and execution method and device | |
CN113806327A (en) | Database design method and device and related equipment | |
CN112363700A (en) | Cooperative creation method and device of intelligent contract, computer equipment and storage medium | |
CN112579428A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN113342633B (en) | Performance test method and device | |
CN113220558B (en) | Monitoring script generation method and device, and monitoring method and device | |
CN113031960B (en) | Code compiling method, device, server and storage medium |
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 |