I am surprised that many people who script with LoadRunner on a regular basis do know know that you can run external programs in Windows that are kicked off by code in Vugen scripts. The system() function allows you to do this. There have been times where I needed to run a portion of a script and then kick off a program that would run on my local machine for a few minutes. I created a Windows Batch (.BAT) file with it’s own set of instructions on running and how to exit out. When I am ready to kick this BAT file off, I just put one line of code in my Vugen scripts to kick it off.
If you wanted to run a bat file called “rcmdm.bat” located in the C:\remote\ folder. In VuGen, put the following:
Pretty simple, huh? Note the additional escape character slash needed to account for the slash in the directory structure, as the slash is a special character. This is a great way to have batch jobs kicked off at specific, controlled portions of the test scenario.
Did you enjoy this article? Help spread the word by sharing:
Engage in the conversation and leave a comment:
About Scott Moore (153 articles)
With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events