首页 > Linux操作系统 > Linux操作系统 > Performing Programmatic Description Checks

Performing Programmatic Description Checks

原创 Linux操作系统 作者:ipqiaojj 时间:2009-03-14 10:25:11 0 删除 编辑

Performing Programmatic Description Checks

You can compare the run-time value of a specified object property with the expected value of that property using either programmatic descriptions or user-defined functions.

Programmatic description checks are useful in cases in which you cannot apply a regular checkpoint, for example, if the object whose properties you want to check is not stored in an object repository. You can then write the results of the check to the Test Results report.

For example, suppose you want to check the run-time value of a Web button. You can use the GetROProperty or Exist methods to retrieve the run-time value of an object or to verify whether the object exists at that point in the run session.

The following examples illustrate how to use programmatic descriptions to check whether the Continue Web button is disabled during a run session.

Using the GetROProperty method:

ActualDisabledVal = Browser(micClass:="Browser").Page(micClass:="Page").WebButton(alt:=Continue").GetROProperty("disabled")

Using the Exist method:

While Not Browser(micClass:="Browser").Page(micClass:="Page").WebButton(alt:=Continue").Exist(30)


By adding Report.ReportEvent statements, you can instruct QuickTest to send the results of a check to the Test Results.

If ActualDisabledVal = True Then

Reporter.ReportEvent micPass, "CheckContinueButton = PASS", "The Continue button is disabled, as expected."


Reporter.ReportEvent micFail, "CheckContinueButton = FAIL", "The Continue button is enabled, even though it should be disabled."

You can also create and use user-defined functions to check whether your application is functioning as expected. The following example illustrates a function that checks whether an object is disabled and returns True if the object is disabled:

'@Description Checks whether the specified test object is disabled

'@Documentation Check whether the is enabled.

Public Function VerifyDisabled (obj)

       Dim enable_property

       ' Get the disabled property from the test object

       enable_property = obj.GetROProperty("disabled")

       If enable_property = 1 Then ' The value is True (1)—the object is disabled

              Reporter.ReportEvent micPass, "VerifyDisabled Succeeded", "The test object is disabled, as expected."

              VerifyDisabled = True


              Reporter.ReportEvent micFail, "VerifyDisabled Failed", "The test object is enabled, although it should be disabled."

              VerifyDisabled = False

       End If

End Function 

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量