CN108388514B - Interface automation test method, device, equipment and computer readable storage medium - Google Patents

Interface automation test method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN108388514B
CN108388514B CN201810156599.6A CN201810156599A CN108388514B CN 108388514 B CN108388514 B CN 108388514B CN 201810156599 A CN201810156599 A CN 201810156599A CN 108388514 B CN108388514 B CN 108388514B
Authority
CN
China
Prior art keywords
test
template
script
interface
script template
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.)
Active
Application number
CN201810156599.6A
Other languages
Chinese (zh)
Other versions
CN108388514A (en
Inventor
彭明强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810156599.6A priority Critical patent/CN108388514B/en
Priority to PCT/CN2018/084310 priority patent/WO2019161619A1/en
Publication of CN108388514A publication Critical patent/CN108388514A/en
Application granted granted Critical
Publication of CN108388514B publication Critical patent/CN108388514B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

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 embodiment of the invention provides an interface automatic testing method, device and equipment and a computer readable storage medium. The method comprises the following steps: generating a test case according to a preset test case description structure; acquiring a test task list corresponding to the test case; sequentially executing the test tasks corresponding to the test task list to generate an execution result; and generating a test report according to the execution result. By implementing the embodiment of the invention, the maintenance cost of the interface test can be reduced and the working efficiency of the interface test can be improved.

Description

Interface automation test method, device, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of computer data processing, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for automatically testing an interface.
Background
The interface test is generally used for interactive development among multiple systems or test of development of an application system with multiple subsystems. The interface test is suitable for the bottom-layer framework system and the central service system which provide services for other systems, and mainly tests the interfaces provided by the systems to the outside to verify the correctness and stability of the interfaces.
The interface automation test framework in the prior art has high requirements on the script writing capability of a user and low use efficiency, and for example, a large amount of repeated program codes with similar functions need to be written, so that the problems of high maintenance cost, low test efficiency and the like are caused. Therefore, how to implement automatic testing to solve the defects of high requirements on user script writing capability and the like in the prior art becomes a technical problem to be solved urgently.
Disclosure of Invention
The invention provides an interface automatic test method, device and equipment and a computer readable storage medium, aiming at solving the problems of high interface test maintenance cost and low test efficiency.
In a first aspect, the present invention provides an interface automation test method, which includes:
generating a test case according to a preset test case description structure;
acquiring a test task list corresponding to the test case;
sequentially executing the test tasks corresponding to the test task list to generate an execution result;
and generating a test report according to the execution result.
In a second aspect, the present invention provides an interface automation test apparatus, which includes:
the case generating unit is used for generating a test case according to a preset test case description structure;
the task obtaining unit is used for obtaining a test task list corresponding to the test case;
the result generating unit is used for sequentially executing the test tasks corresponding to the test task list so as to generate an execution result;
and the report generating unit is used for generating a test report according to the execution result.
In a third aspect, the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the interface automation test methods provided in the invention when executing the program.
In a fourth aspect, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform any one of the interface automation test methods provided by the invention.
The invention provides an interface automatic testing method, an interface automatic testing device, computer equipment and a computer readable storage medium. The method comprises the steps of generating a test case according to a preset test case description structure; acquiring a test task list corresponding to the test case; sequentially executing the test tasks corresponding to the test task list to generate an execution result; and generating a test report according to the execution result. By implementing the embodiment of the invention, the test case is generated according to the preset test case description structure, and the test report can be generated according to the test result obtained by executing the test task corresponding to the test case, so that the maintenance cost of the interface test can be reduced and the working efficiency of the interface test can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of an interface automation test method according to an embodiment of the present invention;
fig. 2 is a schematic sub-flow chart of an interface automation test method according to an embodiment of the present invention;
fig. 3 is a sub-flow diagram of an interface automation test method according to an embodiment of the present invention;
fig. 4 is a sub-flow diagram of an interface automation test method according to an embodiment of the present invention;
fig. 5 is a sub-flow diagram of an interface automation test method according to an embodiment of the present invention;
FIG. 6 is a schematic block diagram of an interface automatic test apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a use case generating unit of an interface automation testing apparatus according to an embodiment of the present invention;
fig. 8 is a schematic block diagram of a first determining unit of an interface automation testing apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic block diagram of a first processing unit of an interface automatic test apparatus according to an embodiment of the present invention;
FIG. 10 is a schematic block diagram of a report generating unit of an interface automatic testing apparatus according to an embodiment of the present invention;
fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
An interface refers to a point of interaction between systems or between modules in a system. The interface test is mainly used for detecting whether the data interaction, transmission and logic functions of the interaction point are correct, essentially, the interface test is to send a Request message to a server to Request an interface to be tested, receive a Response message returned by the server Response, and analyze whether the function of the interface to be tested is correctly realized based on the Response message.
Fig. 1 is a schematic flow chart of an interface automation testing method according to an embodiment of the present invention. The automatic interface testing method can be applied to terminals such as servers, desktop computers, laptop computers, tablet computers, Personal Digital Assistants (PDAs), smart phones (such as Android phones and IOS phones). Specifically, the method includes steps S110-S140.
And S110, generating a test case according to a preset test case description structure.
Specifically, the test case description structure includes an interface call structure and an interface control structure. The interface calling structure is used for describing input parameters required by the test interface calling execution action; the interface control structure is used for describing the control logic called by the test interface.
The control types of the interface control structure include, but are not limited to, a loop control structure, a conditional execution structure, a delay control structure, a register variable structure, and an assertion control structure. Specifically, the loop control structure is used for describing the number of times of executing actions by sequential calling of the test interface; the condition control structure is used for describing a precondition of the test interface for calling and executing the action; the register variable is used for storing a result of the test interface after calling and executing the action so as to be used in other subsequent test cases; the assertion control structure is used for describing a test result generated after the test interface calls the execution action.
Each control type interface control structure corresponds to a unique control identifier. For example, the identifier corresponding to the loop control structure is retries; the identifier corresponding to the condition control structure is unitil; the identifier corresponding to the delay control structure is delay; registering an identifier corresponding to the variable structure as a register; and asserting the identifier corresponding to the control structure as alert.
Specifically, fig. 2 is a schematic sub-flow chart of an interface automation testing method according to an embodiment of the present invention. Further, the test case description structure includes a script template, the script template includes a parameter input interface and a preset code segment, and the step S110 of generating the test case according to the preset test case description structure includes steps S111 to S114.
In specific implementation, different test case description structures correspond to different preset code segments. For example, if the preset test case description structure is an interface call structure, the preset code segment corresponding to the interface call structure may be:
include:
name:
correspondingly, the parameter input interface corresponding to the interface calling structure is set to be' name: "behind". The parameter input interface is a text input box, so that a user can input corresponding parameter information in the text input box according to the preset code segment.
And S111, judging whether the script template is in an activated state.
Specifically, fig. 3 is a sub-flow diagram of an interface automation testing method according to an embodiment of the present invention. Further, the test case description structure further includes a template candidate box for displaying a script template, and the step S111 of determining whether the script template is in an activated state includes steps S1111 to S1115.
And S1111, acquiring the character input by the user through the template alternative frame.
In a specific implementation, a template candidate frame may be set in each row, and the template candidate frame may be used to obtain a character input by a user, and present a preset code segment matched with the character to the user according to the obtained character.
S1112, acquiring a script template matched with the characters according to the characters input by the user.
In specific implementation, detecting the script template matched with the character according to the character input by the user may specifically be:
judging whether a template identifier corresponding to the script template contains the characters input by the user;
and if the template identifier corresponding to the script template contains the characters input by the user, determining the script template as the script template matched with the characters.
Wherein each script template corresponds to a unique template identifier. If the test case description structure is an interface control structure, the template identifier of the script template corresponding to the interface control structure may be a control identifier corresponding to the interface control structure. For example, if the interface control structure is a loop control structure, the template identifier of the script template corresponding to the loop control structure is a control identifier corresponding to the loop control structure, that is, the template identifier is "retries".
And if the character input by the user is 'r', judging whether the template identifier containing the character 'r' exists or not by matching the character 'r' with all the template identifiers one by one, and if the template identifier containing the character 'r' exists, determining the script template corresponding to the template identifier containing the character 'r' as the script template matched with the character.
S1113, the script template matched with the characters is displayed in the template alternative frame.
In a specific implementation, if the first character of the template identifier is the same as the character input by the user, the template character is preferentially displayed in the template candidate frame. The preferred presentation mode includes, but is not limited to, a top-up display, a highlight display, etc.
S1114, judging whether the script template displayed in the template candidate box is selected.
In a specific implementation, if the script template displayed in the template candidate box is clicked, it is determined that the script template is selected.
S1115, if the script template shown in the template candidate box is selected, judging that the selected script template is in an activated state.
By implementing the embodiment of the invention, the script template matched with the characters input by the user is automatically detected by acquiring the characters input by the user, and the script template is displayed in the template alternative frame for the user to select. The script template can be rapidly acquired, and the input efficiency is improved.
And S112, if the script template is in an activated state, acquiring a preset code segment corresponding to the script template.
In a specific implementation, the script template includes a parameter input interface and a preset code segment. And if the script template is in an activated state, generating a preset code segment corresponding to the script template and a parameter input interface corresponding to the script template.
And S113, acquiring script parameters corresponding to the preset code segments through the parameter input interface.
In specific implementation, the parameter input interface can be used for receiving script parameters input by a user, and the script parameters corresponding to the preset code segments and input by the user can be acquired through the parameter input interface.
And S114, generating a test task according to the preset code segment and the script parameter.
Specifically, fig. 4 is a sub-flow diagram of an interface automation testing method according to an embodiment of the present invention. Further, the step S114 of generating a test case according to the preset code segment and the script parameter includes steps S1141 to S1143.
S1141, obtaining the script template of which the parameter input interface is null.
Specifically, if the parameter input interface is a null value, it indicates that the parameter input interface does not receive the script parameter input by the user.
S1142, deleting the script template with the parameter input interface being a null value so as to obtain the remaining preset code segments and the script parameters corresponding to the remaining preset code segments.
And S1143, generating a test case according to the remaining preset code segments and the script parameters corresponding to the remaining preset code segments.
In specific implementation, the test case may be stored in a preset test directory in a form of a script file, and a file format of the script file may be a YAML format. By searching the YAML format file in the preset test directory, the corresponding test case can be quickly obtained.
By implementing the embodiment of the invention, the problem of test case errors caused by redundant script templates is effectively avoided, and the speed and the accuracy of test case compiling are improved.
And S120, acquiring a test task list corresponding to the test case.
In particular implementations, a test case may include one or more test tasks. Each test task is marked by a preset task identifier, and the task identifier can be arranged at the leftmost side of the first row of each test task so as to distinguish different test tasks and improve the speed of identifying the test tasks. The task identifier may be "-". And obtaining a test task list corresponding to the test case by loading and storing the script file of the test case and identifying a preset task identifier.
And S130, sequentially executing the test tasks corresponding to the test task list to generate an execution result.
And generating different types of test tasks according to different types of test case description structures. If the test case description structure is an interface calling structure, the test task generated by the interface calling structure is an interface calling task, and the interface calling task is used for calling input parameters required by the execution action. And if the test case description structure is an interface control structure, the test task correspondingly generated by the interface control structure is an interface control task, and the interface control task is used for executing a control action according to the corresponding control logic.
In specific implementation, the test task list corresponding to the test case can be obtained by loading a script file storing the test case, for example, by searching a YAML format file in the preset test directory, and obtaining and loading a corresponding script file according to the corresponding file name of the search. The sequentially executing the test tasks corresponding to the test task list may specifically be sequentially executing the test tasks from top to bottom according to the arrangement order of the task identifiers.
And S140, generating a test report according to the execution result.
Specifically, fig. 5 is a schematic sub-flow chart of an interface automation testing method according to an embodiment of the present invention. Further, the step S140 of generating a test report according to the execution result includes steps S141 to S142.
And S141, acquiring the success rate of the execution result.
In specific implementation, the success rate of the execution result can be obtained by obtaining the total execution times of the test task and the successful execution times of the test task and dividing the successful execution times and the total execution times.
And S142, generating a corresponding test report according to the success rate of the execution result.
In specific implementation, if the success rate is lower than a preset first threshold, a first test report is generated; and if the success rate is greater than or equal to a preset first threshold value, generating a second test report. For example, the first threshold may be 90%. If the success rate is lower than 90%, the first test report is generated as a test failure. And if the success rate is greater than or equal to 90%, generating a second test report as successful test.
Fig. 6 is a schematic block diagram of an interface automation test apparatus according to an embodiment of the present invention. The interface automation test apparatus 100 includes a use case generation unit 110, a task acquisition unit 120, a result generation unit 130, and a report generation unit 140.
Specifically, the test case description structure includes an interface call structure and an interface control structure. The interface calling structure is used for describing input parameters required by the test interface calling execution action; the interface control structure is used for describing the control logic called by the test interface.
The control types of the interface control structure include, but are not limited to, a loop control structure, a conditional execution structure, a delay control structure, a register variable structure, and an assertion control structure. Specifically, the loop control structure is used for describing the number of times of executing actions by sequential calling of the test interface; the condition control structure is used for describing a precondition of the test interface for calling and executing the action; the register variable is used for storing a result of the test interface after calling and executing the action so as to be used in other subsequent test cases; the assertion control structure is used for describing a test result generated after the test interface calls the execution action.
Each control type interface control structure corresponds to a unique control identifier. For example, the identifier corresponding to the loop control structure is retries; the identifier corresponding to the condition control structure is unitil; the identifier corresponding to the delay control structure is delay; registering an identifier corresponding to the variable structure as a register; and asserting the identifier corresponding to the control structure as alert.
The use case generating unit 110 is configured to generate a test case according to a preset test case description structure.
Referring to fig. 7, a schematic block diagram of a use case generating unit of an interface automation testing apparatus according to an embodiment of the present invention is shown. Further, the test case description structure includes a script template, the script template includes a parameter input interface and a preset code segment, and the case generating unit 110 includes a first determining unit 111, a first obtaining unit 112, a second obtaining unit 113, and a first processing unit 114.
In specific implementation, different test case description structures correspond to different preset code segments. For example, if the preset test case description structure is an interface call structure, the preset code segment corresponding to the interface call structure may be:
include:
name:
correspondingly, the parameter input interface corresponding to the interface calling structure is set to be' name: "behind". The parameter input interface is a text input box, so that a user can input corresponding parameter information in the text input box according to the preset code segment.
A first judging unit 111, configured to judge whether the script template is in an activated state.
Referring to fig. 8, a schematic block diagram of a first determining unit 111 of an interface automation test apparatus according to an embodiment of the invention is shown. Further, the test case description structure further includes a template candidate box for displaying a script template, and the first determining unit 111 includes a third obtaining unit 1111, a fourth obtaining unit 1112, a displaying unit 1113, a second determining unit 1114, and a second processing unit 1115.
A third obtaining unit 1111, configured to obtain the character input by the user through the template candidate box.
In a specific implementation, a template candidate frame may be set in each row, and the template candidate frame may be used to obtain a character input by a user, and present a preset code segment matched with the character to the user according to the obtained character.
A fourth obtaining unit 1112, configured to obtain a script template matching the character according to the character input by the user.
In specific implementation, detecting the script template matched with the character according to the character input by the user may specifically be:
and judging whether the template identifier corresponding to the script template contains the characters input by the user.
And if the template identifier corresponding to the script template contains the characters input by the user, determining the script template as the script template matched with the characters.
Wherein each script template corresponds to a unique template identifier. If the test case description structure is an interface control structure, the template identifier of the script template corresponding to the interface control structure may be a control identifier corresponding to the interface control structure. For example, if the interface control structure is a loop control structure, the template identifier of the script template corresponding to the loop control structure is a control identifier corresponding to the loop control structure, that is, the template identifier is "retries".
And if the character input by the user is 'r', judging whether the template identifier containing the character 'r' exists or not by matching the character 'r' with all the template identifiers one by one, and if the template identifier containing the character 'r' exists, determining the script template corresponding to the template identifier containing the character 'r' as the script template matched with the character.
A display unit 1113, configured to display the script template matched with the character in the template candidate frame.
In a specific implementation, if the first character of the template identifier is the same as the character input by the user, the template character is preferentially displayed in the template candidate frame. The preferred presentation mode includes, but is not limited to, a top-up display, a highlight display, etc.
The second determining unit 1114 is configured to determine whether the script template shown in the template candidate box is selected.
In a specific implementation, if the script template displayed in the template candidate box is clicked, it is determined that the script template is selected.
And a second processing unit 1115, configured to determine that the selected script template is in an active state if the script template shown in the template candidate box is selected.
By implementing the embodiment of the invention, the script template matched with the characters input by the user is automatically detected by acquiring the characters input by the user, and the script template is displayed in the template alternative frame for the user to select. The script template can be rapidly acquired, and the input efficiency is improved.
The first obtaining unit 112 is configured to obtain a preset code segment corresponding to the script template if the script template is in an activated state.
In a specific implementation, the script template includes a parameter input interface and a preset code segment. And if the script template is in an activated state, generating a preset code segment corresponding to the script template and a parameter input interface corresponding to the script template.
A second obtaining unit 113, configured to obtain, through the parameter input interface, a script parameter corresponding to the preset code segment.
In specific implementation, the parameter input interface can be used for receiving script parameters input by a user, and the script parameters corresponding to the preset code segments and input by the user can be acquired through the parameter input interface.
And the first processing unit 114 is configured to generate a test case according to the preset code segment and the script parameter.
Referring to fig. 9, a schematic block diagram of a first processing unit 114 of an interface automation test apparatus according to an embodiment of the invention is shown. Further, the first processing unit 114 includes a fifth acquiring unit 1141, a deleting unit 1142, and a third processing unit 1143.
A fifth obtaining unit 1141, configured to obtain a script template of which the parameter input interface is null.
Specifically, if the parameter input interface is a null value, it indicates that the parameter input interface does not receive the script parameter input by the user.
A deleting unit 1142, configured to delete the script template whose parameter input interface is null, so as to obtain remaining preset code segments and script parameters corresponding to the remaining preset code segments.
The third processing unit 1143 is configured to generate a test case according to the remaining preset code segments and the script parameters corresponding to the remaining preset code segments.
In specific implementation, the test case may be stored in a preset test directory in a form of a script file, and a file format of the script file may be a YAML format. By searching the YAML format file in the preset test directory, the corresponding test case can be quickly obtained.
By implementing the embodiment of the invention, the problem of test case errors caused by redundant script templates is effectively avoided, and the speed and the accuracy of test case compiling are improved.
The task obtaining unit 120 is configured to obtain a test task list corresponding to the test case.
In particular implementations, a test case may include one or more test tasks. Each test task is marked by a preset task identifier, and the task identifier can be arranged at the leftmost side of the first row of each test task so as to distinguish different test tasks and improve the speed of identifying the test tasks. The task identifier may be "-". And obtaining a test task list corresponding to the test case by loading and storing the script file of the test case and identifying a preset task identifier.
And the result generating unit 130 is configured to sequentially execute the test tasks corresponding to the test task list to generate an execution result.
And generating different types of test tasks according to different types of test case description structures. If the test case description structure is an interface calling structure, the test task generated by the interface calling structure is an interface calling task, and the interface calling task is used for calling input parameters required by the execution action. And if the test case description structure is an interface control structure, the test task correspondingly generated by the interface control structure is an interface control task, and the interface control task is used for executing a control action according to the corresponding control logic.
In specific implementation, the test task list corresponding to the test case can be obtained by loading a script file storing the test case, for example, by searching a YAML format file in the preset test directory, and obtaining and loading a corresponding script file according to the corresponding file name of the search. The sequentially executing the test tasks corresponding to the test task list may specifically be sequentially executing the test tasks from top to bottom according to the arrangement order of the task identifiers.
A report generating unit 140, configured to generate a test report according to the execution result.
Referring to fig. 10, a schematic block diagram of a report generating unit 140 of an interface automation test apparatus according to an embodiment of the invention is shown. Further, the report generating unit 140 includes a sixth acquiring unit 141 and a fourth processing unit 142.
A sixth obtaining unit 141, configured to obtain a success rate of the execution result;
in specific implementation, the success rate of the execution result can be obtained by obtaining the total execution times of the test task and the successful execution times of the test task and dividing the successful execution times and the total execution times.
The fourth processing unit 142 is configured to generate a corresponding test report according to the success rate of the execution result.
In specific implementation, if the success rate is lower than a preset first threshold, a first test report is generated; and if the success rate is greater than or equal to a preset first threshold value, generating a second test report. For example, the first threshold may be 90%. If the success rate is lower than 90%, the first test report is generated as a test failure. And if the success rate is greater than or equal to 90%, generating a second test report as successful test.
The apparatus 100 described above may be implemented in the form of a computer program which may be run on a computer device as shown in fig. 11.
Referring to fig. 11, fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 device may be a terminal. The terminal can be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device.
The computer device 500 includes a processor 520, memory, and a network interface 550 coupled by a system bus 510, where the memory may include a non-volatile storage medium 530 and an internal memory 540.
The non-volatile storage medium 530 may store an operating system 531 and computer programs 532. The computer program 532, when executed, may cause the processor 520 to perform a method for automated testing of an interface.
The processor 520 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 540 provides an environment for running a computer program in a non-volatile storage medium, which when executed by the processor 520, causes the processor 520 to perform a method for automated testing of an interface.
The network interface 550 is used for network communication such as sending assigned tasks and the like. It will be appreciated by those skilled in the art that the schematic block diagram of the computer device is only a partial block diagram of the structure associated with the inventive arrangements and does not constitute a limitation of the computer device 500 to which the inventive arrangements are applied, and that a particular computer device 500 may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
Wherein the processor 520 is configured to run the program code stored in the memory to implement the following functions:
generating a test case according to a preset test case description structure;
acquiring a test task list corresponding to the test case;
sequentially executing the test tasks corresponding to the test task list to generate an execution result;
and generating a test report according to the execution result.
In an embodiment, the test case description structure includes a script template, the script template includes a parameter input interface and a preset code segment, and when the processor 520 executes the step of generating the test case according to the preset test case description structure, the following steps are specifically executed:
judging whether the script template is in an activated state;
if the script template is in an activated state, acquiring a preset code segment corresponding to the script template;
acquiring script parameters corresponding to the preset code segments through the parameter input interface;
and generating a test case according to the preset code segment and the script parameter.
In an embodiment, the test case description structure further includes a template candidate box for displaying a script template, and when the processor 520 executes the step of determining whether the script template is in an activated state, the following steps are specifically executed:
acquiring characters input by a user through the template candidate frame;
acquiring a script template matched with the characters according to the characters input by the user;
displaying the script template matched with the characters in the template alternative frame;
judging whether the script template displayed in the template candidate frame is selected;
and if the script template shown in the template candidate box is selected, judging that the selected script template is in an activated state.
In an embodiment, when the processor 520 executes the step of generating the test case according to the preset code segment and the script parameter, the following steps are specifically executed:
acquiring a script template of which the parameter input interface is null;
deleting the script template with the parameter input interface as a null value to obtain the remaining preset code segments and script parameters corresponding to the remaining preset code segments;
and generating a test case according to the residual preset code segments and the script parameters corresponding to the residual preset code segments.
In an embodiment, when the processor 520 executes the step of generating the test report according to the execution result, the following steps are specifically executed:
acquiring the success rate of the execution result;
and generating a corresponding test report according to the success rate of the execution result.
It should be understood that, in the embodiment of the present invention, the Processor 520 may be a Central Processing Unit (CPU), and the Processor 520 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that the schematic block diagram of the computer device 500 does not constitute a limitation of the computer device 500 and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
In another embodiment of the present invention, a computer-readable storage medium is provided that stores a computer program, wherein the computer program comprises program instructions. The program instructions when executed by a processor implement the steps of:
generating a test case according to a preset test case description structure;
acquiring a test task list corresponding to the test case;
sequentially executing the test tasks corresponding to the test task list to generate an execution result;
and generating a test report according to the execution result.
In an embodiment, the test case description structure includes a script template, the script template includes a parameter input interface and a preset code segment, and when the program instruction is executed by the processor to implement the step of generating the test case according to the preset test case description structure, the following steps are specifically implemented:
judging whether the script template is in an activated state;
if the script template is in an activated state, acquiring a preset code segment corresponding to the script template;
acquiring script parameters corresponding to the preset code segments through the parameter input interface;
and generating a test case according to the preset code segment and the script parameter.
In an embodiment, the test case description structure further includes a template candidate box for displaying a script template, and when the program instruction is executed by the processor to implement the step of determining whether the script template is in an activated state, the following steps are specifically implemented:
acquiring characters input by a user through the template candidate frame;
acquiring a script template matched with the characters according to the characters input by the user;
displaying the script template matched with the characters in the template alternative frame;
judging whether the script template displayed in the template candidate frame is selected;
and if the script template shown in the template candidate box is selected, judging that the selected script template is in an activated state.
In an embodiment, when the program instruction is executed by the processor to implement the step of generating the test case according to the preset code segment and the script parameter, the following steps are specifically implemented:
acquiring a script template of which the parameter input interface is null;
deleting the script template with the parameter input interface as a null value to obtain the remaining preset code segments and script parameters corresponding to the remaining preset code segments;
and generating a test case according to the residual preset code segments and the script parameters corresponding to the residual preset code segments.
In an embodiment, when the program instructions are executed by the processor to implement the step of generating the test report according to the execution result, the following steps are specifically implemented:
acquiring the success rate of the execution result;
and generating a corresponding test report according to the success rate of the execution result.
The computer readable storage medium may be various media that can store program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, more than one unit or component may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. An automated interface testing method, comprising:
generating a test case according to a preset test case description structure, wherein the test case description structure comprises a script template, a template alternative frame for displaying the script template, an interface calling structure and an interface control structure, the script template comprises a parameter input interface and a preset code segment, and the interface calling structure is used for describing input parameters required by a test interface calling execution action; the interface control structure is used for describing a control logic called by the test interface;
acquiring a test task list corresponding to the test case;
sequentially executing the test tasks corresponding to the test task list to generate an execution result;
generating a test report according to the execution result;
wherein, the generating of the test case according to the preset test case description structure comprises:
judging whether the script template is in an activated state;
if the script template is in an activated state, acquiring a preset code segment corresponding to the script template;
acquiring script parameters corresponding to the preset code segments through the parameter input interface;
generating a test case according to the preset code segment and the script parameter;
the judging whether the script template is in an activated state includes:
acquiring characters input by a user through the template candidate frame;
acquiring a script template matched with the characters according to the characters input by the user;
displaying the script template matched with the characters in the template alternative frame;
judging whether the script template displayed in the template candidate frame is selected;
if the script template shown in the template candidate box is selected, judging that the selected script template is in an activated state;
the obtaining of the script template matched with the characters according to the characters input by the user comprises:
judging whether a template identifier corresponding to the script template contains the characters input by the user;
and if the template identifier corresponding to the script template contains the characters input by the user, determining the script template as the script template matched with the characters.
2. The method of claim 1, wherein generating test cases according to the preset code segments and script parameters comprises:
acquiring a script template of which the parameter input interface is null;
deleting the script template with the parameter input interface as a null value to obtain the remaining preset code segments and script parameters corresponding to the remaining preset code segments;
and generating a test case according to the residual preset code segments and the script parameters corresponding to the residual preset code segments.
3. The method of claim 1, wherein generating a test report based on the execution results comprises:
acquiring the success rate of the execution result;
and generating a corresponding test report according to the success rate of the execution result.
4. An automated interface testing device, comprising:
the test case generation unit is used for generating a test case according to a preset test case description structure, wherein the test case description structure comprises a script template, a template optional frame for displaying the script template, an interface calling structure and an interface control structure, the script template comprises a parameter input interface and a preset code segment, and the interface calling structure is used for describing input parameters required by a test interface calling execution action; the interface control structure is used for describing a control logic called by the test interface;
the task obtaining unit is used for obtaining a test task list corresponding to the test case;
the result generating unit is used for sequentially executing the test tasks corresponding to the test task list so as to generate an execution result;
the report generating unit is used for generating a test report according to the execution result;
wherein the use case generating unit includes:
the first judgment unit is used for judging whether the script template is in an activated state or not;
the first obtaining unit is used for obtaining a preset code segment corresponding to the script template if the script template is in an activated state;
the second acquisition unit is used for acquiring script parameters corresponding to the preset code segments through the parameter input interface;
the first processing unit is used for generating a test case according to the preset code segment and the script parameter;
the first judgment unit includes:
a third obtaining unit, configured to obtain a character input by a user through the template candidate frame;
the fourth acquisition unit is used for acquiring a script template matched with the characters according to the characters input by the user; specifically, whether a template identifier corresponding to the script template contains the characters input by the user is judged; if the template identifier corresponding to the script template contains the characters input by the user, determining the script template as the script template matched with the characters;
the display unit is used for displaying the script template matched with the characters in the template alternative frame;
the second judging unit is used for judging whether the script template shown in the template candidate frame is selected or not;
and the second processing unit is used for judging that the selected script template is in an activated state if the script template shown in the template candidate box is selected.
5. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the interface automation test method according to any one of claims 1 to 3 when executing the program.
6. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the interface automation test method according to any one of claims 1 to 3.
CN201810156599.6A 2018-02-24 2018-02-24 Interface automation test method, device, equipment and computer readable storage medium Active CN108388514B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810156599.6A CN108388514B (en) 2018-02-24 2018-02-24 Interface automation test method, device, equipment and computer readable storage medium
PCT/CN2018/084310 WO2019161619A1 (en) 2018-02-24 2018-04-25 Automatic interface test method and apparatus, and device and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810156599.6A CN108388514B (en) 2018-02-24 2018-02-24 Interface automation test method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108388514A CN108388514A (en) 2018-08-10
CN108388514B true CN108388514B (en) 2021-02-23

Family

ID=63068478

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810156599.6A Active CN108388514B (en) 2018-02-24 2018-02-24 Interface automation test method, device, equipment and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN108388514B (en)
WO (1) WO2019161619A1 (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026631B (en) * 2018-10-09 2024-03-26 顺丰科技有限公司 Automatic interface detection method, device and server
CN109783367B (en) * 2018-12-15 2023-10-27 中国平安人寿保险股份有限公司 Interface testing method, device, computer device and storage medium
CN109710532A (en) * 2018-12-28 2019-05-03 北京金山安全软件有限公司 Test case management method and device and electronic equipment
CN109783298A (en) * 2019-01-18 2019-05-21 上海磐启微电子有限公司 A kind of flexible controllable software-hardware synergism SoC verification method of process
CN110046088A (en) * 2019-02-19 2019-07-23 阿里巴巴集团控股有限公司 A kind of interface test method, device and equipment
CN110069735A (en) * 2019-03-20 2019-07-30 平安普惠企业管理有限公司 JS code is anti-to be repeatedly injected method, apparatus, computer equipment and storage medium
CN111104312A (en) * 2019-11-21 2020-05-05 苏州浪潮智能科技有限公司 Test case variable storage management method, system, terminal and storage medium
CN111199146B (en) * 2020-01-10 2023-09-26 深圳前海环融联易信息科技服务有限公司 Test report generation method, device, computer equipment and storage medium
CN112231210A (en) * 2020-10-13 2021-01-15 中移(杭州)信息技术有限公司 Test method, equipment and storage medium under network function virtualization environment
CN112286825A (en) * 2020-11-24 2021-01-29 北斗星通智联科技有限责任公司 Screen testing method and device for intelligent cabin and electronic equipment
US11132273B1 (en) * 2020-12-15 2021-09-28 International Business Machines Corporation System testing infrastructure with hidden variable, hidden attribute, and hidden value detection
CN113918395A (en) * 2021-09-29 2022-01-11 浪潮(山东)计算机科技有限公司 Test report generation method, device and medium
CN114448665A (en) * 2021-12-22 2022-05-06 天翼云科技有限公司 Method and device for detecting WEB application firewall rules and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301122A (en) * 2017-05-10 2017-10-27 深圳市小牛在线互联网信息咨询有限公司 interface test method, device, storage medium and computer equipment
CN107391379A (en) * 2017-07-28 2017-11-24 武汉斗鱼网络科技有限公司 Interface automatic test approach and device
CN107506294A (en) * 2017-07-04 2017-12-22 深圳市小牛在线互联网信息咨询有限公司 Visualize automated testing method, device, storage medium and computer equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834595B (en) * 2015-02-15 2017-09-12 网易(杭州)网络有限公司 A kind of Visual Automatic Test method and system
CN105335293B (en) * 2015-11-30 2019-08-30 努比亚技术有限公司 A kind of automatization test system and method based on interface concurrent
CN106095673B (en) * 2016-06-07 2018-12-14 深圳市泰久信息系统股份有限公司 Automated testing method and system based on WEB interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301122A (en) * 2017-05-10 2017-10-27 深圳市小牛在线互联网信息咨询有限公司 interface test method, device, storage medium and computer equipment
CN107506294A (en) * 2017-07-04 2017-12-22 深圳市小牛在线互联网信息咨询有限公司 Visualize automated testing method, device, storage medium and computer equipment
CN107391379A (en) * 2017-07-28 2017-11-24 武汉斗鱼网络科技有限公司 Interface automatic test approach and device

Also Published As

Publication number Publication date
CN108388514A (en) 2018-08-10
WO2019161619A1 (en) 2019-08-29

Similar Documents

Publication Publication Date Title
CN108388514B (en) Interface automation test method, device, equipment and computer readable storage medium
CN107391379B (en) Automatic interface testing method and device
US10853232B2 (en) Adaptive system for mobile device testing
CN109710508B (en) Test method, test device, test apparatus, and computer-readable storage medium
US11169910B2 (en) Probabilistic software testing via dynamic graphs
CN114996103A (en) Page abnormity detection method and device, electronic equipment and storage medium
CN111736951A (en) Simulation method for automatic driving, computer device, and storage medium
CN114911706A (en) Use case recommendation method, device, equipment and storage medium
CN112241362A (en) Test method, test device, server and storage medium
CN110688173B (en) Positioning method and device of components in cross-platform interface framework and electronic equipment
CN112988578A (en) Automatic testing method and device
CN116738091A (en) Page monitoring method and device, electronic equipment and storage medium
JP6747161B2 (en) Software quality judgment method
CN111274143B (en) Buried point test method, buried point test device, buried point test equipment and storage medium
CN113722229A (en) Software testing method and device, electronic equipment and storage medium
CN109165127B (en) Problem interface positioning method and device and electronic equipment
CN108108369B (en) Method and device for processing calling error of common interface library
CN114968751A (en) Program debugging method and program debugging device of code-free development platform
CN110727537A (en) Method and device for uniformly processing response message, computer equipment and storage medium
CN111949510A (en) Test processing method and device, electronic equipment and readable storage medium
CN111143229A (en) Software testing method and device, computer equipment and computer readable storage medium
CN111061613A (en) Front-end abnormity monitoring method and device and computer equipment
CN111522737B (en) Automatic test verification method and device for front-end interface and storage medium
CN111158746B (en) Method and device for acquiring call relationship
CN114064484A (en) Interface testing method and device, electronic equipment and readable 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
GR01 Patent grant
GR01 Patent grant