LoadRunner Interview Questions
Q:What is the function to upload a file to the ftp server using Vugen/LoadRunner?
A: ftp_put is the function to upload a file to the ftp server.
Below is the syntax of ftp_put:
int ftp_put ( char *transaction, item list, LAST);
transaction | A transaction name for this step. To instruct VuGen not to create a transaction for this step, use a NULL string, “”. |
item_list | A list of all the items for this function. Enclose all entries with quotes. SOURCE_PATH – The file to upload to the FTP server. OR MSOURCE_PATH – Like SOURCE_PATH, but using wildcards to specify multiple files. If wildcards are not specified, all the files in the MSOURCE_PATH are uploaded. TARGET_PATH (optional) – the path and filename in which to place the file. if (M)SOURCE_PATH is specified, but TARGET_PATH is not specified, the file is stored in the root directory of the FTP server, with the original file name. MODE (optional) – Retrieval mode ASCII or BINARY (default). PASSIVE (optional) – Sets the communication protocol to Passive Mode FTP. To enable, pass “PASSIVE=TRUE”. ENDITEM – Marks the end of the list. (no quotes) |
LAST | A marker indicating the end of the argument list. |
Example:
In below example, ftp_put function sends the file test.txt to the FTP server.
// Login to the FTP server
ftp_logon (“FTP”, “URL=ftp://ftp.desigoogly.com”,LAST);
// Transfers and places the file “test.txt” in the /LRInterview directory.
ftp_put (“Ftp_Put_Step_Name”,”SOURCE_PATH=c:\\test.txt”,”TARGET_PATH=/LRInterview”, LAST);
// Logout from the FTP server
ftp_logout();
Leave a Reply