Running Project test item
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2014
04:12 PM
05-14-2014
04:12 PM
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,
Solved! Go to Solution.
9 REPLIES 9
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2014
02:21 AM
05-15-2014
02:21 AM
I wouldn't use the OnStopTest event handler in this case. I'd use the OnLogError handler. In that handler, keep track of the iteration of the test item. If an error is logged and it is not in the last iteration (iteration < 10), execute scripts or keyword tests that "clean up" the test so you can start the next iteration. You might need to include code in your Test Item that indicates whether or not the iteration is successful. A "try/except" wrapped around the entire test would help with that.
I don't think this is something that you're going to be able to do with just a bult-in command but something that you're going to have to do some architecture work around your test items in order to make them self-aware of their state (iteration, error condition, success, etc).
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
I don't think this is something that you're going to be able to do with just a bult-in command but something that you're going to have to do some architecture work around your test items in order to make them self-aware of their state (iteration, error condition, success, etc).
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2014
03:07 PM
05-15-2014
03:07 PM
Hi,
Thanks for ur reply.
I have implemented something like this in onlogerror event
Sub GeneralEvents_OnLogError(Sender, LogParams)
if RunErrorFlag=1 then 'Flag will be set if error is posted with high priority
testCount=Project.TestItems.Current.Count
if Project.TestItems.Current.Iteration<testCount then
Call Tc_Add_PRN_Categorywise 'function call
End if
End if
End Sub
but instead of calling a function if iteration<count ,i need somthing like
Project.testitem.Current.Run
but there is no method to run testitem from script. i need something lik current running testitem's function should be called automatically till testitem count.
Thanks for ur reply.
I have implemented something like this in onlogerror event
Sub GeneralEvents_OnLogError(Sender, LogParams)
if RunErrorFlag=1 then 'Flag will be set if error is posted with high priority
testCount=Project.TestItems.Current.Count
if Project.TestItems.Current.Iteration<testCount then
Call Tc_Add_PRN_Categorywise 'function call
End if
End if
End Sub
but instead of calling a function if iteration<count ,i need somthing like
Project.testitem.Current.Run
but there is no method to run testitem from script. i need something lik current running testitem's function should be called automatically till testitem count.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2014
04:41 PM
05-16-2014
04:41 PM
is there any alternative way instead of
Runner.Stop 'to stop current testitem and execute it from beginning somthing lik 'exit function' from On LogError event
Runner.Stop 'to stop current testitem and execute it from beginning somthing lik 'exit function' from On LogError event
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2014
03:44 PM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014
11:39 PM
05-29-2014
11:39 PM
Hi Murugan,
Something like this should work:
IntegrationObj.RunProjectItem(<ProjectName>", "<ProjectItemName>")
Something like this should work:
IntegrationObj.RunProjectItem(<ProjectName>", "<ProjectItemName>")
---------
Tanya Yatskovskaya
SmartBear Community and Education Manager
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2014
03:08 PM
05-30-2014
03:08 PM
Hi when i try this i got " cannot launch another instace of application".. I think that Interagtion object is to run project item from external application.
I've contacted support team regarding this and found that this feature is not implemented yet. So i've added my vote.
I've contacted support team regarding this and found that this feature is not implemented yet. So i've added my vote.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2014
05:59 PM
06-01-2014
05:59 PM
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);
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);
---------
Tanya Yatskovskaya
SmartBear Community and Education Manager
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2014
04:20 PM
06-04-2014
04:20 PM
Hi Tanya,
Thanks for ur reply. This is what i m exactly looking for.
I had spend lot of time because of this problem
Now it works fine.
Thank you so much:)
Thanks for ur reply. This is what i m exactly looking for.
I had spend lot of time because of this problem
Now it works fine.
Thank you so much:)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014
03:52 PM
07-23-2014
03:52 PM
//[VBScript] for above function
Sub ProjectTestRun
test = Project.TestItems.Current.ElementToBeRun.Caption
arr = split(test,"\")
tempArr=split(Arr(1),"-")
unitName = aqString.Trim(tempArr(0))
name = aqString.Trim(tempArr(1))
Runner.CallMethod(unitName + "." + name)
End sub
