murugans1011
11 years agoRegular Contributor
Running Project test item
Hi,
I have a scenario where i need to run the same project test item several times(say for 10). so i just increased count to 10. in some situation if there is an error posted in to the test log , then i need stop the current project test item. So i have used
Runner.Stop(True) 'To stop only current testitem and move to the next item
in the Onlogerror event. So tc just stops current test item and moves to the next item even through the count is 10.. in my scenario i need to run same testitem again with different arguments till the count is reached...i cant able to find any method to this. now i m simply adding the same project test item several times.
is there anything can be done with "onstop test" event to run same testitem again. Pls provide any suggestion to achieve my scenario.
Thanks,
I have a scenario where i need to run the same project test item several times(say for 10). so i just increased count to 10. in some situation if there is an error posted in to the test log , then i need stop the current project test item. So i have used
Runner.Stop(True) 'To stop only current testitem and move to the next item
in the Onlogerror event. So tc just stops current test item and moves to the next item even through the count is 10.. in my scenario i need to run same testitem again with different arguments till the count is reached...i cant able to find any method to this. now i m simply adding the same project test item several times.
is there anything can be done with "onstop test" event to run same testitem again. Pls provide any suggestion to achieve my scenario.
Thanks,
- There is another approach you can try:
1. Get the name of the currently run test item:
var test = Project.TestItems.Current.ElementToBeRun.Caption;
It returns the name in the following format: Script\Unit1 - Main. So:
2. You need to parse the string and obtain the name of the test and the name of the script unit:
var arr = test.split("\\")[1].split("-");
var unitName = aqString.Trim(arr[0]);
var name = aqString.Trim(arr[1]);
3. Now, you can call the function:
Runner.CallMethod(unitName + "." + name);