Handling File Downloads

File downloads occur when a user clicks on a link or button on a web site that sends back a file to be saved or opened on the user's computer. When this happens, the browser usually prompts the user as to whether they would like to Open, Save or Cancel, and if they wish to save the file, where they would like to save it. These prompts can interrupt your tests and prevent them from playing back smoothly, so Badboy provides you with tools to help in handling them.

When recording, Badboy does not create handlers for File Downloads. When a file is downloaded, Badboy just records the Navigation or Request that causes the file to be sent back as it would for any other page navigation. As a result, on playback you may find that the script stops and is waiting with a prompt open. To deal with this, a tool is provided in the Toolbox that lets you to easily add file download handling to these items so that Badboy automatically handles the prompts for you in the way you desire.

Adding File Download Handlers

You can add a Download Handler to any playable item in your script simply by dragging it from the Toolbox into your script, and dropping it so that it becomes a child of the item that you want it to handle downloads for. The figure below shows how it should appear in your script when correctly positioned:

Note that the Download Handler must be a child of the item in the script that you want it to handle downloads for. The script tree will not let you drop a Download Handler except as a child of a playable item.

If the item you drop it into does not initiate a download on playback then no error or warning will be recorded. The download handler will simply have no effect.

Configuration

A number of possible actions can be configured to occur when a download is handled by a Download Handler. The figure below shows how the dialog for configuration looks:

As shown in the diagram above, you can choose two kinds of response:

  • Download the file - You can provide an explicit location to save it, or you can leave it blank and let Badboy automatically choose a location for you. By default Badboy will save it in the same directory as your script, under a file name indicated by the URL for the download. If you want, you can specify a folder here and Badboy will use that directory, but automatically decide the file name, or, you can specify the complete file name you would like and Badboy will save it there.
  • Cancel - Ignore the download. Badboy will not transfer the content at all. You should still receive an error if the content does not exist or a server error occurs in providing it, however you will not test the full download process.

Unlike in the normal IE Save dialog, you do not have the option under Response to open the content instead of downloading it. If you want to open it, you must download it and then configure one of the "Open" options under "Handling" as described below.

If you choose to download the file, you can then choose one of the options for handling the file after it has been downloaded, as follows:

  • None - do nothing at all. The file is saved and left in the folder.
  • Open Externally - Open the file outside of Badboy using the default program configured on your computer for opening such files.
  • Open Internally - Badboy will construct a file type URL to point to the file it has downloaded and browse the internal browser to that location. For file types that support embedded display inside the browser this will result in the files displaying inside the Badboy window itself. You should not use this option for file types that do not support embedded display.

There is no automatic error if the program fails to start or cannot open the file. You would need to configure a check (such as a Window Caption Check to verify the content after it has opened.) or other means to validate that it loaded correctly.


Badboy Documentation Generated on Thu Dec 31 12:56:46 EST 2009