当前位置:网站首页>"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 .
边栏推荐
- ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
- After upgrading v2.1.0, the synchronization failed
- JVM Foundation
- [C language] program compilation (preprocessing)
- Introduction to ORM framework - what is ORM framework?
- Inventory of well-known source code mall systems at home and abroad
- "No such plugin: cloudbees folder" solution appears when Jenkins selects the recommended plug-in for the first time
- Server performance monitoring
- Experienced the troubleshooting and solution process of an online CPU100% and the application of oom
- [leetcode] 3. Longest substring without repeated characters - go language problem solution
猜你喜欢

After working for two months in the summer vacation, I understood three routing schemes of keepalived high availability

Simulate the implementation of strstr

Nacos service discovery data model

Inventory of well-known source code mall systems at home and abroad

R language one page and many pictures
It's still a synchronization problem

Google launched another "man grabbing war" for core making, and Intel's 17 year veteran joined!

Case analysis of building exhibition service management system with low code development platform

Solution to the occupation of project startup port

Genesis, the world's first "consumption investment" public chain, was invited to participate in consensus 2022
随机推荐
[circular array] JS method collection of circular array
Several application scenarios of NAT
StrError and PERROR
Redis unauthorized access vulnerability recurrence (www.hetianlab.com)
Origin and development of philosophy Hegel external historical form
Android memory optimized disk cache
The importance of system to Philosophy Hegel
R language one page and many pictures
Can PostgreSQL CDC only connect to the main database? Connection from the library reports an error logical decoden
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
Simulate the implementation of strstr
Ogg data extraction delay is large
Unable to display spline in UE4 (unreal engine4) terrain editing tool
CSRF attack principle scenario
JS utils tool function that makes you get twice the result with half the effort
Detailed explanation of manually writing servlet in idea
Arthas case: dynamic update application logger level
Solution to the occupation of project startup port
Genesis, the world's first "consumption investment" public chain, was invited to participate in consensus 2022
Use SAP ui5 application to consume create and delete operations of OData in business application studio