Checkproperty method in QTP:


Checkproperty method in QTP:
Check property in qtpAutomation tool itself does not find and report new bug(s) efficiently.It requires a skill of automation tester to let tool perform the operation in an efficient manner.We generally verify that application performs as expected;and if not,then report warning or info or error.Power of automation is unleashed only when we understand the thin line(hypothetical) that is between manual test and automation tool(s).I call this line as Auto-Manual bridge.I work out there.

Rolling back to topic again: There are different methods and properties available for checking/verifying.Exist,checkproperty, getROProperty etc.Let’s discuss Checkproperty method.We often come across a situation to verify the status of page load, test entered on the text box and similar scenarios.Checkproperty methods is very handy to solve the above problems easily.

Example:

Syntax:object.CheckProperty (PropertyName, PropertyValue, [TimeOut])

Example 1.Check the status of page.

>Browser("micclass:=Browser").Page("micclass:=Page").Object.CheckProperty ("status","done",3000)

Example 1.Verify the text Automationlab09 has been entered on the name textbox.

>Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“name of text box”).Set “Automationlab09”
sCheck=Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“Name”).CheckProperty (“value”, “Automationlab09”)

Here (in example 1), Quick test verifies whether the status on the status bar of browser is displayed as “done” or not. It waits till the timeout period ie. 3 seconds(in milliseconds),If it is unable to verify the status within 3 seconds then it’ll use the default time period specified in test settings.If verification is successful within time period it’ll return a boolean value TRUE and report test status as “PASSED” on test results else it’ll return boolean value FALSE and report the test status as “FAILED” on test results viewer.
This is an alternative way of using checkpoint in descriptive programming.

Advertisements

12 responses to this post.

  1. Posted by atul on June 1, 2011 at 9:34 am

    what if we have to check more than one property of an object using CheckProperty?

    Would it be like:

    CheckProperty(“height”,20,”width”,100)

    ??

    Reply

    • Atul,
      CheckProperty holds only two mandatory and one optional arguments.
      object.CheckProperty (PropertyName, PropertyValue, [TimeOut])
      Better you can try with GetTOProperties ,it brings in more details about the object.

      let me know if you need more help on this.

      Reply

    • See if it helps:

      Set LinkObj= Browser(“Google”).Page(“Google”).WebElement(“Google Search”)

      Set PropertyCollection = LinkObj.GetTOProperties

      For i = 0 To PropertyCollection.Count – 1
      Print PropertyCollection(i).Name
      Print PropertyCollection(i).Value

      Next

      Set PropertyCollection =Nothing

      Set LinkObj=Nothing

      Reply

  2. Posted by Anonymous on August 11, 2011 at 6:01 pm

    In below code, QTP will throw an error as Expected Statement

    sCheck=Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“Name”).CheckProperty “value”, “Automationlab09”

    To Resolve this error, CheckProperty parameters needs to be enclosed in paranthesis as follows:

    sCheck=Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“Name”).CheckProperty (“value”, “Automationlab09”)

    Thanks!

    Reply

  3. Posted by Nitin on September 15, 2011 at 1:08 pm

    Hi

    Is there any difference between checkproperty and waitproperty?

    Regards,
    Nitin

    Reply

  4. Nitin,
    Chekproperty:If the expected and actual values do not match, an error is reported and the test or component status is changed to failed.
    whenever you do not want to fail the test if the expected and actual values do not match, use the WaitProperty method.
    Let me know if you need more details.

    Reply

  5. Posted by tanuj on December 9, 2011 at 8:33 am

    hi,i want to match the word for that what property name use? in check property method plzz reply as soon as possible

    Reply

  6. Tanuj, if you could clarify your question?

    Reply

  7. Posted by Anonymous on August 22, 2012 at 1:18 pm

    inner text property can be used tanuj

    Reply

  8. Posted by Harsh on November 23, 2012 at 8:04 am

    What is the mean of property value in checkproperty

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: