How to automate reading the file names in a directory and give them as input to loadrunner parameter? (VB Script)

Loadrunner
Scenario:

When we are load testing the file upload scenario in loadrunner, we need to give unique file names as input to the file parameter. The amount of files to be given as input may vary from thousands to lakhs based on our load.

Now the question is how to give those thousands and lakhs of files names as input to the parameter file?

The below VB Script comes handy to read all the input file names in a folder and write to a text file which can be given as input to the load runner parameter.

VB Script:

Set fs = CreateObject("Scripting.FileSystemObject")
'File in which file names to be witten
Set logFile = fs.OpenTextFile("C:\Users\vinoth.srinivasan\Desktop\VB_Scritping\Vinoth.txt", 2, True)
'Directory from which file names to be read
Set folder = fs.GetFolder("C:\Users\vinoth.srinivasan\Desktop\VB_Scritping")

Set files = folder.Files
  For Each file in files
    logFile.writeline(file.name)

  Next
logFile.close

1 comment:

  1. Hi, I want to do noticeably the same thing. I want to read each file (thousand pdfs) of a directory to give as input to a HTTP LR script without using "Extra files". Is it possible pls ?

    ReplyDelete