Unexpected Behavior of Reporter.Reportevent - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Unexpected Behavior of Reporter.Reportevent (/Thread-Unexpected-Behavior-of-Reporter-Reportevent) |
Unexpected Behavior of Reporter.Reportevent - chinmaya chirasundara nayak - 11-19-2013 Hi all, I am new to this forum. I executed the following two codes in QTP 10.0. The objective of both the codes are same, and that is to verify the username displayed in acti-time application. Both the codes are syntactically correct and without any run time error. But I am getting different statuses on result screen after executing the codes. Here are the two codes Code 1 : Code: Dim username Result: Passed Code 2: Code: Dim username Result: Failed In both the codes, I have used "admin" as value for variable "username" and variable "s" will hold the value "User: Administrator System (admin) ". I was expecting code 2 to display passed in result screen as when "s" is splitted, all the elements in the string will be stored in the array "arr". Now while comparing each element of the array "arr" with the value of variable "username", the element arr(3) will match with the value of the variable "username" and the reporter.reportevent statement for micpass should be executed and in result screen the status would have been "Passed". But it is not happening in code 2 and the statement for micfail in the else part is executing. But Code 1 is performing well as per my expectation. Why my code 2 is failing ? Can someone please help me out ? RE: Unexpected Behavior of Reporter.Reportevent - kotaramamohana - 11-29-2013 In 2nd method when for loop is Executed, Each time it will check Username. So when Username is not matches, immediately Else condition will be executed. So we should use only 1st code only. RE: Unexpected Behavior of Reporter.Reportevent - chinmaya chirasundara nayak - 11-29-2013 But Sir, At one point, it will match with the username and then reporter.reportevent for micpass will be executed and then Exit for will be executed. And this will throw the execution out of the for loop and as reporter.reportevent for micpass is executed, the result status would have been Passed. Am I right ?? RE: Unexpected Behavior of Reporter.Reportevent - kotaramamohana - 12-03-2013 What you said is correct. But can you please look into the both codes, how you are splitting. Try to debug by using F11, Then you come to know what was the wrong |