当前位置:网站首页>"Introduction to interface testing" punch in to learn day09: Micro service interface: how to use mock to solve chaotic call relationships
"Introduction to interface testing" punch in to learn day09: Micro service interface: how to use mock to solve chaotic call relationships
2022-07-25 02:30:00 【Field test record】
For chaotic calling relationships , The train of thought is : My tested service is service A, Then I don't care about the service B Is it easy to use , As long as the service is guaranteed A Be able to complete the process , You can complete the interface test task . Follow this train of thought , Just use Mock Services disguised as services B And that's it , I don't have to care about service anymore B How many services are called .
How to choose Mock The service framework ?
First , You have to choose based on your own and your team's technology stack
secondly , You want me to write it Mock The service is easy to modify and maintain
If your team has a good technical foundation , Strong development ability , Then I suggest you use the corresponding language Mock frame , for example Java Linguistic Mockito frame (https://github.com/mockito/mockito) and Python Linguistic mock frame (mock · PyPI).
If your team's technical foundation is relatively weak , Then I recommend you take a look moco, This framework is under development Mock In service , Provides a way that does not require any programming language , You can restrict it by writing it Json Building services , And start the corresponding service through the command , This allows you to quickly develop and start running what you need Mock service .
Mock Service design experience
First , Simplicity is the first element . Regardless of the original service B What a complex business process , You're designing services B Of Mock The service , Just care about service B Can handle several types of parameter combinations , What parameters will be returned by the corresponding service . So you can catch Mock service B The core of design , Can also be completed quickly Mock service B Development of .
secondly , Processing speed is faster than perfect Mock Service is more important . One Mock The service should be able to return parameters correctly and quickly according to the original service , You don't need to waste a lot of time on Mock Service invocation , It's just a means to help you complete interface testing .
Last , Yours Mock The service should be able to start with light weight , And easy to destroy . You should always pay attention to ,Mock Service is just a supplementary service , therefore , No team wants to start a Mock The service needs to wait 5 minute , Or need 100M Of memory . It needs to start quickly 、 Easy to modify and easy to migrate . since Mock Service positioning is a lightweight auxiliary service , Then it should also be easy to destroy , So that when you finish the test , It can quickly and easily release the resources it occupies .
边栏推荐
- AWD thinking
- String class
- Server performance monitoring
- Digital business cloud: how to realize the application value of supplier SRM management system?
- Using ODBC to consume SAP ABAP CDs view in Excel
- Gerrit statistics script
- Completefuture parallel asynchronous return processing
- Seven text editors that programmers should know are necessary for programming
- Vs2019 configuring Qt5 development environment
- Experienced the troubleshooting and solution process of an online CPU100% and the application of oom
猜你喜欢

Why can't reading more books improve your writing?

Introduction to web security telent testing and defense

Industrial control safety PLC firmware reverse III

Use SAP ui5 application to consume create and delete operations of OData in business application studio

Ogg data extraction delay is large

After six years of precipitation, new consumption has found a digital transformation paradigm

Simulate the implementation of strstr
Failed to create data snapshot: lock file [/siyuan/data/assets/image- 2022070216332-jijwccs.png failed: open /siyuan/data/assets/image- 2022070216332-jijwccs.png: permission denied; unable to lock fil

Cookies and sessions
It's still a synchronization problem
随机推荐
Automatic backup of Linux server PostgreSQL database
"I gave up programming and wrote a 1.3 million word hard science fiction."
H5 common positioning function package
Deep understanding of string class
Digital commerce cloud fine chemical industry management platform integrated informatization solution
ByteDance confirmation will be self-developed chip: for internal use only; Musk: I have uploaded my brain to the cloud; Go language product head leaves | geek headline
Explanation of C language file operation function
Unable to display spline in UE4 (unreal engine4) terrain editing tool
Text reading end judgment
Summary and sorting of XSS (cross site script attack) related content
Large number processing -- use case
[system design] distributed key value database
Server performance monitoring
How to upload files to the server
Win10 configuring CUDA and cudnn
Pycharm writes SQLite statements without code prompts
Simulate the implementation of StrCmp function
ICO objects in classification
Arthas case: dynamic update application logger level
Standard transfer function