当前位置:网站首页>File upload and download performance test based on the locust framework
File upload and download performance test based on the locust framework
2022-07-02 08:24:00 【Testfan_ zhou】
Make a little progress every day , Pay attention to us , Share test technology articles every day
This article is from 【 Code classmate software test 】
Code student official account : Automated software testing
Tiktok : Small code brother talks about software testing
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 .
Free collection Code classmate software test Course notes + More learning materials + Full video + The latest interview questions , You can forward articles + Direct messages 「 Code classmate 666」 Get information
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
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 .
I share a benefit with you ! Code scanning reply 【csdn Code group 】 Join the software testing self-study exchange group , Free technical lectures + Receive learning materials + Watch video lessons for free
author : Code classmate software test
The copyright of this article belongs to the author , For any reprint, please contact the author for authorization and indicate the source .
边栏推荐
- Global and Chinese market of snow sweepers 2022-2028: Research Report on technology, participants, trends, market size and share
- 使用Matplotlib绘制图表初步
- Carla-UE4Editor导入RoadRunner地图文件(保姆级教程)
- 关于原型图的深入理解
- Several methods of image enhancement and matlab code
- 力扣每日一题刷题总结:二叉树篇(持续更新)
- How to uninstall SQL Server cleanly
- Carsim-实时仿真的动画同步问题
- Short video with goods source code, double-click to zoom in when watching the video
- Global and Chinese markets for conventional rubber track 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
On the back door of deep learning model
Installation and use of simple packaging tools
简易打包工具的安装与使用
C语言实现XML生成解析库(XML扩展)
How to wrap qstring strings
Real world anti sample attack against semantic segmentation
Simple implementation scheme of transcoding and streaming (I)
Use C language to receive JSON strings
Several methods of image enhancement and matlab code
Don't know mock test yet? An article to familiarize you with mock
随机推荐
Introduction to parameters of CarSim pavement 3D shape file
双向链表的实现(双向链表与单向链表的简单区别联系和实现)
Sparse matrix storage
cve_ 2019_ 0708_ bluekeep_ Rce vulnerability recurrence
In depth understanding of prototype drawings
Principes fondamentaux de la théorie musicale (brève introduction)
STL quick reference manual
OpenCV 6.4 中值滤波器的使用
Animation synchronization of CarSim real-time simulation
Multi site high availability deployment
Library function of C language
St-link connection error invalid ROM table of STM32 difficult and miscellaneous diseases
One of the reasons for WCF update service reference error
Carsim-实时仿真的动画同步问题
On the back door of deep learning model
最长等比子序列
Use of opencv3 6.2 low pass filter
11月24号,我们为“满月”庆祝
Global and Chinese market of medicine cabinet 2022-2028: Research Report on technology, participants, trends, market size and share
顺序表基本功能函数的实现