OnStep Event
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2010
05:09 AM
04-23-2010
05:09 AM
OnStep Event
I'm attempting to create what I thought would be a simple event to post the Notes field of a Manual Test to the Log on step success. Based on the help files I attempted the following:
Sub GeneralEvents_OnStepSuccess(Sender, StepParams)
intStepID = StepParams.StepID
'Get the ManualTestingStepInfo Object
Set strTemp = Sender.GetStepInfo(intStepID)
'Get the data in Step notes and comments field
strTempNotes = strTemp.GetNotes()
'Outout the notes field to the log
Log.Message(strTempNotes)
End Sub
Unfortunately this results in an property or method not supported error at the "Set strTemp = Sender.GetStepInfo(intStepID)" line.
I've tried replacing "Sender" with "ManualTesting" as the help file seems to specify, but that results in an "Object required: 'ManualTesting' error.
What am I doing wrong?
Sub GeneralEvents_OnStepSuccess(Sender, StepParams)
intStepID = StepParams.StepID
'Get the ManualTestingStepInfo Object
Set strTemp = Sender.GetStepInfo(intStepID)
'Get the data in Step notes and comments field
strTempNotes = strTemp.GetNotes()
'Outout the notes field to the log
Log.Message(strTempNotes)
End Sub
Unfortunately this results in an property or method not supported error at the "Set strTemp = Sender.GetStepInfo(intStepID)" line.
I've tried replacing "Sender" with "ManualTesting" as the help file seems to specify, but that results in an "Object required: 'ManualTesting' error.
What am I doing wrong?
Solved! Go to Solution.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2010
01:21 AM
04-26-2010
01:21 AM
Ok, I've determined that I'm actually asking the wrong question. The above will work when I supply the exact name of the manual script:
e.g. Set strTemp = TestName.GetStepInfo(intStepID).
So the real question I have is how do I pass the test name into the Event. I assume that the Sender object has the data, but I've been unable to determine the command needed to extract it, and the help files have not been helpful.
e.g. Set strTemp = TestName.GetStepInfo(intStepID).
So the real question I have is how do I pass the test name into the Event. I assume that the Sender object has the data, but I've been unable to determine the command needed to extract it, and the help files have not been helpful.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010
04:55 AM
04-29-2010
04:55 AM
Hi Eero,
There are 2 ways to do this, depending on the way you run manual tests:
1. Add manual tests to the Test Items collection and run them from the collection. In this case, you can use the following approach:
Sub GeneralEvents_OnStepSuccess(Sender, StepParams)
Dim currentManualTestName, currentStep
currentManualTestName = Split(Project.TestItems.Current.ElementToBeRun.Caption, " - ")(1)
Set currentStep = Eval(currentManualTestName).GetStepInfo(StepParams.StepID)
Call Log.Message("The " & currentStep.GetCaption() & " step data", "Notes: " & currentStep.GetNotes())
End Sub
2. Run manual tests from script and use a global variable to hold a manual test's name. If you use this approach, your script can be as follows:
Dim currentManualTest
Sub RunManualTest
Dim manualTestName
manualTestName = "ManualTest1"
On Error Resume Next
Err.Clear()
Set currentManualTest = Eval(manualTestName)
If 0 <> Err.Number Then
Log.Error("The " & manualTestName & " manual test was not found")
On Error Goto 0
Exit Sub
End If
currentManualTest.Start()
End Sub
Sub GeneralEvents_OnStepSuccess(Sender, StepParams)
Dim currentStep
Set currentStep = currentManualTest.GetStepInfo(StepParams.StepID)
Call Log.Message("The " & currentStep.GetCaption() & " step data", "Notes: " & currentStep.GetNotes())
End Sub
I hope this helps.
-----
Alexander
Customer Care Manager
Alexander
Customer Care Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2010
08:00 AM
05-03-2010
08:00 AM
Thank you Alex. I had implemented a solution similar to the second option using Project Variables, but I like the first option better as it seems like a lot less overhead.
