当前位置:网站首页>File upload and download performance test based on the locust framework
File upload and download performance test based on the locust framework
2022-07-26 13:10:00 【Code classmate software test】
In many business scenarios , You need to test for file upload and download . When you want to test a business , We must first understand the essence of this business . Let's first look at the essence of uploading and downloading .
File upload process
1、 Select the local file on the browser , Click upload
2、 The browser reads local files , Put the contents of the file into HTTP Requested body in , And then in HTTP Request header , Mark request data type :
Content-type:multipart/form-data,
With post Submit the form to the server .
3、 After the server receives the requested data , Create a new file on the server , take body Write the data in to a file , One time file upload processing is completed .
File download process
1、 Click the download button on the browser , Initiate a HTTP get Type request
2、 After the server receives the request , Read out the contents of the corresponding file , Write to HTTP Response , And mark in the response header Content- Disposition: attachment; filename=xxx
3、 When the browser receives the response , According to the mark, it is recognized that this is a download request , According to the filename Create a file with the same name locally , Then write the data in the response to the file , One download file processing is completed .
It can be seen from the description of uploading and downloading , The so-called file upload and download , In fact, they all attach the contents of the file to HTTP Transmission in the request .
Use Locust Upload and download test files
First, let's take a look at the interface documents uploaded and downloaded by a project

File upload script writing 

Execute the script , Request in your local browser http://localhost:8089/, Enter concurrent users , and ip port , Click to start execution

Can be in Pycharm Print the return result of each upload on the console

File download script writing

Execute the script , stay locust UI Start testing on the interface , Can be in Pycharm See the return value of the interface
Insert picture description here
matters needing attention
During file downloading , The server is only responsible for returning the file content to the client , The creation and saving of files should be done by the client . If you do the interface test of the server , There is no need to create files locally . The contents of the file are placed in the response body Medium , Just judge the response body The size of is the same as the file size , That means the download is successful .
边栏推荐
- 虚拟偶像代言产品出问题谁负责?且听律师分析
- New function | intelligent open search online customized word weight model
- [typescript] typescript common types (Part 1)
- B+树(5)myISAM简介 --mysql从入门到精通(十七)
- 12-GuliMall 后台管理中商品系统的品牌管理
- 【5GC】什么是5G切片?5G切片如何工作?
- 概率论与数理统计
- mqtt send receive
- Detailed explanation of redis's single login
- Who is responsible for the problems of virtual idol endorsement products? And listen to the lawyer's analysis
猜你喜欢

Qualcomm once again "bet" on Zhongke Chuangda to challenge the full stack solution of intelligent driving software and hardware

Kuzaobao: summary of Web3 encryption industry news on July 25

A college archives management system based on asp.net

【TypeScript】TypeScript常用类型(下篇)

最好的工程师,就是这样被你“逼”走的!

Kubernetes Flannel:HOST-GW模式

Visual stdio(VS)中的(int argc、char** argv)命令行参数

The programmed navigation route jumps to the current route (the parameters remain unchanged), and if it is executed multiple times, it will throw a navigationduplicated warning error?

基于ASP.NET的某高校学院档案管理系统

如何面对科技性失业?
随机推荐
基于BERT的情感分析模型
解决方案丨5G技术助力搭建智慧园区
【花雕动手做】有趣好玩的音乐可视化系列小项目(12)---米管快速节奏灯
The strongest tool class of entity mapping: mapstruct Zhenxiang
【花雕动手做】有趣好玩的音乐可视化系列小项目(13)---有机棒立柱灯
Bitwise and how to write SQL
[5g] what are Cu and Du in 5g?
The programmed navigation route jumps to the current route (the parameters remain unchanged), and if it is executed multiple times, it will throw a navigationduplicated warning error?
mqtt send receive
Version of NDK matched the requested version 21.0.6113669. versions available locally: 2
Px2rem loader converts PX into REM and adapts to mobile vant UI and other frameworks
Food safety | can you eat any fruit?
Shell variables and references
V01 - XX, record a good life from the log
【TypeScript】TypeScript常用类型(上篇)
概要设计说明书
Example of establishing socket communication with Siemens PLC based on C # open TCP communication
Mysql数据目录(3)---表数据结构myISAM(二十六)
Azure synapse analytics Performance Optimization Guide (2) -- optimize performance using materialized views (Part 1)
The best engineer was "forced" away by you like this!