CN112817570A - Method and system for simulating data through MOCK - Google Patents

Method and system for simulating data through MOCK Download PDF

Info

Publication number
CN112817570A
CN112817570A CN202110176139.1A CN202110176139A CN112817570A CN 112817570 A CN112817570 A CN 112817570A CN 202110176139 A CN202110176139 A CN 202110176139A CN 112817570 A CN112817570 A CN 112817570A
Authority
CN
China
Prior art keywords
mock
server
data
file
client
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
CN202110176139.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.)
Shanghai Xingrong Automotive Technology Co ltd
Original Assignee
Shanghai Xingrong Automotive 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 Shanghai Xingrong Automotive Technology Co ltd filed Critical Shanghai Xingrong Automotive Technology Co ltd
Priority to CN202110176139.1A priority Critical patent/CN112817570A/en
Publication of CN112817570A publication Critical patent/CN112817570A/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method and system for simulating data by MOCK, the invention simulates data of a server through a MOCK tool in the development process of a software system, and can develop a client according to the simulated data, so that the client and the server of the software system can be developed in parallel, the development efficiency is improved, in addition, in the invention, a MOCK file is not required to be loaded when a MOCK server program is started, a user can modify data in the MOCK file at any time according to the simulation data required by the user, the real-time requirement in the software development process is met, meanwhile, the invention only needs one MOCK server program, a plurality of MOCK client programs can obtain required simulation data from different MOCK files through the same MOCK server program, conversely, the simulation data in the same MOCK file can also be used by a plurality of MOCK client programs through the same MOCK server program, the mode improves the working efficiency and reduces the repeated labor.

Description

Method and system for simulating data through MOCK
Technical Field
The invention belongs to the technical field of software system development, and particularly relates to a method and a system for simulating data through a MOCK.
Background
Most software systems adopt a C/S (Client/Server) structure, namely a Client and Server structure. As shown in fig. 2, the current working mode of the client and the server is that the client makes a request and the server makes a judgment and gives a response, so for the development of the server and the client, the server is usually developed first, the development of the server is completed, and then the development of the client is performed, which is equivalent to a serial mode, and the development efficiency is low.
Disclosure of Invention
Based on this, a method and a system for simulating data through a MOCK are provided to solve the above technical problems.
In order to solve the technical problems, the invention adopts the following technical scheme:
in one aspect, a method for simulating data through a MOCK is provided, including:
a software client sends a data request to a MOCK client program;
the MOCK client program adds corresponding parameters into an interface address of the MOCK server program according to the data request, and sends a request to the MOCK server program according to the address added with the parameters, the MOCK server program is arranged on a server, and a plurality of MOCK files capable of being modified in real time are stored on the server;
the MOCK server program determines a corresponding MOCK file on the server according to the parameters, obtains simulation data from the determined MOCK file and returns the simulation data to the corresponding MOCK client program;
and the MOCK client program returns the received simulation data to the software client.
In another aspect, a system for simulating data via a MOCK is provided, including a memory module including instructions loaded and executed by a processor, the instructions, when executed, causing the processor to perform one of the above-described methods for simulating data via a MOCK.
In the development process of the software system, the invention simulates the data of the server through the MOCK tool, and the development of the client can be carried out according to the simulated data, so that the client and the server of the software system can be developed in parallel, compared with the prior serial mode, the development efficiency is improved, in addition, in the invention, the parameters are added into the address when the MOCK client program requests the MOCK server program, after the MOCK server program is started, the corresponding MOCK file can be determined according to the parameters, the simulated data can be obtained from the determined MOCK file, the MOCK file does not need to be loaded during the starting, a user can modify the data in the MOCK file at any time according to the simulation data required by the user, the real-time requirement in the software development process is met, meanwhile, only one MOCK server program is needed by the invention, a plurality of MOCK client programs can add different parameters according to the requirement, therefore, the needed simulation data can be obtained from different MOCK files through the same MOCK server program, and conversely, the simulation data in the same MOCK file can be used by a plurality of MOCK client programs through the same MOCK server program, so that the working efficiency is improved, and the repeated labor is reduced.
Drawings
The invention is described in detail below with reference to the following figures and detailed description:
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a schematic diagram of the working modes of the client and the server;
fig. 3 is a schematic diagram of the present invention.
Detailed Description
As shown in fig. 1 and fig. 3, an embodiment of the present specification provides a method for simulating data by a puck, including:
s101, the software client sends a data request to the MOCK client program. The software client is a client of the developed software system, and the MOCK client program can be embedded in the software client and exists as a dependency library.
S102, adding corresponding parameters into an interface address of a MOCK server program by the MOCK client program according to the data request, and sending a request to the MOCK server program according to the address added with the parameters. The MOCK server program is arranged on a server, a plurality of MOCK files capable of being modified in real time are stored on the server, and analog data aiming at an exclusive request are stored in one MOCK file.
In this embodiment, the parameters include a first parameter and a second parameter, and the MOCK server program may match a corresponding folder on the server according to the first parameter, and determine a corresponding MOCK file from the folder according to the second parameter.
Specifically, the name of the folder may correspond to a source person of the MOCK file, a plurality of MOCK files from the same source person are stored in the same folder, and the MOCK server program may determine the source person according to the first parameter and determine the corresponding folder according to the source person; the MOCK server program can determine the file name of the MOCK file according to the second parameter, and determine the corresponding MOCK file from the determined folder according to the file name.
S103, the MOCK server program determines a corresponding MOCK file on the server according to the parameters in the address, obtains simulation data from the determined MOCK file, and returns the simulation data to the corresponding MOCK client program.
And S104, returning the received simulation data to the software client by the MOCK client program.
In the prior art, a MOCK file is usually stored in a MOCK server program, and when the MOCK server program is started, the MOCK file is loaded into a memory at the same time and cannot be modified any more.
In the development process of the software system, the invention simulates the data of the server through the MOCK tool, and the development of the client can be carried out according to the simulated data, so that the client and the server of the software system can be developed in parallel, compared with the prior serial mode, the development efficiency is improved, in addition, in the invention, the parameters are added into the address when the MOCK client program requests the MOCK server program, after the MOCK server program is started, the corresponding MOCK file can be determined according to the parameters, the simulated data can be obtained from the determined MOCK file, the MOCK file does not need to be loaded during the starting, a user can modify the data in the MOCK file at any time according to the simulation data required by the user, the real-time requirement in the software development process is met, meanwhile, only one MOCK server program is needed by the invention, a plurality of MOCK client programs can add different parameters according to the requirement, therefore, the needed simulation data can be obtained from different MOCK files through the same MOCK server program, and conversely, the simulation data in the same MOCK file can be used by a plurality of MOCK client programs through the same MOCK server program, so that the working efficiency is improved, and the repeated labor is reduced.
Based on the same inventive concept, the present specification also provides a system for simulating data through a MOCK, which includes a storage module including instructions loaded and executed by a processor, wherein the instructions, when executed, cause the processor to execute the steps according to the various exemplary embodiments of the present invention described in the above method part of simulating data through a MOCK.
The memory module may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM) and/or a cache memory unit, and may further include a read only memory unit (ROM).
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
However, those skilled in the art should realize that the above embodiments are illustrative only and not limiting to the present invention, and that changes and modifications to the above described embodiments are intended to fall within the scope of the appended claims, provided they fall within the true spirit of the present invention.

Claims (5)

1. A method for simulating data through a MOCK, comprising:
a software client sends a data request to a MOCK client program;
the MOCK client program adds corresponding parameters into an interface address of the MOCK server program according to the data request, and sends a request to the MOCK server program according to the address added with the parameters, the MOCK server program is arranged on a server, and a plurality of MOCK files capable of being modified in real time are stored on the server;
the MOCK server program determines a corresponding MOCK file on the server according to the parameters, obtains simulation data from the determined MOCK file and returns the simulation data to the corresponding MOCK client program;
and the MOCK client program returns the received simulation data to the software client.
2. The method as claimed in claim 1, wherein the parameters include a first parameter and a second parameter, the MOCK server program matches a corresponding folder on the server according to the first parameter, and determines a corresponding MOCK file from the folder according to the second parameter.
3. The method as claimed in claim 2, wherein the MOCK server program determines the source person according to the first parameter and determines the corresponding folder according to the source person.
4. The method for simulating data through the MOCK according to the claim 2 or the claim 3, characterized in that the MOCK server program determines the file name of the MOCK file according to the second parameter, and determines the corresponding MOCK file from the determined folder according to the file name.
5. A system for simulating data by a MOCK, comprising a memory module including instructions to be loaded and executed by a processor, the instructions when executed causing the processor to perform a method of simulating data by a MOCK according to any of claims 1-4.
CN202110176139.1A 2021-02-07 2021-02-07 Method and system for simulating data through MOCK Pending CN112817570A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110176139.1A CN112817570A (en) 2021-02-07 2021-02-07 Method and system for simulating data through MOCK

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110176139.1A CN112817570A (en) 2021-02-07 2021-02-07 Method and system for simulating data through MOCK

Publications (1)

Publication Number Publication Date
CN112817570A true CN112817570A (en) 2021-05-18

Family

ID=75864487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110176139.1A Pending CN112817570A (en) 2021-02-07 2021-02-07 Method and system for simulating data through MOCK

Country Status (1)

Country Link
CN (1) CN112817570A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114448857A (en) * 2022-01-29 2022-05-06 北京字节跳动网络技术有限公司 Method, device, storage medium and system for processing Mock service

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228444A (en) * 2016-12-14 2018-06-29 阿里巴巴集团控股有限公司 A kind of test method and device
CN110471649A (en) * 2019-07-11 2019-11-19 广州向导信息科技有限公司 A kind of development platform and method for writing WEB service end program
CN110806970A (en) * 2019-09-18 2020-02-18 北京你财富计算机科技有限公司 Client test method and device based on simulation server response and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228444A (en) * 2016-12-14 2018-06-29 阿里巴巴集团控股有限公司 A kind of test method and device
CN110471649A (en) * 2019-07-11 2019-11-19 广州向导信息科技有限公司 A kind of development platform and method for writing WEB service end program
CN110806970A (en) * 2019-09-18 2020-02-18 北京你财富计算机科技有限公司 Client test method and device based on simulation server response and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114448857A (en) * 2022-01-29 2022-05-06 北京字节跳动网络技术有限公司 Method, device, storage medium and system for processing Mock service

Similar Documents

Publication Publication Date Title
CA2420023A1 (en) Accessing data stored at an intermediary from a service
CN112306881B (en) Analog data generation method, device, equipment and storage medium
US20170343983A1 (en) System and method for generating machining control data of numerical control machine tool
CN106897107B (en) implementation system and method for web remote data calculation and simulation
CN108984202B (en) Electronic resource sharing method and device and storage medium
CN103473326A (en) Method and device providing searching advices
US20110231813A1 (en) Apparatus and method for on-demand optimization of applications
CN104994183A (en) Short network address determining method and device
CN113704110A (en) Automatic testing method and device for user interface
CN115454420A (en) Artificial intelligence algorithm model deployment system, method, equipment and storage medium
CN107357588B (en) Object code generation method and device
CN112817570A (en) Method and system for simulating data through MOCK
CN105681823A (en) Method and device for transcoding video file online
CN110162299A (en) Web program and its Quick Development Framework, development approach and relevant device
CN102984282B (en) Intelligent terminal obtains the method and apparatus of the media data of cloud storage file
CN103530091B (en) The implementation method of the calculating task of CPMD and device
CN110554963A (en) Application rollback method, device and storage medium
CN114995790A (en) Component development method and device, computer readable medium and electronic equipment
CN111949428B (en) Method, device, equipment and storage medium for improving service availability of small program
CN111400623B (en) Method and device for searching information
CN112688980B (en) Resource distribution method and device, and computer equipment
CN112486460A (en) Method, system, device and medium for automatically importing interface document
CN114116244A (en) Data processing method, device and system, electronic equipment and storage medium
CN113127019A (en) Verification method and related equipment
CN112015406A (en) Data processing method, page access method, device, terminal and server

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