Automated testing method and device
By creating and executing test case generation tasks based on the information provided by users in interface testing, the problem of low degree of interface testing is solved, and more efficient test case generation and execution is achieved, reducing manual participation and improving testing efficiency.
Patent Information
- Application Number
- CN202010001194.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-02
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2040-01-02
AI Technical Summary
In the prior art, the degree of automation of interface tests is not high, which leads to repeated work and low human efficiency in the design process of test cases. The technical capabilities of different testers are different, resulting in errors in the execution of test results.
By creating a test case generation task based on the user-provided interface information, interface parameter rules, and task execution time, and executing the task at a specified time, the test case is generated based on the basic test cases in the template library and stored in the test case set.
It shortens the writing time of test cases, improves the execution rate of automated use cases, reduces manual participation, saves human resources and labor costs, and implements interface quality tracking and analysis.
Smart Images

Figure CN113064810B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an automated testing method and device. Background Art
[0002] Interface testing is mainly used to detect the interaction points between external systems and between internal subsystems. The focus of the test is to check the data exchange, transmission and control management process, as well as the mutual logical dependencies between systems.
[0003] At present, the implementation of interface testing is mainly done by developers or test development engineers who design and write interface test cases themselves, and then write programs to call or use some tools to perform interface testing.
[0004] In the process of implementing the present invention, the inventors discovered that the prior art has at least the following problems:
[0005] During the interface test case design process, the boundary value, equivalence class and other analysis methods are basically fixed for the input parameter cases of the interface primitive type (data type provided by the programming language). Manual writing has the disadvantages of repetitive work and low efficiency. Writing programs for interface testing by yourself is highly dependent on the technical level of the testers. The technical capabilities of different testers are different, and there are errors in the execution of test results. The automated use cases maintained by testers themselves cannot be operated by non-tester, resulting in a low execution rate of automated use cases and no obvious effect on improving overall R&D efficiency. Summary of the Invention
[0006] In view of this, an embodiment of the present invention provides an automated testing method and apparatus to solve the technical problem of low automation level of interface testing.
[0007] To achieve the above object, according to one aspect of an embodiment of the present invention, an automated testing method is provided, comprising:
[0008] After the interface registration is completed, a test case generation task is created based on the interface information, interface input rules, and task execution time provided by the user;
[0009] When the execution time of the test case generation task is reached, the test case generation task is executed, thereby generating a test case according to the interface information, the interface input rules and the basic test cases in the template library, and storing the test case in the test case set.
[0010] Optionally, after storing the test case in a test case set, the method further includes:
[0011] In response to a user's modification operation on the test case, the modified test case is updated to the test case set.
[0012] Optionally, when the execution time of the test case generation task is reached, the test case generation task is executed, thereby generating a test case according to the interface information, the interface input rule and the basic test case in the template library, including:
[0013] Periodically poll the test case generation task and insert the test case generation task into the test case generation task queue;
[0014] 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;
[0015] Traverse each interface in the test case generation task, call the test case generation service, and generate corresponding test cases according to the interface information of each interface, interface input rules and basic test cases in the template library;
[0016] After completing the test case generation task, unlock the test case generation task.
[0017] Optionally, after storing the test case in a test case set, the method further includes:
[0018] Create test cases and execute tasks based on the test interface, alarm rules, and task execution rules provided by the user;
[0019] When the execution time of the test case execution task arrives, the test case execution task is executed, 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.
[0020] Optionally, 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, and executing the test case, includes:
[0021] Regularly poll the test case execution task and insert the test case execution task into the test case execution task queue;
[0022] 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;
[0023] 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;
[0024] After the test case execution task is completed, the test case execution task is unlocked.
[0025] Optionally, it also includes:
[0026] After all test case execution tasks are completed, a test result email will be generated based on the test results, and the push task of the test result email will be inserted into the push task queue;
[0027] When the test result matches the alarm rule, an alarm email and / or an alarm text message is generated, and a push task of the alarm email and / or the alarm text message is inserted into a push task queue.
[0028] Optionally, before completing the interface registration, the following is also included:
[0029] Receive basic test cases uploaded by users and matching rules corresponding to each basic test case, where the matching rules are used to define the matching relationship between each basic test case and the original type of the interface.
[0030] In addition, according to another aspect of the embodiments of the present invention, there is provided an automated testing device, comprising:
[0031] The creation module is used to create a test case generation task based on the interface information, interface input rules and task execution time provided by the user after the interface registration is completed;
[0032] An execution module is used to execute the test case generation task when the execution time of the test case generation task is reached, thereby generating a test case according to the interface information, the interface input rules and the basic test cases in the template library, and storing the test case in a test case set.
[0033] Optionally, the execution module is further configured to:
[0034] After the test case is stored in the test case set, in response to a user's modification operation on the test case, the modified test case is updated to the test case set.
[0035] Optionally, the execution module is further configured to:
[0036] Periodically poll the test case generation task and insert the test case generation task into the test case generation task queue;
[0037] 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;
[0038] Traverse each interface in the test case generation task, call the test case generation service, and generate corresponding test cases according to the interface information of each interface, interface input rules and basic test cases in the template library;
[0039] After completing the test case generation task, unlock the test case generation task.
[0040] Optionally, the creation module is further configured to:
[0041] After storing the test case in the test case set, creating a test case execution task according to the interface to be tested, alarm rules and task execution rules provided by the user;
[0042] The execution module is further configured to:
[0043] When the execution time of the test case execution task arrives, the test case execution task is executed, 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.
[0044] Optionally, the execution module is further configured to:
[0045] Regularly poll the test case execution task and insert the test case execution task into the test case execution task queue;
[0046] 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;
[0047] 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;
[0048] After the test case execution task is completed, the test case execution task is unlocked.
[0049] Optionally, the execution module is further configured to:
[0050] After all test case execution tasks are completed, a test result email will be generated based on the test results, and the push task of the test result email will be inserted into the push task queue;
[0051] When the test result matches the alarm rule, an alarm email and / or an alarm text message is generated, and a push task of the alarm email and / or the alarm text message is inserted into a push task queue.
[0052] Optionally, the creation module is further configured to:
[0053] Before completing the interface registration, the basic test cases uploaded by the user and the matching rules corresponding to each basic test case are received. The matching rules are used to define the matching relationship between each basic test case and the original type of the interface.
[0054] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:
[0055] one or more processors;
[0056] a storage device for storing one or more programs,
[0057] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0058] According to another aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0059] One embodiment of the above invention has the following advantages or beneficial effects: because it adopts the technical means of creating a test case generation task according to the interface information, interface input parameter rules and 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, it overcomes the technical problem of low automation level of interface testing in the prior art. The embodiment of the present invention generates test cases according to the input parameter rules and task execution time provided by the user, and combines basic test cases, thereby shortening the time of writing test cases. Moreover, the embodiment of the present invention combines interface test case generation with interface test case execution to provide a unified system and form a complete closed loop; automatically executes interface automation testing according to user-specified rules, reduces manual participation, saves human resources and labor costs; automatically generates test result emails after the interface test is executed, sends them synchronously, and reduces the delay in obtaining test results; when the interface test case regresses regularly, the test case is continuously observed to achieve interface quality tracking and analysis.
[0060] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0062] Figure 1 is a schematic diagram of the main process of the automated testing method according to an embodiment of the present invention;
[0063] Figure 2This is a schematic diagram of the main process of an automated testing method according to a reference embodiment of the present invention.
[0064] Figure 3 is a schematic diagram of the main process of an automated testing method according to another reference embodiment of the present invention;
[0065] Figure 4 is a schematic diagram of main modules of an automated testing device according to an embodiment of the present invention;
[0066] Figure 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0067] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0069] Figure 1 Schematic diagram of the main process of the automated testing method according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the automated testing method may include:
[0070] Step 101: After the interface registration is completed, a test case generation task is created based on the interface information, interface input rules and task execution time provided by the user.
[0071] Typically, developers register interfaces and specify the corresponding registration protocol and input parameters. The interface registration protocol specifies how the interface is registered and how it is bound to the system. The system can access interface information according to the protocol. When an interface is published, the system records the publication information (such as the publication time, interface name, and interface alias), and stores the interface input parameters and address information.
[0072] After completing the interface registration, the tester can continue to provide the task execution time. In response to the tester's task generation operation, a test case generation task is automatically created based on the interface information, interface input rules and task execution time.
[0073] Optionally, before step 101, the process may also include receiving user-uploaded basic test cases and matching rules corresponding to each basic test case, wherein the matching rules are used to define the matching relationship between each basic test case and the original interface type. The basic test cases uploaded by the tester are entered into the template library, and corresponding matching rules are created for the basic test cases in the template library in the rule management. The test case set management also includes the test case sets approved by the tester.
[0074] Step 102, when the execution time of the test case generation task is reached, the test case generation task is executed, thereby generating a test case according to the interface information, the interface input rule and the basic test case in the template library, and storing the test case in the test case set.
[0075] Optionally, when the execution time of the test case generation task is reached, the test case generation task is executed, so as to generate a test case according to the interface information, the interface input rules and the basic test cases in the template library, which may include: periodically polling the test case generation task, inserting the test case generation task into the 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, calling the test case generation service, and thus generating corresponding test cases according to the interface information of each interface, the interface input rules and the basic test cases in the template library; unlocking the test case generation task after completing the test case generation task. In an embodiment of the present invention, a rule engine periodically polls the test case generation task to generate a test case generation task queue. When there is a task whose execution time has arrived or an unfinished task, the test case generation task is locked, the interfaces in the test case generation task are traversed (tasks and interfaces present a 1:N relationship), and the test case generation service is called to generate test cases. Before generating a test case for each interface, the test case generation task is locked, and the test case generation task is unlocked after the generation is completed.
[0076] After step 102, the process may further include: in response to a user modifying the test case, updating the modified test case to the test case set. Because the automatically generated interface test cases may not cover all scenarios, manual intervention is required. Testers adjust data or supplement scenarios based on the generated interface test cases to form a final interface test case set.
[0077] Based on the various embodiments described above, it can be seen that the present invention solves the technical problem of low automation of interface testing in the prior art by creating a test case generation task based on user-provided interface information, interface input parameters, and task execution time, and then executing the test case generation task when the execution time of the test case generation task is reached. The embodiments of the present invention generate test cases based on user-provided input parameters and task execution time, combined with basic test cases, thereby shortening the time required to write test cases.
[0078] Figure 2 Schematic diagram of the main process of the automated testing method according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 2 As shown, the automated testing method may include:
[0079] Step 201: receiving basic test cases uploaded by a user and matching rules corresponding to each basic test case, wherein the matching rules are used to define a matching relationship between each basic test case and an interface primitive type.
[0080] Step 202: After the interface registration is completed, a test case generation task is created based on the interface information, interface input rules and task execution time provided by the user.
[0081] Step 203, when the execution time of the test case generation task is reached, the test case generation task is executed, thereby generating a test case according to the interface information, the interface input rule and the basic test case in the template library, and storing the test case in the test case set.
[0082] Step 204: In response to the user's modification operation on the test case, the modified test case is updated to the test case set.
[0083] Step 205: Create a test case execution task based on the interface to be tested, alarm rules, and task execution rules provided by the user.
[0084] After selecting the interface, users can provide alarm rules and task execution rules to create test case execution tasks. Task execution rules specify the specific execution time of the task and whether to repeat it, and can be used in a manner similar to Cron expressions. Cron expression: It is a string that expresses the time dimension. It consists of 6 (or 7) characters separated by spaces and can represent a time point or a time range. Different scheduled task frameworks have different syntax formats. According to the set task execution rules, a test task can be executed multiple times, and multiple test records can be generated, corresponding to different test results.
[0085] Alarm rules can be set to trigger an alert when the evaluation results reach a specified state or threshold. Users can also specify recipients of test results and alarm information, such as SMS or email.
[0086] Step 206: When the execution time of the test case execution task arrives, the test case execution task is executed, 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.
[0087] Optionally, when the execution time of the test case execution task is reached, the test case execution task is executed, thereby obtaining the test case corresponding to the interface to be tested from the test case set, and executing the test case, including: periodically polling the test case execution task, inserting the test case execution task into the 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 the test case corresponding to each interface to be tested from the test case set, and executing the test case; after completing the test case execution task, unlocking the test case execution task. In an embodiment of the present invention, a rule engine periodically polls test case execution tasks to generate a test case execution task queue. When there is a task execution time reached or an unfinished task, the test case execution task is locked, the interfaces to be tested in the test case execution task are traversed (tasks and interfaces present a 1:N relationship), the test cases corresponding to the various interfaces to be tested are obtained from the test case set, and the test cases are executed; after the test case execution task is completed, the test case execution task is unlocked.
[0088] Step 207: After all test case execution tasks are completed, a test result email is generated according to the test results, and the push task of the test result email is inserted into the push task queue.
[0089] Step 208: When the test result matches the alarm rule, an alarm email and / or alarm SMS is generated, and the push task of the alarm email and / or the alarm SMS is inserted into the push task queue. The alarm method can be SMS, email, etc., to send the alarm to the designated recipient.
[0090] The push engine periodically polls the push task queue and actively pushes information when there are tasks to be pushed.
[0091] It's important to note that during test execution, users can choose to pause the task. Once the task is paused, the task's pause information is detected, pausing test case generation or execution for the interface associated with that task. Paused tasks can be resumed. Users can edit and modify task information at any time without affecting the currently running test case generation or execution task.
[0092] According to the various embodiments described above, it can be seen that the present invention solves the technical problem of low automation of interface testing in the prior art by creating a test case execution task based on the interface to be tested, alarm rules and task execution rules provided by the user, and executing the test case execution task when the execution time of the test case execution task is reached. The embodiment of the present invention generates test cases based on the input rules and task execution time provided by the user, and combines basic test cases to shorten the time of writing test cases. Moreover, the embodiment of the present invention combines interface test case generation with interface test case execution to provide a unified system to form a complete closed loop; automatically execute interface automation testing according to user-specified rules, reduce manual participation, save human resources and labor costs; automatically generate test result emails after the interface test is executed, send them synchronously, and reduce the delay in obtaining test results; when the interface test case regresses regularly, the test case is continuously observed to achieve interface quality tracking and analysis.
[0093] Therefore, the embodiment of the present invention combines the continuous integration of test case writing and test case execution, shortens the time for testers to write interface test cases, improves the execution rate of automated test cases, and thus improves test efficiency and reduces software development costs.
[0094] Figure 3 Schematic diagram of the main process of the automated testing method according to another reference embodiment of the present invention. As another embodiment of the present invention, Figure 3 As shown, the automated testing method may include:
[0095] The tester uploads a test case template library, which includes basic test cases and matching rules corresponding to each basic test case. The matching rules are used to define the matching relationship between each basic test case and the original type of the interface.
[0096] The developer registers the interface and submits the interface information, interface input parameter rules and task execution time, and creates a test case generation task based on the interface information, interface input parameter rules and task execution time of the interface.
[0097] Periodically poll the test case generation task and insert the test case generation task into the test case generation task queue; traverse each test case generation task in the test case generation task queue, and when the execution time of the test case generation task is reached, lock the test case generation task; traverse each interface in the test case generation task and call the test case generation service, so as to generate corresponding test cases according to the interface information of each interface, interface input rules and basic test cases in the template library; after completing the test case generation task, unlock the test case generation task and store the test case in the test case set.
[0098] Notify the execution recipient via email or SMS that the test case has been generated.
[0099] In response to the tester's modification of the test case, the modified test case is updated to the test case set. Since the scenario coverage of the automatically generated interface test case may not be comprehensive, manual intervention is required. The tester adjusts the data or supplements the scenario according to the generated interface test case to form the final interface test case set.
[0100] Create test cases and execute tasks based on the interface to be tested, alarm rules, and task execution rules provided by the user.
[0101] Periodically poll the test case execution task and insert the test case execution task into the test case execution task queue; traverse each test case execution task in the test case execution task queue, and when the execution time of the test case execution task is reached, lock the test case execution task; traverse each interface to be tested in the test case generation task, obtain the test case corresponding to each interface to be tested from the test case set, and execute the test case; after completing the test case execution task, unlock the test case execution task.
[0102] After all test case execution tasks are completed, a test result email will be generated based on the test results, and the push task of the test result email will be inserted into the push task queue.
[0103] When the test result matches the alarm rule, an alarm email and / or alarm SMS is generated, and the push task of the alarm email and / or alarm SMS is inserted into the push task queue. The alarm method can use SMS, email, etc. to send the alarm to the designated recipient.
[0104] In addition, the specific implementation content of the automated testing method in another reference embodiment of the present invention has been described in detail in the automated testing method described above, so the repeated content will not be described again here.
[0105] Figure 4Schematic diagram of the main modules of the automated testing device according to an embodiment of the present invention. Figure 4 As shown, the automated testing device 400 includes a creation module 401 and an execution module 402. The creation module 401 is used to create a test case generation task based on the interface information, interface input parameter rules, and task execution time provided by the user after the interface registration is completed; the execution module 402 is used to execute the test case generation task when the execution time of the test case generation task arrives, thereby generating a test case based on the interface information, the interface input parameter rules, and the basic test cases in the template library, and storing the test case in a test case set.
[0106] Optionally, the execution module 402 is further configured to:
[0107] After the test case is stored in the test case set, in response to a user's modification operation on the test case, the modified test case is updated to the test case set.
[0108] Optionally, the execution module 402 is further configured to:
[0109] Periodically poll the test case generation task and insert the test case generation task into the test case generation task queue;
[0110] 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;
[0111] Traverse each interface in the test case generation task, call the test case generation service, and generate corresponding test cases according to the interface information of each interface, interface input rules and basic test cases in the template library;
[0112] After completing the test case generation task, unlock the test case generation task.
[0113] Optionally, the creation module 401 is further configured to:
[0114] After storing the test case in the test case set, creating a test case execution task according to the interface to be tested, alarm rules and task execution rules provided by the user;
[0115] The execution module is further configured to:
[0116] When the execution time of the test case execution task arrives, the test case execution task is executed, 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.
[0117] Optionally, the execution module 402 is further configured to:
[0118] Regularly poll the test case execution task and insert the test case execution task into the test case execution task queue;
[0119] 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;
[0120] 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;
[0121] After the test case execution task is completed, the test case execution task is unlocked.
[0122] Optionally, the execution module 402 is further configured to:
[0123] After all test case execution tasks are completed, a test result email will be generated based on the test results, and the push task of the test result email will be inserted into the push task queue;
[0124] When the test result matches the alarm rule, an alarm email and / or an alarm text message is generated, and a push task of the alarm email and / or the alarm text message is inserted into a push task queue.
[0125] Optionally, the creation module 401 is further configured to:
[0126] Before completing the interface registration, the basic test cases uploaded by the user and the matching rules corresponding to each basic test case are received. The matching rules are used to define the matching relationship between each basic test case and the original type of the interface.
[0127] According to the various embodiments described above, it can be seen that the present invention solves the technical problem of low automation of interface testing in the prior art by creating a test case execution task based on the interface to be tested, alarm rules and task execution rules provided by the user, and executing the test case execution task when the execution time of the test case execution task is reached. The embodiment of the present invention generates test cases based on the input rules and task execution time provided by the user, and combines basic test cases to shorten the time of writing test cases. Moreover, the embodiment of the present invention combines interface test case generation with interface test case execution to provide a unified system to form a complete closed loop; automatically execute interface automation testing according to user-specified rules, reduce manual participation, save human resources and labor costs; automatically generate test result emails after the interface test is executed, send them synchronously, and reduce the delay in obtaining test results; when the interface test case regresses regularly, the test case is continuously observed to achieve interface quality tracking and analysis.
[0128] It should be noted that the specific implementation content of the automated testing device of the present invention has been described in detail in the automated testing method described above, so the details will not be repeated here.
[0129] Figure 5 An exemplary system architecture 500 is shown to which an automated testing method or an automated testing apparatus according to an embodiment of the present invention may be applied.
[0130] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0131] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0132] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0133] Server 505 may be a server that provides various services, such as a backend management server (for example only) that supports shopping websites browsed by users using terminal devices 501, 502, and 503. The backend management server may analyze and process received data such as item information query requests, and feed back processing results (for example, target push information and item information—for example only) to the terminal device.
[0134] It should be noted that the automated testing method provided in 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 automated testing method provided in the embodiment of the present invention may also be executed by the terminal devices 501, 502, and 503, and accordingly, the automated testing apparatus may be disposed in the terminal devices 501, 502, and 503.
[0135] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0136] Reference below Figure 6 , which shows a schematic structural diagram of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0137] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which 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 unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the system 600 are also stored in the RAM 603. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0138] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, and the like; an output section 607 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 608 including a hard disk; and a communication section 609 including a network interface card such as a LAN card or a modem. The communication section 609 performs communication processing via a network such as the Internet. A drive 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, or a semiconductor memory, is installed in the drive 610 as needed, so that computer programs read therefrom can be installed into the storage section 608 as needed.
[0139] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from a removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are performed.
[0140] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0141] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer programs according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0142] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules may also be provided in a processor. For example, a processor may be described as including a creation module and an execution module. The names of these modules do not, in some cases, limit the modules themselves.
[0143] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: after completing the interface registration, creating a test case generation task based on the interface information, interface input parameter rules and task execution time provided by the user; when the execution time of the test case generation task is reached, executing the test case generation task, thereby generating a test case based on the interface information, the interface input parameter rules and the basic test cases in the template library, and storing the test case in a test case set.
[0144] According to the technical solution of the embodiment of the present invention, because it adopts the technical means of creating a test case generation task according to the interface information, interface input parameter rules and 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, it overcomes the technical problem of low automation level of interface testing in the prior art. The embodiment of the present invention generates test cases according to the input parameter rules and task execution time provided by the user, and combines basic test cases, thereby shortening the time of writing test cases. Moreover, the embodiment of the present invention combines interface test case generation with interface test case execution to provide a unified system to form a complete closed loop; automatically executes interface automation testing according to user-specified rules, reduces manual participation, saves human resources and labor costs; automatically generates test result emails after the interface test is executed, sends them synchronously, and reduces the delay in obtaining test results; when the interface test case regresses regularly, the test case is continuously observed to achieve interface quality tracking and analysis.
[0145] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. An automated testing method, characterized in that: include: After the interface registration is completed, a test case generation task is created based on the interface information, interface input rules and task execution time provided by the user; When the execution time of the test case generation task is reached, the test case generation task is executed, so as to generate a test case according to the interface information, the interface input rule and the basic test case in the template library, and the test case is stored in the test case set; When the execution time of the test case generation task is reached, the test case generation task is executed, so as to generate a test case according to the interface information, the interface input parameter rule and the basic test case in the template library, including: Periodically poll the test case generation task and insert the test case generation task into the test case generation task queue; Traversing each test case generation task in the test case generation task queue, and when the execution time of the test case generation task is reached, locking the test case generation task; Traverse each interface in the test case generation task, call the test case generation service, and generate corresponding test cases according to the interface information of each interface, the interface input rule and the basic test cases in the template library; the test case generation task and the interface present a 1:N relationship; After completing the test case generation task, unlock the test case generation task.
2. The method according to claim 1, characterized in that After storing the test case into the test case set, the method further includes: In response to a user's modification operation on the test case, the modified test case is updated to the test case set.
3. The method according to claim 1, characterized in that After storing the test case into the test case set, the method further includes: Create test cases to execute tasks based on the test interface, alarm rules and task execution rules provided by the user; When the execution time of the test case execution task is reached, the test case execution task is executed, 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.
4. The method according to claim 3, characterized in that When the execution time of the test case execution task is reached, the test case execution task is executed, thereby obtaining the test case corresponding to the interface to be tested from the test case set, and executing the test case, including: Periodically poll the test case execution task and insert the test case execution task into the test case execution task queue; Traversing each test case execution task in the test case execution task queue, and when the execution time of the test case execution task is reached, locking the test case execution task; Traversing each interface to be tested in the test case generation task, obtaining the test case corresponding to each interface to be tested from the test case set, and executing the test case; After the test case execution task is completed, the test case execution task is unlocked.
5. The method according to claim 3, characterized in that: Also includes: After all test case execution tasks are completed, a test result email will be generated according to the test results, and the push task of the test result email will be inserted into the push task queue; When the test result matches the alarm rule, an alarm email and / or an alarm text message is generated, and a push task of the alarm email and / or the alarm text message is inserted into a push task queue.
6. The method according to claim 1, characterized in that Before completing the interface registration, it also includes: Receive basic test cases uploaded by users and matching rules corresponding to each basic test case, wherein the matching rules are used to define the matching relationship between each basic test case and the original type of the interface.
7. An automated testing device, characterized in that: include: The creation module is used to create a test case generation task based on the interface information, interface input rules and task execution time provided by the user after the interface registration is completed; An execution module, used for executing the test case generation task when the execution time of the test case generation task is reached, thereby generating a test case according to the interface information, the interface input parameter rules and the basic test cases in the template library, and storing the test case in a test case set; The execution module is also used for: Periodically poll the test case generation task and insert the test case generation task into the test case generation task queue; Traversing each test case generation task in the test case generation task queue, and when the execution time of the test case generation task is reached, locking the test case generation task; Traverse each interface in the test case generation task, call the test case generation service, and generate corresponding test cases according to the interface information of each interface, interface input parameter rules and basic test cases in the template library; The test case generation task and the interface present a 1:N relationship; After completing the test case generation task, unlock the test case generation task.
8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Automated test method and device for interface
CN108334449A
Interface test case generation method and device, computer equipment and storage medium
CN110532169A