LoadRunner Upload file solution (large file)

Source: Internet
Author: User

LoadRunner Uploading a file solution (large file) Recently, do a massive storage-related project Test, you need to simulate a lot of uploading and downloading of files via LR, the request is rest or soap, and also the simulation of a variety of files of different sizes. Typically, a simple post protocol is used: method One:
Web_submit_data ("Importstudent.do", "action=https://testserver/console/importstudent.do", "Method=POST", "EncType =multipart/form-data "," reccontenttype=text/html "," referer=https://testserver/console/displaystudentlist.do "," Snapshot=t12.inf "," Mode=http ", ItemData," Name=uploadfile "," Value=d://excel//data161955.zip "," File=yes ", ENDITEM, last);
After the upload of the file MD5 value comparison, found inconsistencies, after careful review, found that the uploaded file content was LoadRunner added a few lines of additional values, Content-type, helpless, rewrite the way to read the file, I through the following program to achieve 1 to 10M text file upload, If you upload a binary file, the body's wording changes: Method Two:
Vuser_init () {char filename[] = "D:/script/createobj_10m/tools.zip"; int len = 0;int readlen=0;int tmplen=1;int runLen =10 4857;int CLen = 0;if ((File_stream = fopen (FileName, "RB")) = = NULL) {lr_message ("Open File failed!\n"); return-1;} Fseek (File_stream, 0, 2); len = Ftell (File_stream); lr_message ("File length is:%d bytes", len); readbuf = (char *) malloc (l en+1); memset (readbuf, 0, len+1); if (Runlen > len) {runlen = Len;} Fseek (file_stream, 0, 0); while (feof (file_stream) = = 0) {Tmplen = fread (Readbuf + Readlen, 1,runlen, file_stream); Readlen + = Tmplen;clen = Readlen + runlen;if (CLen > Len) {runlen = Clen-len;} if (tmplen==0) {break;}}

LoadRunner Upload file solution (large file)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.