Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

During a loadtest is it possible to download a file from a server and save it on the local harddisk?

During a loadtest is it possible to download a file from a server and save it on the local harddisk?

By default SilkPerformer downloads files but does not save them to disk at HTTP/HTML level replay (see resolution If I record the downloading and saving of files to disk does SilkPerformer simulate this on replay ).

It is possible to use SilkPerformer's DLL integration to make a Windows API calls to copy from one location to another. SilkPerformer has functions such as fRead and fWrite but these are limited by buffer size when copying large files. Instead it is possible to use of the Windows API functions, e.g.

Example code:

dll "kernel32.dll" //func declaration
  "CopyFileA"                  // copy a file
       function CopyFileA(inout string, inout string, inout boolean): long;
       //Arg 1:  File source
       //Arg 2:  File destination
       //Arg 3:  Overwrite if already exists

  "DeleteFileA"                  // Delete a file
       function DeleteFileA(inout string): long;

    TMain       : 1;

// Transactions Section

  transaction  TMain
    sSource, sDest :string;
    bIfExists :boolean;
    sUserId: string;
   //Initilize variables
    sUserId    := string(GetUserId());
    sSource    := "c:\\testfile.txt";
    sDest      := "c:\\temp\\testfile_"+sUserId+".txt";
    bIfExists  := false;

   If bIfExists = true then          // if file exists
      DeleteFileA (sDest);           // delete existing file
      wait (5.0)
   CopyFileA (sSource,sDest,bFailIfExists); //copy file to dest

  end  TMain;

The actual structure of the CopyFileA is :-

dll "kernel32.dll"
  "CopyFileA"             // function name
     function CopyFileA(
                LptStr,      //  IPExistingFileName
                LptStr,      // IPNewFileName
                Bool,        // bFailifExists


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 18:50
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.