CN108563426A - A kind of iOS requests simulation strategy - Google Patents
A kind of iOS requests simulation strategy Download PDFInfo
- Publication number
- CN108563426A CN108563426A CN201810181697.5A CN201810181697A CN108563426A CN 108563426 A CN108563426 A CN 108563426A CN 201810181697 A CN201810181697 A CN 201810181697A CN 108563426 A CN108563426 A CN 108563426A
- Authority
- CN
- China
- Prior art keywords
- data
- request
- simulation
- local
- plist
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present invention relates to a kind of iOS to ask simulation strategy, includes the following steps:The configuration data for obtaining simulation strategy, for initializing simulated environment and initial parameter;The state for judging current debugging mode opens if it is debugging mode, then receives the simulation triggering command sent;The simulation triggering command sent is parsed, simulation strategy should currently be opened or be closed to judgement, if it is simulation strategy is opened, then execute unlatching request simulated operation, generate following information for users to use:Generate virtual request instruction, include request URL address in instruction, generates the returned data of respond request instruction, the content and format of returned data are by local JSON file constraints, offer, data-base content is generated, data-base content is by local JSON file constraints, offer.The present invention, algorithm are unified, can generate a variety of false datas, simulate different situations, make mobile terminal without waiting for back end interface data, improve App and develop debugging speed, exploitation and UI is facilitated to debug, efficient, safety is good.
Description
Technical field
The present invention relates to App exploitation debugging techniques field, specifically a kind of iOS asks simulation strategy.
Background technology
In existing App exploitation, project team encounter the duration it is tighter when, can often move in project development
End waits for the situation of back end interface data, not only delays project process, and people is more allowed to have kind of a helpless despair.
So in App exploitations, in order to ensure job schedule, improves App and develop debugging speed, programmer has to voluntarily
A little false datas are done, is simulated by asking, fictionalizes imaginary back end interface data, to facilitate exploitation and UI to debug.
However the data method difference that rehearses, efficiency and safety are all variant, sometimes careless slightly, also will produce prodigious
bug。
Such as:It is most easily false data way that doomed dead evidence is write in source code, when project is caught up with very much, sees that UI is imitated to be the fastest
Fruit generally can all take this false data mode.It is careless slightly to be easy for but although writing dead false data in source code conveniently
It directly reaches the standard grade upper environment, evolves into one and be possible to seriously be also possible to very much very light bug, it is for safety, usually all
Writing dead false data all should wrap in conditional compilation is macro.Write dead false data in source code, it is maximum the disadvantage is that:Data are distorted
Correct circulation.Correct data producing method, it should be one network request of hair, then the data of request back are changed into
Model fills data finally by model to each UI components.And dead false data is write in source code, directly upset data
Correct circulation, this can so that the logic entirely developed is reverse, exploitation is not only made to be easier out bug, and logic flow
Switch the development efficiency brought and exploitation impression is all very poor.
Again for example:False data is done using the network request stub of unit testing, it is whole to press following normal flow exploitation first
A function --- step 1, create model data objects Model;Step 2, view management base class ViewController is created;Step
Rapid 3, create the UI elements such as View;Step 4, the initiation of network request is completed in view management base class ViewController,
And complete the conversion from network data to Model;Step 5, UI is filled using Model.Entire functional development is according to there is true net
Network request carries out, but in fact there is no network requests, because not putting up from the background, does a little mantissas as follows thus
According to --- according to the interface and data format definition provided from the background, the JSON files for creating a local JSON file and being created
It is added in project directory;Then network request all in this ViewController of stub in ViewController
(Stub can be understood as test pile, it can be realized when specific method is called, return to a specified analogue value.If
Your test case needs an association object to provide some data, can replace data source using stub, test
Return can be specified per subuniform analogue data when setting);Thus, which network request will be by stub, the data of return will
It is the data in specified JSON files, does not thus have any difference with true network request.Moreover, if using
OHHTTPStubs(The slow network of the tool of one test and exploitation, network data and simulation that forgery can be used tests you
Application program, to detect behavior of your application program in bad network environment, and use the network data forged
Write unit testing)The various network request shapes such as failure, network request time-out and throttle can be asked with analog network
State, to more fully debug UI and entire function.
Invention content
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of iOS to ask simulation strategy, algorithm
It is unified, a variety of false datas can be generated, different situations are simulated, makes mobile terminal without waiting for back end interface data, improves App exploitations
Debugging speed facilitates exploitation and UI to debug, efficient, safety is good.
To achieve the above objectives, the technical solution adopted by the present invention is that:
A kind of iOS requests simulation strategy, which is characterized in that include the following steps:
The configuration data for obtaining simulation strategy, for initializing simulated environment and initial parameter;
The simulation strategy is used to generate virtual request instruction or generates the returned data or void of virtual respond request instruction
Quasi- data-base content;
Judge the state of current debugging mode,
It is closed if it is debugging mode, then ignores the simulation triggering command sent,
It is opened if it is debugging mode, then receives the simulation triggering command sent;
The simulation triggering command sent is parsed, simulation strategy should currently be opened or be closed to judgement,
If it is simulation strategy is closed, then turn-off request simulated operation is executed, returns to simulation ending message,
If it is simulation strategy is opened, then unlatching request simulated operation is executed, generates following information for users to use:
Virtual request instruction is generated, includes request URL address in instruction,
Generate the returned data of respond request instruction, the content of returned data and format by local JSON file constraints, provide,
Data-base content is generated, data-base content is by local JSON file constraints, offer.
Based on the above technical solution, according to request URL address, local attribute list file plist is called, it is described
Attribute list file plist is the file of the object after storing serialization, in local attribute list file plist with
The form of key-value key-value pairs preserves data;
Configuration simulation request local plist routing tables;
For different requests, corresponding returned data is configured in local path.
Based on the above technical solution, after App starts, if in App request simulation option open, then execute with
Lower operation, otherwise App do not read data:
Local attribute list file plist is read, request analogue data is generated and asks map;
Initiate network request;
Bottom interception request;
Obtain request URL address;
According to request URL address of cache to local plist routing tables, data are obtained.
Based on the above technical solution, if local plist routing tables can not be mapped to, it tries initiate normal net
Network is asked,
If local plist routing tables can be mapped to, the acquisition data refer in the local attribute list file plist of acquisition
Data.
Based on the above technical solution, after obtaining the data in local attribute list file plist, first judge data
Whether effectively,
It attempts to initiate proper network request if invalid,
The data of acquisition are returned if effectively.
IOS of the present invention asks simulation strategy, and algorithm is unified, can generate a variety of false datas, simulates different situations,
Make mobile terminal without waiting for back end interface data, improve App and develop debugging speed, exploitation and UI is facilitated to debug, efficient, safety
Property is good.
Description of the drawings
The present invention has following attached drawing:
The flow chart of Fig. 1 present invention.
Specific implementation mode
Below in conjunction with attached drawing, invention is further described in detail.
As shown in Figure 1, iOS of the present invention asks simulation strategy, include the following steps:
The configuration data for obtaining simulation strategy, for initializing simulated environment and initial parameter;
The simulation strategy is used to generate virtual request instruction or generates the returned data or void of virtual respond request instruction
Quasi- data-base content;
Judge the state of current debugging mode,
It is closed if it is debugging mode, then ignores the simulation triggering command sent,
It is opened if it is debugging mode, then receives the simulation triggering command sent;
The simulation triggering command sent is parsed, simulation strategy should currently be opened or be closed to judgement,
If it is simulation strategy is closed, then turn-off request simulated operation is executed, returns to simulation ending message,
If it is simulation strategy is opened, then unlatching request simulated operation is executed, generates following information for users to use:
Virtual request instruction is generated, includes request URL address in instruction,
Generate the returned data of respond request instruction, the content of returned data and format by local JSON file constraints, provide,
Data-base content is generated, data-base content is by local JSON file constraints, offer.
Based on the above technical solution, according to request URL address, local attribute list file plist is called, it is described
Attribute list file plist is the file of the object after storing serialization, in local attribute list file plist with
The form of key-value key-value pairs preserves data;
Configuration simulation request local plist routing tables;
For different requests, corresponding returned data is configured in local path.
Based on the above technical solution, after App starts, if in App request simulation option open, then execute with
Lower operation, otherwise App do not read data:
Local attribute list file plist is read, request analogue data is generated and asks map;
Initiate network request;
Bottom interception request;
Obtain request URL address;
According to request URL address of cache to local plist routing tables, data are obtained.
Based on the above technical solution, if local plist routing tables can not be mapped to, it tries initiate normal net
Network is asked,
If local plist routing tables can be mapped to, the acquisition data refer in the local attribute list file plist of acquisition
Data.
Based on the above technical solution, after obtaining the data in local attribute list file plist, first judge data
Whether effectively,
It attempts to initiate proper network request if invalid,
The data of acquisition are returned if effectively.
The content not being described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.
Claims (5)
1. a kind of iOS asks simulation strategy, which is characterized in that include the following steps:
The configuration data for obtaining simulation strategy, for initializing simulated environment and initial parameter;
The simulation strategy is used to generate virtual request instruction or generates the returned data or void of virtual respond request instruction
Quasi- data-base content;
Judge the state of current debugging mode,
It is closed if it is debugging mode, then ignores the simulation triggering command sent,
It is opened if it is debugging mode, then receives the simulation triggering command sent;
The simulation triggering command sent is parsed, simulation strategy should currently be opened or be closed to judgement,
If it is simulation strategy is closed, then turn-off request simulated operation is executed, returns to simulation ending message,
If it is simulation strategy is opened, then unlatching request simulated operation is executed, generates following information for users to use:
Virtual request instruction is generated, includes request URL address in instruction,
Generate the returned data of respond request instruction, the content of returned data and format by local JSON file constraints, provide,
Data-base content is generated, data-base content is by local JSON file constraints, offer.
2. iOS as described in claim 1 asks simulation strategy, it is characterised in that:According to request URL address, local belong to is called
Property listing file plist, the attribute list file plist be for store serialization after object file, local attribute
Data are preserved in listing file plist in the form of key-value key-value pairs;
Configuration simulation request local plist routing tables;
For different requests, corresponding returned data is configured in local path.
3. iOS as claimed in claim 2 asks simulation strategy, it is characterised in that:After App starts, as asked modulus in App
Quasi- option is opened, then executes following operation, otherwise App does not read data:
Local attribute list file plist is read, request analogue data is generated and asks map;
Initiate network request;
Bottom interception request;
Obtain request URL address;
According to request URL address of cache to local plist routing tables, data are obtained.
4. iOS as claimed in claim 3 asks simulation strategy, it is characterised in that:If the local paths plist can not be mapped to
Table, it tries proper network request is initiated,
If local plist routing tables can be mapped to, the acquisition data refer in the local attribute list file plist of acquisition
Data.
5. iOS as claimed in claim 4 asks simulation strategy, it is characterised in that:It obtains in local attribute list file plist
Data after, first judge whether data effective,
It attempts to initiate proper network request if invalid,
The data of acquisition are returned if effectively.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810181697.5A CN108563426B (en) | 2018-03-06 | 2018-03-06 | iOS request simulation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810181697.5A CN108563426B (en) | 2018-03-06 | 2018-03-06 | iOS request simulation method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108563426A true CN108563426A (en) | 2018-09-21 |
CN108563426B CN108563426B (en) | 2021-06-11 |
Family
ID=63532347
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810181697.5A Active CN108563426B (en) | 2018-03-06 | 2018-03-06 | iOS request simulation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108563426B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109814868A (en) * | 2018-12-13 | 2019-05-28 | 深圳壹账通智能科技有限公司 | Network transmission analogy method, device, computer equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130312102A1 (en) * | 2012-05-18 | 2013-11-21 | International Business Machines Corporation | Verifying application security vulnerabilities |
CN103905258A (en) * | 2012-12-24 | 2014-07-02 | 百度国际科技(深圳)有限公司 | Method and apparatus for testing data uploading function of client |
CN104199725A (en) * | 2014-09-27 | 2014-12-10 | 上海瀚之友信息技术服务有限公司 | Service interface data simulation method and system |
CN106254423A (en) * | 2016-07-20 | 2016-12-21 | 普元信息技术股份有限公司 | The method realizing Restful service release quickly based on micro services framework |
CN107659455A (en) * | 2017-10-16 | 2018-02-02 | 武汉斗鱼网络科技有限公司 | A kind of method, storage medium, equipment and the system of iOS ends Mock data |
-
2018
- 2018-03-06 CN CN201810181697.5A patent/CN108563426B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130312102A1 (en) * | 2012-05-18 | 2013-11-21 | International Business Machines Corporation | Verifying application security vulnerabilities |
CN103905258A (en) * | 2012-12-24 | 2014-07-02 | 百度国际科技(深圳)有限公司 | Method and apparatus for testing data uploading function of client |
CN104199725A (en) * | 2014-09-27 | 2014-12-10 | 上海瀚之友信息技术服务有限公司 | Service interface data simulation method and system |
CN106254423A (en) * | 2016-07-20 | 2016-12-21 | 普元信息技术股份有限公司 | The method realizing Restful service release quickly based on micro services framework |
CN107659455A (en) * | 2017-10-16 | 2018-02-02 | 武汉斗鱼网络科技有限公司 | A kind of method, storage medium, equipment and the system of iOS ends Mock data |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109814868A (en) * | 2018-12-13 | 2019-05-28 | 深圳壹账通智能科技有限公司 | Network transmission analogy method, device, computer equipment and storage medium |
CN109814868B (en) * | 2018-12-13 | 2022-07-08 | 深圳壹账通智能科技有限公司 | Network transmission simulation method and device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN108563426B (en) | 2021-06-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105677446B (en) | The visual modeling method of Distributed Simulation Platform | |
CN104714788B (en) | A kind of method and device that software installation packet automatically generates | |
CN103019726B (en) | The management method of software system business rule and device | |
CN102141960B (en) | Automatic test method based on Android | |
CN104408222B (en) | Reconfiguration method of real-time distributed simulation platform | |
US7380235B1 (en) | Application program interface call replay tool | |
CN103634154B (en) | The analog systems of network state and analogy method thereof | |
CN104750603A (en) | Multi-core DSP (Digital Signal Processor) software emulator and physical layer software testing method thereof | |
CN107659455A (en) | A kind of method, storage medium, equipment and the system of iOS ends Mock data | |
Elphinstone et al. | Towards a Practical, Verified Kernel. | |
JP2001273165A5 (en) | ||
CN109495293B (en) | Method, system, equipment and storage medium for testing control surface of switch | |
CN106484613A (en) | A kind of interface automated test frame based on fitnese | |
JP4140917B2 (en) | Verification work support system and method | |
CN111123737A (en) | Digital hardware virtual simulation system | |
CN106227550A (en) | Generation method, system and the computer of a kind of Internationalized Graphical User Interface | |
CN108563426A (en) | A kind of iOS requests simulation strategy | |
US20190121932A1 (en) | Covergroup network analysis | |
CN101303646B (en) | Modeling method based on electric communication field capable of performing meta language | |
Zachariah et al. | A novel algorithm to extract two-node bridges | |
CN103309676A (en) | Web service encapsulation method and system for ocean numerical modeling regional ocean modeling system (ROMS) | |
CN102231132A (en) | Method for generating simulation test example of AADL (Architecture Analysis and Design Language) software component model based on SystemC | |
CN106407122A (en) | Testing method used for software automatic generation system | |
CN110162299A (en) | Web program and its Quick Development Framework, development approach and relevant device | |
Netkow et al. | Xest: an automated framework for regression testing of embedded software |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |