If you need to set up monitoring or load testing for web applications with file upload functionality, use EveryStep Scripting Tool to record the script.

The file upload recording is available for Chrome and mobile browsers only.

File Upload Limits

The EveryStep Scripting Tool supports the recording of a file upload to an external URL. You can record upload of up to 100 MB in total within an EveryStep script for load testing and up to 20 MB for monitoring scripts.

For example, you can record an upload of four files of 25 MB or one file of 100 MB for your load test. Or you can record the uploading of two files with a file size of 10 MB each or one 20 MB file for web performance monitoring.

How It Works

Dotcom-Monitor does not have locally available storage. To emulate the upload process of a file, the system needs to download the file to the script from a public URL before executing the upload step. Thus, first, you need to provide a test file that will be used in the upload process by Dotcom-Monitor. As a result, Dotcom-Monitor will download the file from the provided URL to the system cloud storage and use it in the upload process each time the script is executed. There are two approaches to providing a test file to Dotcom-Monitor.

Downloading the File from the External URL

To use a file from an external URL, put a test file up to 100 MB (up to 20 MB for monitoring scripts) to a publicly accessible URL such as Amazon S3 bucket, Azure storage, or CDN services like AWS CloudFront CDN. Then, record the file upload step in the EveryStep Recorder. While recording the step, you’ll be prompted to provide the link to the test file. The system will download the file and use it in the upload operation.

For load test scripts, using AWS CloudFront CDN is preferable to using Amazon S3 bucket due to the following:

  1. Scalability: S3 has inherent read operation limitations which can affect test results under heavy load tests.
  2. Consistency: Files stored in an S3 bucket are located in specific geographic zones, leading to potential latency issues based on the load injectors’ location. CDNs provide distributed edge locations, offering consistent latency and more reliable results during testing.

Recording a File Download within the Script

Alternatively, you can record the file download and select the downloaded file to record an upload step in the script. If necessary, you can change the file name and link, as well as downloading timeout, by editing the related line in the Script Code area after recording.

Best Practices

Dotcom-Monitor executes all steps and actions in the script without delays by default. However, it typically takes some time to upload a file to a web resource. In this case, to simulate the delay and wait for the system to execute the upload step, it is recommended to add the Delay line to the script right after the upload step.

In addition, to make sure the upload was executed correctly, set up content validation after the upload step. In general, if dialog boxes or upload confirmations appear on the page after the file upload, add keyword validation or available code snippets to check if the upload step brought the expected results.

Recording the File Upload from the External URL

Check the file upload setup steps below:

  1. Download a test file up to 100 MB to a publicly accessible URL.
  2. Record the script until the point you need to upload the file.
  3. Click the corresponding button on the target page to upload the file.
  4. In the Upload Files window, provide an external link to the file you want to upload. The file will be downloaded from the provided external link to the Dotcom-Monitor cloud storage. Once downloaded the file name will be listed in the Upload Files window. Select the file checkbox and click OK. As a result, the OpenFileDialogHandler line will be added to the script automatically.

    If the file download has been recorded in the previous step of the script, select the file name right away in the Upload Files window.

  5. Add the Delay right after the upload step.
  6. Add the keyword or image validation to the script.
  7. If necessary, proceed with the recording; and stop the recording process when ready.

Find the example of the file upload script recorded in the EveryStep scripting tool below. The script contains examples of uploading a locally stored file and a file from the external URL. For upload test purposes, you can use the following example files from publicly available URLs:

  • https://d149yd38g6ldk.cloudfront.net/LoremIpsum.docx
  • https://d149yd38g6ldk.cloudfront.net/LoremIpsum.pdf
  • https://d149yd38g6ldk.cloudfront.net/LoremIpsum.txt

Note that the file hosting platforms utilized in the example below are provided for demonstration purposes only. You can use any file sharing and storage platforms which allow download.

// script_version=3.0; everystep_version=4.0.7706.9249; date=2/10/2021; Chrome=83.0.4103.61
Tabs.SetSize (1768, 419);
DMBrowser tab0 = null;
Step (1, "Download & Generate Test Files - https://fastest.fish/test-files");
tab0 = Tabs.NewTab ();
tab0.GoTo ("https://fastest.fish/test-files");
tab0.Link ("//A[normalize-space()=\"5MB\"]", "//A[normalize-space(text())=\"5MB\"]", "//A[normalize-space()=\"10MB\"]/preceding-sibling::A[1]").Click ();
//File Download to the system storage  
Step (2, "Download & Generate Test Files - http://ipv4.download.thinkbroadband.com/5MB.zip");
tab0.Downloading ("5MB.zip", "http://ipv4.download.thinkbroadband.com/5MB.zip");
tab0.Para ("//P[normalize-space()=\"These test files will be downloaded in full over your network connection from high speed servers. These files can be used to test your network download speed.\"]/preceding-sibling::P[1]", "//P[normalize-space(text())=\"These test files will be downloaded in full over your network connection from high speed servers. These files can be used to test your network download speed.\"]/preceding-sibling::P[1]", "/HTML/BODY/DIV/DIV/P[1]").Click ();
//File Upload using the file from the system storage
Step (3, "Gofile - https://gofile.io/uploadFiles");
tab0.GoTo ("https://gofile.io/uploadFiles");
OpenFileDialogHandler (OpenFileDialogButton.Ok, new string[1] {"5MB.zip"});
tab0.Button ("//BUTTON[normalize-space()=\"Click here\"]", "//BUTTON[normalize-space(text())=\"Click here\"]", "//BUTTON[@ID=\"dropZoneBtnSelect\"]").Click ();
tab0.Button ("//BUTTON[normalize-space()=\"Upload\"]", "//BUTTON[normalize-space(text())=\"Upload\"]", "//BUTTON[@ID=\"uploadFiles-btnUpload\"]").Click ();
Delay ("40sec".ToDuration ());
tab0.KeywordAssert ("successfully uploaded");
//File Upload from the external URL
tab0.Link ("//P[normalize-space()=\"Upload Files\"]/..", "//LI[@ID=\"li-uploadFiles\"]//A", "//LI[@ID=\"li-api\"]/preceding-sibling::LI[1]//A").Click ();
tab0.Download ("Q3UTw.htm", "https://dropmefiles.com/Q3UTw");
OpenFileDialogHandler (OpenFileDialogButton.Ok, new string[1] {"Q3UTR.htm"});
tab0.Button ("//BUTTON[normalize-space()=\"Click here\"]", "//BUTTON[normalize-space(text())=\"Click here\"]", "//BUTTON[@ID=\"dropZoneBtnSelect\"]").Click ();
tab0.Button ("//BUTTON[normalize-space()=\"Upload\"]", "//BUTTON[normalize-space(text())=\"Upload\"]", "//BUTTON[@ID=\"uploadFiles-btnUpload\"]").Click ();
Delay ("40sec".ToDuration ());
tab0.KeywordAssert ("successfully uploaded");