CN111045650A - Design method and device of Mocker joint debugging tool and computer equipment - Google Patents

Design method and device of Mocker joint debugging tool and computer equipment Download PDF

Info

Publication number
CN111045650A
CN111045650A CN201911276047.XA CN201911276047A CN111045650A CN 111045650 A CN111045650 A CN 111045650A CN 201911276047 A CN201911276047 A CN 201911276047A CN 111045650 A CN111045650 A CN 111045650A
Authority
CN
China
Prior art keywords
class
mocker
function
mockaspect
annotation
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
CN201911276047.XA
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.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service 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 Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN201911276047.XA priority Critical patent/CN111045650A/en
Publication of CN111045650A publication Critical patent/CN111045650A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented

Abstract

The invention provides a design method, a device and computer equipment of a Mocker joint debugging tool, wherein the method comprises the steps of defining a MockAssiect class, adding a first annotation on the MockAssiect class, and identifying the MockAssiect class as a section which can be read by a container; defining a first function method, and adding a second annotation on the first function method, so that when a class is added with the annotation added by the first function method, all the function methods defined in the class are a tangent plane; defining a second function method, and adding the enhancement function of the section in the method body of the second function method; configuring a MockAspect class, and adding a third annotation to the MockAspect class, wherein the annotation content is an initialization condition of the MockAspect class; and in the project configuration file, a switch trigger attribute of the Mocker is configured, so that the start and stop of the Mocker simulation interface are controlled. The Mocker joint debugging tool designed by the invention has the advantages that the control on the Mocker simulation interface is simpler and faster when the Mocker joint debugging tool is used for debugging, and the debugging efficiency is improved.

Description

Design method and device of Mocker joint debugging tool and computer equipment
Technical Field
The invention relates to a design method and a device of a joint debugging tool and computer equipment, in particular to a design method and a device of a Mocker joint debugging tool and computer equipment.
Background
Mocker is a tool which is provided for the front-end developer to carry out front-end interactive joint debugging before the back-end developer does not complete the business logic development but the front-end developer completes the development work, and can simulate the return value of a request interface, so that the front-end developer can carry out interface joint debugging in advance, and the development parallel efficiency is greatly improved. However, after the development is completed, the back-end developer needs to cancel the function of the analog interface, so that the front end can call the real service interface of the back end. The conventional method for canceling the simulation interface by the conventional Mocker joint debugging tool is to annotate relevant Mock codes, and when the simulation interface needs to be used, the annotated codes need to be cancelled. Because the debugging process needs to be switched back and forth during the starting and stopping of the analog interface, the debugging time and cost are high, and the efficiency is low, so a new design needs to be provided for the Mocker joint debugging tool.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: a design method and a device of a Mocker joint debugging tool and computer equipment are provided to improve the debugging efficiency of the Mocker joint debugging tool.
In order to solve the technical problems, the invention adopts the technical scheme that: a design method of a Mocker joint debugging tool comprises the following steps,
defining a MockAssiact class, and adding a first annotation on the MockAssiact class to identify the MockAssiact class as a section which can be read by a container;
defining a first function method, and adding a second annotation on the first function method, so that when a class is added with the annotation added by the first function method, all the function methods defined in the class are a tangent plane;
defining a second function method, and adding the enhancement function of the section in the method body of the second function method;
configuring a MockAspect class, and adding a third annotation to the MockAspect class, wherein the annotation content is an initialization condition of the MockAspect class;
and in the project configuration file, a switch trigger attribute of the Mocker is configured, so that the start and stop of the Mocker simulation interface are controlled.
Furthermore, the initialization condition of the MockAspect class is that,
initialize the class when mock. When the attribute is not configured or the attribute value mock.
Furthermore, the method body of the second function method adds a tangent plane enhancement function to realize a return value function of the simulation request interface.
The invention also provides a design device of the Mocker joint debugging tool, which comprises,
the MockAspect class definition module is used for defining a MockAspect class, and adding a first annotation on the MockAspect class so as to identify the MockAspect class as a section which can be read by a container;
the first function method definition module is used for defining a first function method, and adding a second annotation on the first function method so that when a class is added with the annotation added by the first function method, all the function methods defined in the class are a tangent plane;
the second function method definition module is used for defining a second function method, and adding the enhancement function of the section in the method body of the second function method;
the MockAspect class configuration module is used for configuring MockAspect classes and adding third annotations to the MockAspect classes, wherein the annotation contents are initialization conditions of the MockAspect classes;
and the Mocker configuration module is used for configuring the switch trigger attribute of the Mocker in the project configuration file so as to control the start and stop of the Mocker simulation interface.
Further, in the configuration module for MockAspect, the initialization condition of MockAspect is as follows,
initialize the class when mock. When the attribute is not configured or the attribute value mock.
Further, in the second function method definition module, the enhancement function of the section added in the method body of the second function method is to realize the return value function of the simulation request interface.
The invention also provides computer equipment, which comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor is used for realizing the design method of the Mocker joint debugging tool when executing the computer program.
The invention has the beneficial effects that: through the Mocker joint debugging tool designed by the method, when the Mocker joint debugging tool is debugged, the switch trigger attribute of the Mocker can be configured in the project configuration file, so that the Mocker simulation interface is controlled to be started or stopped, related Mock codes do not need to be annotated, the annotation does not need to be cancelled, the control on the Mocker simulation interface is simpler and faster, and the debugging efficiency is improved.
Drawings
The following detailed description of the invention refers to the accompanying drawings.
FIG. 1 is a flow chart of a design method of a Mocker joint debugging tool according to an embodiment of the present invention;
FIG. 2 is a block diagram of a design apparatus of a Mocker joint debugging tool according to an embodiment of the present invention;
FIG. 3 is a schematic block diagram of a computer apparatus of 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.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As shown in fig. 1, the first embodiment of the present invention is: a design method of a Mocker joint debugging tool comprises the following steps,
s10, defining a MockAspect class, and adding a first annotation on the MockAspect class to identify the MockAspect class as a section which can be read by a container;
s20, defining a first function method, and adding a second annotation on the first function method, so that when a class adds the annotation added by the first function method, all the function methods defined in the class are a tangent plane;
s30, defining a second function method, and adding the enhancement function of the section in the method body of the second function method;
s40, configuring a MockAspect class, and adding a third annotation to the MockAspect class, wherein the annotation content is an initialization condition of the MockAspect class;
and S50, configuring a switch trigger attribute of the Mocker in the project configuration file, and controlling the start and stop of the Mocker simulation interface.
Furthermore, the initialization condition of the MockAspect class is that,
initialize the class when mock. When the attribute is not configured or the attribute value mock.
Furthermore, the method body of the second function method adds a tangent plane enhancement function to realize a return value function of the simulation request interface.
In this embodiment, a specific implementation procedure is as follows,
firstly, defining a class MockAspact, and adding an @ Aspact annotation to the class to indicate that the class uses an AOP mechanism;
secondly, a public VOIDASPECT () method is defined, @ Point ("@ within (com.lls.frame.web.annotation.BaseRestController)") annotation is added to the method, that is, after a class adds the annotation of BaseRestController, all the methods defined in the class are a cut surface, and the enhancement of the method is performed on the cut surface, namely, some additional functions are performed after the process enters the method.
Third, a method public objectaroundmethod (proceedingpointjint) is defined, and @ arc ("aspect ()") is added to the method, where aspect () defines a section and the aroutmethod is a specific enhancement function. And realizing the return value function of the simulation request interface in the method body.
Fourth, when the management mocksapect class is configured, an annotation @ coordinated on property (value:, "mock. enabled", has value:, "true", and has missing: "false") is added to the mocksapect class, which means that the class is initialized when the value of mock. enabled is true, the Mocker is turned on at this time, and the Mocker is turned off when the value of the property or the value of the property is not configured
Fifthly, in the project configuration file application properties file, mock enabled attribute is configured as required, so as to control the start and stop of Mocker.
When the Mocker joint debugging tool designed according to the mode is debugged, the debugging steps are as follows:
when an http request comes, the interceptor of Mocker intercepts the request; the interceptor judges whether the request address carries the key word 'packer' or not, and if not, the request can go to a real interface; if the request address carries a Mocker key, the request will walk through the simulation interface. At this time, the mocker returns the simulation value to the caller according to the return value type of the method requested to be called. For example, if a String type is returned, the packer randomly simulates a String type value, such as: "abdc"; if it is an Integer type, then the mocker randomly models an Integer type value, such as 123.
The technical effects of the embodiment are as follows: through the Mocker joint debugging tool designed by the method, when the Mocker joint debugging tool is debugged, the switch trigger attribute of the Mocker can be configured in the project configuration file, so that the Mocker simulation interface is controlled to be started or stopped, related Mock codes do not need to be annotated, the annotation does not need to be cancelled, the control on the Mocker simulation interface is simpler and faster, and the debugging efficiency is improved.
As shown in fig. 2, the second embodiment of the present invention is: a design device of a Mocker joint debugging tool comprises a design device,
the MockAspect class definition module 10 is used for defining a MockAspect class, and adding a first annotation to the MockAspect class so as to identify the MockAspect class as a section which can be read by a container;
a first function method definition module 20, configured to define a first function method, and add a second annotation to the first function method, so that when a class adds an annotation added by the first function method, all function methods defined in the class will be a tangent plane;
a second function method definition module 30, configured to define a second function method, add the enhancement function of the section in the method body of the second function method;
the MockAspect class configuration module 40 is used for configuring MockAspect classes and adding third annotations to the MockAspect classes, wherein the annotation contents are initialization conditions of the MockAspect classes;
and the Mocker configuration module 50 is used for configuring the switch trigger attribute of the Mocker in the project configuration file so as to control the start and stop of the Mocker simulation interface.
Further, in the mocksoption class configuration module 40, the initialization condition of the mocksoption class is,
initialize the class when mock. When the attribute is not configured or the attribute value mock.
Further, in the second function method definition module 30, the enhancement function of adding the tangent plane in the method body of the second function method is to realize the return value function of the simulation request interface.
The invention also provides computer equipment, which comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor is used for realizing the design method of the Mocker joint debugging tool when executing the computer program.
The invention has the beneficial effects that: through the Mocker joint debugging tool designed by the method, when the Mocker joint debugging tool is debugged, the switch trigger attribute of the Mocker can be configured in the project configuration file, so that the Mocker simulation interface is controlled to be started or stopped, related Mock codes do not need to be annotated, the annotation does not need to be cancelled, the control on the Mocker simulation interface is simpler and faster, and the debugging efficiency is improved.
It should be noted that, as can be clearly understood by those skilled in the art, the design device of the Mocker joint debugging tool and the specific implementation process of each unit may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided herein.
The design means of the aforementioned Mocker joint debugging tool can be implemented in the form of a computer program that can be run on a computer device as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be a terminal or a server, where the terminal may 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 server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 3, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform a method for designing a Mocker joint debugging tool.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for running the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute a design method of a Mocker joint debugging tool.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run a computer program 5032 stored in the memory, so as to implement the design method of the Mocker joint debugging tool.
It should be understood that, in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 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.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program includes program instructions, and the computer program may be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program comprises program instructions. The program instructions, when executed by the processor, cause the processor to perform the design method of the above-described Mocker joint debugging tool.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
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.
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, various elements or components 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, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a 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 (7)

1. A design method of a Mocker joint debugging tool is characterized by comprising the following steps: comprises the following steps of (a) carrying out,
defining a MockAssiact class, and adding a first annotation on the MockAssiact class to identify the MockAssiact class as a section which can be read by a container;
defining a first function method, and adding a second annotation on the first function method, so that when a class is added with the annotation added by the first function method, all the function methods defined in the class are a tangent plane;
defining a second function method, and adding the enhancement function of the section in the method body of the second function method;
configuring a MockAspect class, and adding a third annotation to the MockAspect class, wherein the annotation content is an initialization condition of the MockAspect class;
and in the project configuration file, a switch trigger attribute of the Mocker is configured, so that the start and stop of the Mocker simulation interface are controlled.
2. The design method of the Mocker joint debugging tool of claim 1, wherein: the initialization condition of the MockAspect class is that,
initialize the class when mock. When the attribute is not configured or the attribute value mock.
3. The design method of the Mocker joint debugging tool of claim 1, wherein: the method body of the second function method adds the enhancement function of the tangent plane to realize the return value function of the simulation request interface.
4. The utility model provides a design device of Mocker joint debugging instrument which characterized in that: the design device of the Mocker joint debugging tool comprises,
the MockAspect class definition module is used for defining a MockAspect class, and adding a first annotation on the MockAspect class so as to identify the MockAspect class as a section which can be read by a container;
the first function method definition module is used for defining a first function method, and adding a second annotation on the first function method so that when a class is added with the annotation added by the first function method, all the function methods defined in the class are a tangent plane;
the second function method definition module is used for defining a second function method, and adding the enhancement function of the section in the method body of the second function method;
the MockAspect class configuration module is used for configuring MockAspect classes and adding third annotations to the MockAspect classes, wherein the annotation contents are initialization conditions of the MockAspect classes;
and the Mocker configuration module is used for configuring the switch trigger attribute of the Mocker in the project configuration file so as to control the start and stop of the Mocker simulation interface.
5. The apparatus of claim 4, wherein: in the MockAssiact type configuration module, the initialization condition of the MockAssiact type is as follows,
initialize the class when mock. When the attribute is not configured or the attribute value mock.
6. The apparatus of claim 4, wherein: in the second function method definition module, the enhancement function of the tangent plane is added in the method body of the second function method to realize the return value function of the simulation request interface.
7. A computer device, characterized by: the computer device comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor realizes the design method of the Mocker joint debugging tool according to any one of claims 1 to 3 when executing the computer program.
CN201911276047.XA 2019-12-12 2019-12-12 Design method and device of Mocker joint debugging tool and computer equipment Pending CN111045650A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911276047.XA CN111045650A (en) 2019-12-12 2019-12-12 Design method and device of Mocker joint debugging tool and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911276047.XA CN111045650A (en) 2019-12-12 2019-12-12 Design method and device of Mocker joint debugging tool and computer equipment

Publications (1)

Publication Number Publication Date
CN111045650A true CN111045650A (en) 2020-04-21

Family

ID=70236745

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911276047.XA Pending CN111045650A (en) 2019-12-12 2019-12-12 Design method and device of Mocker joint debugging tool and computer equipment

Country Status (1)

Country Link
CN (1) CN111045650A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446063A (en) * 2018-09-18 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, device, computer equipment and storage medium
CN110147326A (en) * 2019-05-23 2019-08-20 四川新网银行股份有限公司 Micro services automated testing method based on Redis database
CN110502224A (en) * 2019-08-22 2019-11-26 深圳前海环融联易信息科技服务有限公司 Interface analogy method, device and computer equipment based on HTTP request

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446063A (en) * 2018-09-18 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, device, computer equipment and storage medium
CN110147326A (en) * 2019-05-23 2019-08-20 四川新网银行股份有限公司 Micro services automated testing method based on Redis database
CN110502224A (en) * 2019-08-22 2019-11-26 深圳前海环融联易信息科技服务有限公司 Interface analogy method, device and computer equipment based on HTTP request

Similar Documents

Publication Publication Date Title
CN109976761B (en) Software development kit generation method and device and terminal equipment
CN103049375B (en) A kind of camera on-line debugging method
CN108388622B (en) API interface dynamic generation method and device, computer equipment and storage medium
WO2019169723A1 (en) Test case selection method, device and equipment, and computer-readable storage medium
CN110377462B (en) Interface testing method and device and terminal equipment
CN114580344B (en) Test excitation generation method, verification system and related equipment
CN103988211B (en) For increasing the method and system of computer security
US8838430B1 (en) Detection of memory access violation in simulations
WO2019019702A1 (en) Algorithm generation method and device, terminal device and storage medium
CN109471851A (en) Data processing method, device, server and storage medium
CN111538659B (en) Interface testing method, system, electronic equipment and storage medium of business scene
CN110554998A (en) hook method, device, terminal and storage medium for replacing function internal instruction
CN111797020A (en) Mock data method and device based on dynamic bytecode
CN109388435A (en) Realize app while the repeatedly method and apparatus of opening operation
CN111385661B (en) Method, device, terminal and storage medium for voice control of full screen playing
CN112363935A (en) Data joint debugging method and device, electronic equipment and storage medium
US7664776B1 (en) Methods and apparatus for dynamic form definition
US9003364B2 (en) Overriding system attributes and function returns in a software subsystem
CN111045650A (en) Design method and device of Mocker joint debugging tool and computer equipment
CN114995790A (en) Component development method and device, computer readable medium and electronic equipment
CN114003421B (en) Virtual machine timeout mechanism testing method, system, terminal and storage medium
CN106294143B (en) Debugging method and device for chip register
CN112764729B (en) Application software development method, device, computer equipment and readable storage medium
CN115599401A (en) Publishing method, device, equipment and medium of user-defined model
CN115576711A (en) Method and system for simulating returned data and computing equipment

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