Highlighted
Absent Member.
Absent Member.
7459 views

Invoking Batch Process from Load Runner

Hi Experts,



Greetings!



Below is the scenario:



There is a batch file (Batch.CMD) in my local machine (say D:\Simulator folder).
When user clicks on the batch file, it will execute a process which sends messages to the server(depending on the properties set in the D:\Simulator\Lib and D:\Simulator\Config folders)
After running the batch file for some time (say 10 mins) I would stop it by pressing CTRL+C.


Now I need the below:

My VuGen script should go to this path and click on (or invoke) the batch file and run it when I replay the script.
When I stop the VuGen script, the batch file should stop running.


Is it possible to do it?

What’s the VuGen protocol to do it?



My goal is to parameterize the directory path of the batch file in VuGen script, so that I have many instances of the batch file (obviously with different properties set in the \Lib and \Config folders) running when I run the script from Controller.



Ideas/Suggestions? Thank you for your time. Any help would be greatly appreciated.



Thank you
Amar.
0 Likes
11 Replies
Highlighted
Absent Member.
Absent Member.

Haven't tried the sort of things, but the correct way should be to select windows socket protocol with application type = win32 apps
program to record = select the command prompt directory path and so on... let me know how you proceed
0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Amar,

Try RDP protocol if possible.
0 Likes
Highlighted
Established Member..
Established Member..

Hi Amar,

Try with Win32 Applications and default recording options you should be able to record and replay it.


Thanks
Ajay
0 Likes
Highlighted
Absent Member.
Absent Member.

I guess this will help you.

If you can invoke the batch file from command prompt try this out.


/******************/

Action()

char command[1024]; // declare a cahar val

sprintf(command, "C:\\test\\test.bat");// mention the path of the file with full path details

system(command); // it will execute the command

return 0;

/**************************************/

on test.bat file i kept folowing command.

/************************************/
ping localhost -n 10
/***********************************/

now this batch file will run 10 times. I am sure there will be some loop running inside the batch file you mentioned try to edit it with a count and then try.

Regards,
BN
0 Likes
Highlighted
Absent Member.
Absent Member.

Hi All,

Thank you for the valuable inputs. I tried it as mentioned in the thread above, with system Command.

The VuGen script just kick starts the batch.cmd file and it disappers. I want it to run indefinetly till I press the Stop button in VuGen script.

Thank you.

0 Likes
Highlighted
Absent Member.
Absent Member.

If you just want the batch process to keep running for a defined time, then add lr_think_time(600) at the end of the script for a delay of 10 mins after the invoking of the batch process. Enable think time in your run time settings also for this statement to perform the operation.

Thanks
Prashanth T
0 Likes
Highlighted
Absent Member.
Absent Member.

I was able to find an alternative approach to emulate the Batch.CMD utility behavior (Sending messages to the server). We no longer need to invoke the Batch.CMD from Load Runner.

Protocol: Web (HTTP/HTML)
Application Type: Win32 Applications
Program to Record: Browse and select the path where Batch.CMD tool is present.
Program Arguments: Leave blank

Load Runner records the request (web_custom_request) that Batch.CMD tool is sending to the server. All we need to do is parameterize the data within this request. It is working fine as of now and the behavior is reflected in the application backend.

Thank you for your time.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..



bnpraveen's Explanation in this thread is great.

Thanks much BNVPRAVEEN.

Thanks,
Jaipal
0 Likes
Highlighted
Absent Member.
Absent Member.

This is awesome information. Thanks for posting it.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Its not possible to record the CMD file, as start recording button becomes disable when we select the file as type".CMD". 

it supports only EXE files for recording.

 

Did you do some different settings

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi bnpraveen,

I have got the same requirement and even i have done the same way as calling batch file in  VUgen script.

But i am struck at parameterizing the batch file path. When i am going through the forum i have seen ur post on the same.

I have mentioned the statement as below,

sprintf(command, "C:\\test\\testsample1.bat");

Here If suppose i want to parameterize this batch file path to pass different batch files it's not working for me. values are not picking up from parameter file, directly parameter file name ({batchfilelist}) passing through.

can you help me here

 

0 Likes
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.