there is init, action and end functions. is it possible to have multiple action method? i want it to run on a separate execution thread.
3 Answers
Adding actions in VuGen is easy, but it does not allow you to execute them in parallel within the same vuser. If you want to execute things in parallel you need to run more than one vuser on the controller for the script.
Instantiating a new thread within a vuser is very difficult and requires you to use the Win API for creating threads - definitely not recommended.
If you want 2 different actions to execute in parallel use multiple scripts instead. You will not be able to share variables or data between the vusers thou.

- 1,369
- 10
- 19
-
The only way to establish some kind of communication between VUsers ist by using rendezvous points using lr_rendezvous etc (aside from systems programm using a DLL which uses the Windows API, as K. Sandell noted). – TheBlastOne Jun 18 '10 at 07:46
-
Meanwhile, I'd add: Alternatively, you could use the virtual table server (VTS) available for free at HP's support site to establish an easy means of communication between VUsers. – TheBlastOne Jan 20 '11 at 17:33
Yes, you can have multiple actions. While recording you can specify a new action from the VUGen toolbar. You can also just record everything to "Action", then edit the script and create your own actions and paste code there.

- 28,540
- 12
- 67
- 94
-
Of course, you also can add actions anytime by rightclicking into the actions list and selecting "create new action" (might be disabled for some protocols if I remember correctly). – TheBlastOne Jun 18 '10 at 07:49
-
@TheBlastOne Do you know which protocols? I have a set up using Oracle ("-Tier) and Web (HTTP/HTML) protocols and am unable to Create New Action and there is no equivalent button on the "Start Record" dialog. – wmorrison365 Jan 18 '12 at 11:27
-
Guess you can also edit the [project].usr and default.usp to add your action. See my answer (so I can format output). – wmorrison365 Jan 18 '12 at 11:45
As far as an additional action goes, you can edit the LR config, namely default.usp and your [project].usr files. May I say from the outset though that mucking with config files may be risky and if you do so, take a backup of the files or project first and proceed with care.
That said, this does seem to overcome the problem of "Create New Action" not being enabled (though I'd love to know the set of circumstances that causes that - @TheBlastOne indicates it's to do with the protocol used).
Anyway, edit your default.usp to add a RulLogicRunRoot entry for your new action (say Action2) and configure it in the LR execution lifecycle, as follows:
default.usp
[RunLogicRunRoot:Action2]
MercIniTreeSectionName="Action2"
RunLogicObjectKind="Action" <-- "Action" in this case means LR object type
Name="Action2"
MercIniTreeFather="RunLogicRunRoot"
RunLogicActionType="VuserRun"
...
Profile Actions name=vuser_init,Action,Action2,vuser_end
...
RunLogicActionOrder="Action,Action2"
...
MercIniTreeSons="Action,Action2"
Not sure how much of your [project].usr file you need to edit but you should define the action and interpreter for your new action in any case:
[project].usr
[Actions]
vuser_init=vuser_init.c
Action=Action.c
Action2=Action2.c
vuser_end=vuser_end.c
...
[Interpreters]
vuser_init=cci
Action=cci
Action2=cci
vuser_end=cci
...
I'm unsure how much of the following is needed but it's probably sensible to create an entry for each (as per the Action script):
[Recorded Actions]
...
[Replayed Actions]
...
[Modified Actions]
Finally, don't forget to create an Action2.c (with appropriately named function to avoid clash with Action.c) in your project directory. Reopen your project in LR and it should contain Action2 in your scripts view.
N.B. Sorry but I can't help with your question on threading... not that advanced yet.

- 5,995
- 2
- 27
- 40