I'm hoping someone can tell me how to call ReportMessageActivity from inside my code. Just like I used Reporter.ReportEvent in QTP. I need to loop a dynamic number of messages to the log at various places in the script.
I've tried finding the answer everywhere for 3 weeks.
a) I'm using UFT 12.54.
b) If the solution doesn't involve custom code, then the solution won't work.
I'm already using a dynamic table to loop the messages. Non-custom code solutions are useless for me. (Please trust me on that.) My closest workaround is a loop containing custom code that calls a loop that contains custom code and "Report Message". And even it's barely working.
Help??? Please??? And, a very heartfelt "Thank you" in advance for any calls / snippets that can be provided. Even little hints that might get me closer would be appreciated.
----- venting after 3 weeks of trying to replicate working QTP VB code -----
(feel free not to read if you're prone to flaming... :D )
I find it <insert your chosen expletive adjective>
, at the very least, that trying to use the custom code that "makes it so flexible" is undocumented. There is no bible or anything that addresses the API test building blocks (methods, classes, directives, etc.) Not even the expensive API/UFT ServiceTest books.
I can't use code that works in one "side" of the application in the other "side" BTW -- I used APICalls from the GUI for the prototype. It took exactly as long as the GUI test to send 10 SOAP requests. I expected a lot of massaging to import the logic from the working GUI VB Script to API C##. But, missing functionality??? I feel like I've woken up in a Windows 10 world. The colors are so bright!
punk rock rendition of "Hotel California" in the background
:)
It's fairly straight forward.
In the TODO
section of the TestUserCode.cs
file, enter the value you want to report using the following syntax:
this.<activity name>.Report("<report information title>", "<reported data>");
Or
<activity name>.Report("<report information title>", "<reported data>");
So your code would look something like:
//Your code to loop through table
for (int iRow = 2; iRow <= lastRowOfYourTable; iRow++)
{
//...
<activity name>.Report("<report information title>", "<reported data>");
//...
}
Check this
link for more information.