CN109254916A - A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring - Google Patents

A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring Download PDF

Info

Publication number
CN109254916A
CN109254916A CN201811004621.1A CN201811004621A CN109254916A CN 109254916 A CN109254916 A CN 109254916A CN 201811004621 A CN201811004621 A CN 201811004621A CN 109254916 A CN109254916 A CN 109254916A
Authority
CN
China
Prior art keywords
server
requestmapping
test
module
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811004621.1A
Other languages
Chinese (zh)
Inventor
徐飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201811004621.1A priority Critical patent/CN109254916A/en
Publication of CN109254916A publication Critical patent/CN109254916A/en
Pending legal-status Critical Current

Links

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/3688Test management for test execution, e.g. scheduling of test suites
    • 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)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the present application discloses a kind of method of visualization RestFul interface testing that injection is relied on based on Spring, which is characterized in that for improving the operability and intuitive of interface testing, reduces the difficulty of interface testing, improves the efficiency of interface testing.The embodiment of the present application method includes: the RequestMapping set for the controller that server obtains in Spring container;The operation of the server response user, the selection target RequestMapping from RequestMapping set;The server determines corresponding attribute according to the target RequestMapping;The server shows the corresponding attribute;The server carries out assignment to the corresponding attribute, calls corresponding interface;The server receives the actual result that the interface returns;The server is tested according to the actual result and presetting results.

Description

Visual RestFul interface testing method based on Spring dependent injection and server
Technical Field
The application relates to the field of computers, in particular to a visual RestFul interface testing method and server based on Spring dependent injection.
Background
Spring Dependency Injection (DI) is a dependency relationship between components that is determined by a container at runtime, i.e., a container dynamically injects a certain dependency relationship into a component. The purpose of relying on injection is not to bring more functions to a software system, but to improve the frequency of component reuse and build a flexible and extensible platform for the system. By relying on an injection mechanism, the server can specify resources required by a target only through simple configuration without any codes to complete the business logic of the server, and does not need to care about where the specific resources come and by whom the specific resources are realized.
Disclosure of Invention
The embodiment of the application provides a visual RestFul interface testing method based on Spring dependent injection, which is used for intuitively testing the RestFul interface.
A first aspect of the present application provides a visual RestFul interface test method based on Spring-dependent injection, which may include:
the server acquires a RequestMapping set of the controller in the Spring container;
the server responds to the operation of the user and selects a target RequestMapping from the RequestMapping set;
the server determines corresponding attributes according to the target RequestMapping;
the server displays the corresponding attribute;
the server assigns the corresponding attribute and calls a corresponding interface;
the server receives the actual result returned by the interface;
and the server tests according to the actual result and the preset result.
Optionally, in some embodiments of the application, the server performs a test according to the actual result and the preset result, which may include:
if the actual result is the same as the preset result, the server displays the indication information that the test is passed;
and if the actual result is different from the preset result, the server displays the indicating information that the test fails.
Optionally, in some embodiments of the present application, the method may further include:
the server acquires the controller in the Spring container;
the server presents the controller via a drop down list.
Optionally, in some embodiments of the present application, the method may further include:
the server responds to the operation of the user and generates a clearing instruction;
and the server removes the data generated in the test process according to the removing instruction.
Optionally, in some embodiments of the present application, the method may further include:
the server responds to the operation of the user and generates a reservation instruction;
and the server stores the data generated in the test process according to the reservation instruction.
A second aspect of the present application provides a server, which may include:
the acquisition module is used for acquiring a RequestMapping set of the controller in the Spring container;
the selection module is used for responding to the operation of a user and selecting a target RequestMapping from the RequestMapping set;
the determining module is used for determining corresponding attributes according to the target RequestMapping;
the display module is used for displaying the corresponding attribute;
the calling module is used for assigning the corresponding attribute and calling the corresponding interface;
the receiving module is used for receiving the actual result returned by the interface;
and the test module is used for testing according to the actual result and the preset result.
Alternatively, in some embodiments of the present application,
the test module is specifically used for displaying the indication information that the test passes if the actual result is the same as the preset result; and if the actual result is different from the preset result, displaying the indicating information that the test fails.
Alternatively, in some embodiments of the present application,
the acquisition module is also used for acquiring the controller in the Spring container;
the display module is further used for displaying the controller through a drop-down list.
Optionally, in some embodiments of the present application, the server may further include:
the generating module is used for generating a clearing instruction according to the operation of a user;
and the clearing module is used for clearing the data generated in the test process according to the clearing instruction.
Optionally, in some embodiments of the present application, the server may further include:
the generating module is used for responding to the operation of a user and generating a reservation instruction;
and the storage module is used for storing the data generated in the test process according to the retention instruction.
A third aspect of the present application provides a server, which may include:
the system comprises a memory, a transceiver and a processor, wherein the memory, the transceiver and the processor are connected through a bus;
the memory is used for storing operation instructions;
the transceiver is used for receiving the actual result returned by the interface;
the processor is used for acquiring a RequestMapping set of the controller in the Spring container; responding to the operation of a user, and selecting a target RequestMapping from the RequestMapping set; determining corresponding attributes according to the target RequestMapping; displaying the corresponding attribute; and testing according to the actual result and the preset result.
Alternatively, in some embodiments of the present application,
the processor is specifically configured to display indication information that the test is passed if the actual result is the same as the preset result; and if the actual result is different from the preset result, displaying the indicating information that the test fails.
Alternatively, in some embodiments of the present application,
the processor is also used for acquiring the controller in the Spring container; and displaying the controller through a drop-down list.
Alternatively, in some embodiments of the present application,
the processor is also used for responding to the operation of a user and generating a clearing instruction; and clearing the data generated in the test process according to the clearing instruction.
Alternatively, in some embodiments of the present application,
the processor is also used for responding to the operation of a user and generating a reservation instruction; and storing the data generated in the test process according to the reservation instruction.
A fourth aspect of the embodiments of the present application provides a storage medium, and it should be noted that a part of the technical solution of the present application, or all or part of the technical solution, which substantially contributes to the prior art, may be embodied in the form of a software product stored in a storage medium for storing computer software instructions for the server, which includes a program designed for the server to execute the above aspects.
The storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
A fifth aspect of the embodiments of the present application provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method according to any one of the above aspects or any alternative implementation of the aspects.
According to the technical scheme, the embodiment of the application has the following advantages:
in the embodiment of the application, a server acquires a RequestMapping set of a controller in a Spring container; the server responds to the operation of a user and selects a target RequestMapping from the RequestMapping set; the server determines corresponding attributes according to the target RequestMapping; the server displays the corresponding attribute; the server assigns the corresponding attribute and calls a corresponding interface; the server receives an actual result returned by the interface; and the server tests according to the actual result and the preset result. On the basis of the traditional interface test, the visual operation interface is provided based on Spring dependence injection, so that the operability and intuition of the interface test are improved, the difficulty of the interface test is reduced, and the efficiency of the interface test is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the embodiments and the drawings used in the description of the prior art, and obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained according to the drawings.
Fig. 1 is a schematic diagram of an embodiment of a method for visualizing RestFul interface testing based on Spring-dependent injection in an embodiment of the present application;
FIG. 2 is a schematic diagram of a server test interface in an embodiment of the present application;
FIG. 3A is a schematic diagram of an embodiment of a server in an embodiment of the present application;
FIG. 3B is a schematic diagram of another embodiment of a server in the embodiment of the present application;
FIG. 3C is a schematic diagram of another embodiment of a server in an embodiment of the present application;
fig. 4 is a schematic diagram of another embodiment of the server in the embodiment of the present application.
Detailed Description
The embodiment of the application provides a visual RestFul interface testing method and server based on Spring-dependent injection, which are used for improving the operability and intuition of interface testing, reducing the difficulty of interface testing and improving the efficiency of interface testing.
For a person skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. The embodiments in the present application shall fall within the protection scope of the present application.
The Spring framework avoids coupling between a caller and a factory, and through 'macro regulation' of the Spring container, the caller only needs to passively accept the assignment of the Spring container to a member variable of the caller without actively acquiring a depended object. This passive acquisition is called injection dependent, or control inversion. The dependent implant is further divided into a set implant and a build implant. While the spring framework is responsible for implementing dependent injection by configuring xml files. While the set-point injection and the build injection are distinguished by differences in configuration.
The invention provides a visual RestFul (representationalstate transfer) interface testing tool based on Spring-dependent injection, so that the RestFul interface can be tested intuitively.
The method has the remarkable characteristics that based on Spring dependent injection, the Bean managed by the Spring container is displayed in a graphical interface mode, a certain interface can be selected to be tested, the relevant attributes of the input parameter and the output parameter of the interface can be displayed, the attribute of the input parameter can be assigned, the expected result of the output parameter mark is marked, data presetting and data cleaning are supported, the operation is convenient, and the difficulty of interface testing is reduced.
The technical solution of the present application is further described below by way of an embodiment, as shown in fig. 1, fig. 1 is a schematic diagram of an embodiment of a method for visualizing a RestFul interface test based on Spring-dependent injection in the embodiment of the present application. The method can comprise the following steps:
101. the server presets data.
In the embodiment of the present application, first, before the Restful interface is called, data presetting needs to be performed on the server. The server supports selection of database types and configuration of database connection strings, and can preset data to be used in the test process in a database script mode.
It should be noted that step 101 is an optional step.
102. The server acquires a RequestMapping set of the controller in the Spring container.
Before the server acquires a RequestMapping set of the controller in the Spring container, the server acquires the controller in the Spring container; the server presents the controller via a drop down list.
103. The server selects a target RequestMapping from the RequestMapping set in response to an operation by the user.
The interface name can be displayed in a form of a drop-down list by acquiring all controllers (controllers) managed in the Spring container, after a target Controller is selected, all RequestMapping is displayed for selection, and the selected target Controller and the target RequestMapping display the text definitions according to the comments.
104. And the server determines the corresponding attribute according to the target RequestMapping.
Aiming at the target RequestMapping selected by the server, the server acquires the attribute corresponding to the RequestBody in the spring container. The corresponding attribute may include an attribute name, a type, a Chinese paraphrase, and the like.
105. The server displays the corresponding attributes.
The server may present the corresponding attributes and then perform the value assignment. The server displays the name, type and Chinese paraphrase of the attribute, and can assign the attribute and make type base judgment.
106. And the server assigns the corresponding attribute and calls the corresponding interface.
And after the server assigns the attribute corresponding to the target RequestMapping, the corresponding interface can be called. As shown in fig. 2, fig. 2 is a schematic diagram of a server test interface in the embodiment of the present application.
107. The server receives the actual results returned by the interface.
The server can predict the return value from the interface, acquire the type of the return value aiming at the target RequestMapping selected by the server before, display the attribute name, the type and the Chinese paraphrase of the return value, and input the expected result of the return value.
108. And the server tests according to the actual result and the preset result.
The server performs a test according to the actual result and the preset result, which may include: if the actual result is the same as the preset result, the server displays the indication information that the test is passed; and if the actual result is different from the preset result, the server displays the indicating information that the test fails.
And the server displays the test result. And comparing the return value after the interface calling with the input preset result, if the return value is the same as the input preset result, the result is that the test is passed, if the return value is different from the preset result, the result is that the test is not passed, and displaying the difference between the actual result and the preset result.
Alternatively, in some embodiments of the present application,
the server responds to the operation of the user and generates a clearing instruction;
and the server clears the data generated in the test process according to the clearing instruction.
Or,
the server responds to the operation of the user and generates a reservation instruction;
and the server stores the data generated in the test process according to the reservation instruction.
The server can carry out data cleaning promptly, can select whether to clear up the data that produce in the test procedure, and the instrument can delete the data that produce in the test procedure when selecting the clearance, restores the data of revising, remains the data that produce in the test procedure after the test was accomplished when selecting not clear up.
The invention is based on spring-dependent injection and displays the injection object. The method comprises the steps that a tool obtains RequestMapping of all controllers in a spring container for selection, for the selected RequestMapping, the attributes of RequestBody objects injected into the container are obtained, the attributes and attribute definitions are displayed, the attributes can be respectively assigned and then called, meanwhile, expected result input can be carried out on the objects returned by the interfaces, actual returned results can be compared with the expected results after calling, and test results are displayed.
On the basis of the traditional interface test, the visual operation interface is provided based on Spring dependence injection, so that the operability and intuition of the interface test are improved, the difficulty of the interface test is reduced, and the efficiency of the interface test is improved.
There are three ways for configuring a dependent injection for a bean in a Spring container:
(1) this is the most common way to inject using the setter method of the property;
(2) injecting by using a constructor;
(3) using Filed injection (for annotation).
These three modes are explained below:
(1) setter method injection using attributes
First, an injected bean is configured, and in a class corresponding to the bean, an object attribute or an attribute of a basic data type to be injected should exist. For example: and injecting UserDAO for the UserBiz class and simultaneously injecting a basic data type String for the UserBiz class, and setting a setter method for the UserDAO object and the String type for dependent injection.
<bean id="userBiz"class="com.text.biz.impl.UserBizImpl">
<property name="userDao">
<ref>userDao</ref>
</property>
</bean>
The above is a way of using the attribute's setter method to perform dependent injection.
(2) Injection using constructors
Firstly, injecting PersonDAO and data of String type in a PersonBiz class; in the class, a setter method is not set for attributes of PersonDAO attributes and String data types, but a construction method of the class needs to be generated; the following were used:
public class PersonBizImpl implements PersonBiz{
// declaring "dependent object" PersonDAO
PersonDAO personDao=null;
V/declare "basic data types of dependencies"
String str=null;
Method for generating a parameterless structure
public PersonBizImpl(){
super();
}
Method for generating belt parameters
public PersonBizImpl(PersonDAO personDao,String str){
super();
this.personDao=personDao;
this.str=str;
}
public void addPerson(){
this.personDao.addPerson();
System.out.println(str);
}
}
Second, a bean of the class is configured in a configuration file, and a constructor is configured, wherein a < constructor-arg > node is used in the configuration constructor, and the node has four attributes:
index is an index that specifies the attributes of the injection, starting from 0, as: 0 represents personDao, 1 represents str attribute;
type refers to the type corresponding to the attribute, such as com, aptech, dao, personnao;
ref refers to a referenced dependent object;
value is used when not dependent objects are injected, but basic data types.
The following were used:
< | A! Using constructor configuration dependent implantation >
<bean id="personDao"class="com.aptech.dao.impl.PersonDAOImpl"></bean>
<bean id="personBiz"class="com.aptech.biz.impl.PersonBizImpl">
<constructorarg index="0"type="com.aptech.dao.PersonDAO"ref="personDao"></constructor-arg>
< constractor-arg index ═ 1 ═ value ═ Spring learning >
</bean>
(3) Using field (filled) injection (annotated)
In Spring, injection dependent objects can be assembled manually or automatically, and manual assembly is recommended in practical application development, because automatic assembly generates many unknown conditions, and developers cannot predict final assembly results.
The manual assembly of dependent objects is divided into two ways:
one is in XML file, by configuring under bean node; this is both the way that the setter method using properties injects dependent objects and the constructor method injects dependent objects as discussed above.
The other method is to assemble the Java code in an annotation mode, and add @ Resource or @ automatic to the code.
Autowired is automatic injection, which automatically finds a proper bean from the spring context to inject;
resource is used to specify name injection;
qualifier and Autowired are used together, and names of beans are specified, such as:
@Autowired
@Qualifier("userDAO")
private UserDAO userDAO;
first, we need to configure the following information in the profile application context of Spring container xml file, and the confidence is a template of Spring profile:
<?xml version="1.0"encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/bean s
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
">
</beans>
note that: only code with a red portion configured can introduce the annotated namespace, otherwise errors are reported. The above configuration implicitly registers a plurality of processors that parse annotations: AutowiredAnnotitionBeanPostProcessor, CommonanottationBeanPostProcessor, PersitenetionBeanPostProcessor and the like.
Secondly, opening a < context: annotation-configuration > node in the configuration file to tell the Spring container that the dependent object can be injected in an annotation mode; its code in the configuration file is as follows:
<beans>
……
<context:annotation-config><context:annotation-config>
……
</beans>
third, the bean objects are configured in the configuration file as follows:
<bean id="userDao"class="com.springtest.dao.impl.UserDAOImpl"></bean>
<bean id="userBiz"class="com.springtest.biz.impl.UserBizImpl"></bean>
fourthly, in the BIZ class which needs dependent injection, a dependent object is declared, a setter method for generating the dependent object is not needed, and an annotation is added to the object:
public class UserBizImpl implements UserBiz{
@Resource(name="userDao")
private UserDAO userDao=null;
public void addUser(){
this.userDao.addUser();
}
}
wherein, the Java code can use @ automatic or @ Resource annotation mode to perform Spring dependent injection. The difference between the two is: the @ automatic default is assembled according to types, the @ Resource default is assembled according to names, and when a bean matched with the name cannot be found, the bean is assembled according to the types.
Such as: annotating the instance object of the code UserDAO interface by @ automatic, searching a type matched with the UserDAO object in a Spring container, and injecting the type into a UserDAO field if the type is found;
if @ Resource is used for dependency injection, it will first find the type matching the name in the Spring container according to the specified name attribute, for example: @ Resource (name ═ userDao), if the name is not found, the name is searched according to the type, and after the name is found, the field userDao is injected.
@ Resource is typically used.
The method of using annotation to inject dependent objects is not used for writing the dependent objects in the code, and a large number of dependent objects are not needed to be configured in a configuration file, so that the code is simpler and clearer, and is easy to maintain.
As shown in fig. 3A, fig. 3A is a schematic diagram of an embodiment of a server in an embodiment of the present application, and may include:
an obtaining module 301, configured to obtain a RequestMapping set of a controller in a Spring container;
a selecting module 302, configured to select a target RequestMapping from a RequestMapping set in response to a user operation;
a determining module 303, configured to determine a corresponding attribute according to the target RequestMapping;
a display module 304 for displaying the corresponding attribute;
a calling module 305, configured to assign a value to the corresponding attribute and call the corresponding interface;
a receiving module 306, configured to receive an actual result returned by the interface;
and the test module 307 is configured to perform a test according to the actual result and the preset result.
Alternatively, in some embodiments of the present application,
the test module 307 is specifically configured to display indication information that the test is passed if the actual result is the same as the preset result; and if the actual result is different from the preset result, displaying the indicating information that the test fails.
Alternatively, in some embodiments of the present application,
the obtaining module 301 is further configured to obtain a controller in a Spring container;
the presentation module 304 is further configured to present the controller via a drop down list.
Optionally, in some embodiments of the present application, as shown in fig. 3B, fig. 3B is a schematic diagram of an embodiment of a server in the embodiments of the present application, and the server may further include:
a generating module 308, configured to generate a clearing instruction according to an operation of a user;
and the clearing module 309 is configured to clear data generated in the test process according to the clearing instruction.
Optionally, in some embodiments of the present application, as shown in fig. 3C, fig. 3C is a schematic diagram of an embodiment of a server in the embodiments of the present application, and the server may further include:
a generating module 308, configured to generate a reservation instruction in response to an operation of a user;
and the saving module 310 is configured to save data generated in the test process according to the retention instruction.
As shown in fig. 4, fig. 4 is a schematic diagram of another embodiment of a server in the embodiment of the present application, and may include:
the device comprises a memory, a transceiver and a processor, wherein the memory, the transceiver and the processor are connected through a bus;
a memory for storing operating instructions;
the transceiver is used for receiving the actual result returned by the interface;
the processor is used for acquiring a RequestMapping set of the controller in the Spring container; responding to the operation of a user, and selecting a target RequestMapping from the RequestMapping set; determining corresponding attributes according to the target RequestMapping; displaying the corresponding attribute; and testing according to the actual result and the preset result.
Alternatively, in some embodiments of the present application,
the processor is specifically used for displaying the indication information that the test is passed if the actual result is the same as the preset result; and if the actual result is different from the preset result, displaying the indicating information that the test fails.
Alternatively, in some embodiments of the present application,
the processor is also used for acquiring the controller in the Spring container; and displaying the controller through a drop-down list.
Alternatively, in some embodiments of the present application,
the processor is also used for responding to the operation of a user and generating a clearing instruction; and clearing the data generated in the test process according to the clearing instruction.
Alternatively, in some embodiments of the present application,
the processor is also used for responding to the operation of a user and generating a reservation instruction; and storing the data generated in the test process according to the reservation instruction.
The embodiment of the present application provides a computer program product, which when run on a computer, causes the computer to execute the method as described in the embodiment and any optional implementation manner shown in fig. 1.
The embodiment of the present application provides a computer storage medium, which includes instructions, when executed on a computer, cause the computer to perform the method as described in the embodiment and any optional implementation manner shown in fig. 1.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application 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 application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A visual RestFul interface test method based on Spring-dependent injection is characterized by comprising the following steps:
the server acquires a RequestMapping set of the controller in the Spring container;
the server responds to the operation of a user and selects a target RequestMapping from the RequestMapping set;
the server determines corresponding attributes according to the target RequestMapping;
the server displays the corresponding attribute;
the server assigns the corresponding attribute and calls a corresponding interface;
the server receives an actual result returned by the interface;
and the server tests according to the actual result and the preset result.
2. The method of claim 1, wherein the server performs a test according to the actual result and the preset result, comprising:
if the actual result is the same as the preset result, the server displays the indication information that the test is passed;
and if the actual result is different from the preset result, the server displays the indicating information that the test fails.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
the server acquires a controller in the Spring container;
the server displays the controller through a drop-down list.
4. The method according to claim 1 or 2, characterized in that the method further comprises:
the server responds to the operation of the user and generates a clearing instruction;
and the server clears the data generated in the test process according to the clearing instruction.
5. The method according to claim 1 or 2, characterized in that the method further comprises:
the server responds to the operation of the user and generates a reservation instruction;
and the server stores the data generated in the test process according to the reservation instruction.
6. A server, comprising:
the acquisition module is used for acquiring a RequestMapping set of the controller in the Spring container;
the selection module is used for responding to the operation of a user and selecting a target RequestMapping from the RequestMapping set;
the determining module is used for determining corresponding attributes according to the target RequestMapping;
the display module is used for displaying the corresponding attributes;
the calling module is used for assigning the corresponding attribute and calling the corresponding interface;
the receiving module is used for receiving an actual result returned by the interface;
and the test module is used for testing according to the actual result and the preset result.
7. The server according to claim 6,
the test module is specifically used for displaying the indication information that the test is passed if the actual result is the same as the preset result; and if the actual result is different from the preset result, displaying the indicating information that the test fails.
8. The server according to claim 6 or 7,
the acquisition module is further used for acquiring the controller in the Spring container;
the display module is further used for displaying the controller through a drop-down list.
9. The server according to claim 6 or 7, wherein the server further comprises:
the generating module is used for generating a clearing instruction according to the operation of a user;
and the clearing module is used for clearing data generated in the test process according to the clearing instruction.
10. The server according to claim 6 or 7, wherein the server further comprises:
the generating module is used for responding to the operation of a user and generating a reservation instruction;
and the storage module is used for storing the data generated in the test process according to the retention instruction.
CN201811004621.1A 2018-08-30 2018-08-30 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring Pending CN109254916A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811004621.1A CN109254916A (en) 2018-08-30 2018-08-30 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811004621.1A CN109254916A (en) 2018-08-30 2018-08-30 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring

Publications (1)

Publication Number Publication Date
CN109254916A true CN109254916A (en) 2019-01-22

Family

ID=65048968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811004621.1A Pending CN109254916A (en) 2018-08-30 2018-08-30 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring

Country Status (1)

Country Link
CN (1) CN109254916A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221820A (en) * 2019-04-23 2019-09-10 平安科技(深圳)有限公司 The general type of spring frame relies on method for implanting, device and computer equipment, storage medium
CN110798376A (en) * 2019-10-09 2020-02-14 苏宁云计算有限公司 Interface testing method and device, computer equipment and storage medium
CN111124931A (en) * 2019-12-30 2020-05-08 中国农业银行股份有限公司 Java code compliance checking method and device
CN111831365A (en) * 2020-07-29 2020-10-27 中国平安财产保险股份有限公司 Interface route forwarding method, system, computer equipment and readable storage medium
CN113391972A (en) * 2021-07-30 2021-09-14 北京北大方正电子有限公司 Interface testing method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105843609A (en) * 2016-03-18 2016-08-10 浪潮软件集团有限公司 MVC frame based on Spring and MyBatis
CN106201808A (en) * 2015-05-04 2016-12-07 北京畅游天下网络技术有限公司 The automation interface method of testing of a kind of server end and system
CN107168871A (en) * 2017-04-28 2017-09-15 安徽四创电子股份有限公司 A kind of method of the fast debugging in RESTful interface exploitations
CN107423223A (en) * 2017-08-10 2017-12-01 中国民航信息网络股份有限公司 Test and management system
CN107592238A (en) * 2017-08-07 2018-01-16 千寻位置网络有限公司 Automatic test approach and system, service terminal, the memory of interface
CN108415834A (en) * 2018-02-12 2018-08-17 平安科技(深圳)有限公司 Explain rear end method of calibration, device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201808A (en) * 2015-05-04 2016-12-07 北京畅游天下网络技术有限公司 The automation interface method of testing of a kind of server end and system
CN105843609A (en) * 2016-03-18 2016-08-10 浪潮软件集团有限公司 MVC frame based on Spring and MyBatis
CN107168871A (en) * 2017-04-28 2017-09-15 安徽四创电子股份有限公司 A kind of method of the fast debugging in RESTful interface exploitations
CN107592238A (en) * 2017-08-07 2018-01-16 千寻位置网络有限公司 Automatic test approach and system, service terminal, the memory of interface
CN107423223A (en) * 2017-08-10 2017-12-01 中国民航信息网络股份有限公司 Test and management system
CN108415834A (en) * 2018-02-12 2018-08-17 平安科技(深圳)有限公司 Explain rear end method of calibration, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
蓝色的咖啡: "《https://www.jianshu.com/p/f244e2f8》", 4 December 2017 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221820A (en) * 2019-04-23 2019-09-10 平安科技(深圳)有限公司 The general type of spring frame relies on method for implanting, device and computer equipment, storage medium
CN110221820B (en) * 2019-04-23 2024-05-28 平安科技(深圳)有限公司 Spring framework generalized dependency injection method and device, computer equipment and storage medium
CN110798376A (en) * 2019-10-09 2020-02-14 苏宁云计算有限公司 Interface testing method and device, computer equipment and storage medium
CN111124931A (en) * 2019-12-30 2020-05-08 中国农业银行股份有限公司 Java code compliance checking method and device
CN111124931B (en) * 2019-12-30 2023-10-10 中国农业银行股份有限公司 Java code compliance checking method and device
CN111831365A (en) * 2020-07-29 2020-10-27 中国平安财产保险股份有限公司 Interface route forwarding method, system, computer equipment and readable storage medium
CN113391972A (en) * 2021-07-30 2021-09-14 北京北大方正电子有限公司 Interface testing method and device

Similar Documents

Publication Publication Date Title
CN109254916A (en) A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring
US9977658B2 (en) Code validation using content assist
US9021440B1 (en) System and method for automated test script generation
CN109446218A (en) SQL statement generation method, device and computer readable storage medium
US11625248B2 (en) Operator registration method and apparatus for deep learning framework, device and storage medium
US11128721B2 (en) Action flow fragment management
KR101554424B1 (en) Method and apparatus for auto generation of test case
CN111475161B (en) Method, device and equipment for accessing component
US20170220613A1 (en) Systems and methods for database orientation transformation
US9311345B2 (en) Template based database analyzer
CN104679500B (en) Method and device for realizing automatic generation of entity class
CN111026670B (en) Test case generation method, test case generation device and storage medium
US9678856B2 (en) Annotated test interfaces
Bennett et al. A transformation system for maintenance-turning theory into practice
Mushtaq et al. Multilingual source code analysis: State of the art and challenges
CN106528115A (en) Visualized interface development method and device
CN113688134A (en) Visual variable management method, system and equipment based on multidimensional data
US11010021B2 (en) Context menu fragment management
CN115543324B (en) Method, device, equipment and medium for generating interactive interface
CN116841900A (en) Interface document, test case generation method, test case generation device, computer equipment and storage medium
CN113220279A (en) Code index management method, device, equipment and medium
US9785659B2 (en) Protecting storage data during system migration
US9405514B1 (en) Process fragment management
CN111221610B (en) Page element acquisition method and device
JP2016146022A (en) Model base development support device, model base development support method, and model base development support program

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190122