Roopesh Nair
Junior Member
Reged: 12/13/04
Posts: 2
Loc: hyderabad
|
|
Hi All,
When a trying to execute a small Function or Sub in QTP 8.2 it is displaying "Type Mismatch" error.
Ex: Sub MsgTest () Msgbox "Test" End Sub 'Calling procedure in different ways. MsgTest Call MsgTest()
In both the above scenario's im getting the same error "Type Mismathc MsgTest"
Is it any setting/configuration problem in QTP8.2?
PS: Before i used to execute the same
Thanks in Advance,
--Roopesh
-------------------- Roopesh T
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
|
|
Where are you defining the function and where are you calling it? They have to be in the same actions and not different actions. Or else you need to declare them in a VBS file and associate it with the test.
-------------------- Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **
KnowledgeInbox RSS
|
Roopesh Nair
Junior Member
Reged: 12/13/04
Posts: 2
Loc: hyderabad
|
|
Hi Tarun,
Yes, i am defining & calling the function or sub within the same action. i.e. As same as the above code which i have posted.
But i identified the probelm...
Case 1: i.e. When i trying to execute the code directly by calling the function or sub from (Call MsgTest() or MsgTest ) using Run From Step option in the Test Menu then the "Type Mismatch" error appearing.
Case 2: Where as when tyring to execute the function from its definition (i.e. Sub MsgTest())then it is not giving any error.
My understanding: In "Case 1: QTP doesn't know function or Sub definition, where as in "Case 2" QTP awares the same. Is this because of VBscript nature (i.e. Object-Based rather than Object-Oriented).
Thanks
-------------------- Roopesh T
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
|
|
If the function definition does not get executed and then there would be no function as such and hence you would get Type Mismatch error.
-------------------- Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **
KnowledgeInbox RSS
|