File Upload Testing For Websites And Web Applications

There are cases in performance and load tests, when during test execution it’s required to upload a file. If your website allows users to upload files, for example account avatar or any other type, file upload testing is absolutely necessary to test the bounds of this functionality. This testing task may be tricky, as file upload utilizes the native file system prompt to select the desired file with which automated testing frameworks can’t interact. Today we will take a look at how you can implement file uploads in your performance or load tests.

You may have functionality for a small text file upload, or your users will upload large media content files to work with on your website. File upload testing should include checking various cases. You may have some special needs, but there is a small list of the minimum that must be checked:

  • Verify the max file size.
  • Verify that an empty file is (or is not) accepted.
  • Check if unsupported file extensions can be used.
  • Check if all supported file extensions can be used.
  • Verify that the progress bar is updating.
  • Check the behavior when uploading on slow Internet speed
  • Verify that file is actually uploaded when the progress bar finishes.
  • Check that the file name and extension did not change when uploaded.
  • Verify that special characters are accepted.

Remember, this is only the minimum. The list can grow very long, depending on the features that the website offers regarding uploads. For some services file uploading functionality is critical and it’s important to make sure that it’s secure for the user and the service provider. Most of the time there must be a file size limit to avoid overwhelming the file storage with malicious files. Depending on the service, but there might be unsupported file extensions. For example, when uploading an account avatar, website should not accept ZIP files. When uploading on slow Internet speed it could cause issues with random network disconnects, in which case there is a possibility for corrupt files and failed upload.

How can we help with file upload testing

In Loadero we understand the importance of file upload testing. We are aiming to produce a tool that fulfills all kinds of needs for performance and load tests. If you have to make sure that the uploading feature works correctly for a single user in various cases, or run a large scale test, where thousands of users upload various size files simultaneously, we’ve got you covered. There are five sample files available for use in the custom commands that range in size from 100kB to 100MB. Four sample PNG type files allow you to choose between 100kB, 1MB, 5MB and 30MB and a 100MB TXT type file. The custom commands can be used in Nightwatch and TestUI to support pre-defined file upload testing without any hassle. These file names can be used as string values or as constants provided in loaderoConstants object

To provide a better understanding of the command, let’s take a look an example of the sample files usage in Nightwatch for file upload testing. We will use Toast Net upload speed test page, it has very simple functionality and fits nicely for this example. We will upload a file, wait and take a screenshot to make sure that the file has been actually uploaded.

Script used in example:

function(browser) {
       // Navigate to sample page
       // Wait until the page is fully loaded
       .waitForElementVisible('body', 10 * 1000)
       // Set the file in input form
       .setFile('input[type=FILE]', loaderoConstants.sampleFiles.png100KB)
       // Wait a second
       // Take a screenshot to verify that file was set
file upload testing
Screenshot taken in the test run

Uploading a file is a simple and widely used feature, but it  has a lot of potential for bugs. They can worsen end user experience or even block critical functionality such as personal document upload. Running automated tests of the file uploads in advance can make a difference between having loyal customers and losing them due to bad user experience. In automated tests, there is no simple solution available to test drag and drop upload fields, but on the bright side usually there is still an option to pick the file the old fashioned way via file select prompt – which can be automated. And this can easily be achieved in Loadero by a script command that will allow you to upload predefined files with different sizes and file types.

If you have a need for testing file upload with other file types, then make sure to let us know. We are constantly working on improving our service to meet every customer’s needs. If something has been left unclear, feel free to contact our support team, we are happy to help you. File upload testing feature is included in Loadero free trial plan along with other useful features for performance testing. Subscribe today and run your first performance tests free of charge.

Write A Comment