简单?(Easy? Need API ServiceTest equivalent (C#) for QTP Reporter.ReportEvent)

编程入门 行业动态 更新时间:2024-10-23 21:27:45
简单?(Easy? Need API ServiceTest equivalent (C#) for QTP Reporter.ReportEvent)

我希望有人能告诉我如何从代码中调用ReportMessageActivity。 就像我在QTP中使用Reporter.ReportEvent一样。 我需要将动态数量的消息循环到脚本中各个位置的日志中。

我试着在三个星期内到处找到答案。

a)我正在使用UFT 12.54。

b)如果解决方案不涉及自定义代码,那么解决方案将无法工作。

我已经在使用动态表来循环消息。 非定制的代码解决方案对我来说毫无用处。 (请相信我。)我最接近的解决方法是一个包含自定义代码的循环,这些自定义代码调用包含自定义代码和“报告消息”的循环。 即使它几乎没有工作。

帮帮我??? 请??? 并且,对于可以提供的任何呼叫/摘要,提前非常衷心的“谢谢”。 即使一些小提示,可能会让我更接近,将不胜感激。

-----尝试复制工作QTP VB代码3周后发泄-----

(如果你容易燃烧,请随时不要阅读......:D)

我发现它<insert your chosen expletive adjective> ,至少,试图使用“使其变得如此灵活”的自定义代码没有记录。 没有圣经或任何解决API测试构建块(方法,类,指令等)的东西,甚至没有昂贵的API / UFT ServiceTest书籍。

我不能使用在其他“side”应用程序的“一侧”工作的代码顺便说一句 - 我从原型的GUI使用API​​Calls。 只要GUI测试发送10个SOAP请求就花了很长时间。 我期望进行大量的按摩以将工作GUI VB脚本中的逻辑导入API C ##。 但是,缺少功能? 我觉得我已经在Windows 10世界中醒来。 颜色很亮! punk rock rendition of "Hotel California" in the background :)

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 :)

最满意答案

这非常简单。

TestUserCode.cs文件的TODO部分中,使用以下语法输入要报告的值:

this.<activity name>.Report("<report information title>", "<reported data>");

要么

<activity name>.Report("<report information title>", "<reported data>");

所以你的代码看起来像这样:

//Your code to loop through table for (int iRow = 2; iRow <= lastRowOfYourTable; iRow++) { //... <activity name>.Report("<report information title>", "<reported data>"); //... }

查看this链接了解更多信息。

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.

更多推荐

本文发布于:2023-08-06 06:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1446034.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简单   API   Easy   ServiceTest   ReportEvent

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!