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.
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; dcluser user VirtUser transactions TMain : 1; // Transactions Section dcltrans transaction TMain var sSource, sDest :string; bIfExists :boolean; sUserId: string; begin //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) end; 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