Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create a Reusable code for Repetitive Reporter.ReportEvent Statements
#1
Solved: 9 Years, 7 Months ago
Hi Everyone,

I need to create a reusable function to update QC step results using QTP.
I am using reporter.ReportEvent then specifying the arguements after each step in QTP script.
After doing this about 7 times I decided that I should create a reusable function to limit the efforts, though a bit concerned because there are so many variables which values differ throughout.

I am having trouble with this code:
Code:
Public Function  fn_StepResult(variable, Vvalue, vmictypeA, vmictypeB, vstepnum, vmessageA, vmessageB)
If variable = Vvalue Then
Reporter.ReportEvent vmictypeA, vstepnum, vmessageA
Else
Reporter.ReportEvent vmictypeB, vstepnum, vmessageB
End If
End Function

The error is:
Type mismatch: 'Reporter.ReportEvent'
Function file: C:\....\....\Desktop\web_methods.qfl
Line (675): "Reporter.ReportEvent vmictypeA, vstepnum, vmessageA".


I am calling this function as:
Code:
Call fn_StepResult(Environment("LVCA"), "3rd Party ID search", "micPass", "micfail", "Step 1", "search preselected / Select 3rd Party ID in search by weblist, and valdiate the list selection is true",  "search preselected / Select 3rd Party ID in search by weblist, and valdiate the list selection is true")

Please help I am facing a deadline and thank you in advance.

Hi Everyone,

I have resolved the issue.

The error was in the Call to the function specifically the values of the variables vmictypeA and vmictypB.

I realized that the micPass and micFail also have boolean values.

micPass = 0
micFail = 1

Therefore I replaced the micPass and micFail values with 0 and 1.
The script worked like a charm.

Though this approach might be unique, I am curios to what others thought of my approach.

I am ope to any suggestions or advice.

Thank you All and Please use this forum only! For QTP related purposes
Reply


Messages In This Thread
How to create a Reusable code for Repetitive Reporter.ReportEvent Statements - by notknownspammer - 10-02-2014, 12:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Where can I get statements for changing qtp settings. anil2u 4 5,880 05-21-2012, 12:12 AM
Last Post: ravi.gajul
  Control Statements piyush957 2 3,320 11-25-2011, 11:18 AM
Last Post: piyush957
  reusable action called inside another reusable action in qtp ritugoyal 0 2,478 05-05-2010, 03:16 PM
Last Post: ritugoyal
  Running QTP scripts(in batch) through Quality Center When further reusable actions ar ritugoyal 5 7,511 07-11-2009, 11:52 AM
Last Post: ritugoyal
  wait statements sunny rao 3 3,043 08-20-2008, 07:04 PM
Last Post: RaghavendraRaichur

Forum Jump:


Users browsing this thread: 1 Guest(s)