Qtp 简明教程
QTP - CheckPoints
如名称所述,检查点是指将当前值指定属性或对象的当前状态与预期值相比较的验证点,可以插入到脚本中的任何时间点。
Checkpoints, as the name says it all, refer to a validation point that compares the current value of specified properties or current state of an object with the expected value, which can be inserted at any point of time in the script.
Types of Checkpoints
Sr.No. |
Type & Description |
1 |
Standard Checkpoint Verifies the property values of an object in application under test and supported by all add-in environments. |
2 |
Bitmap Checkpoint Verifies an area of your application as a bitmap |
3 |
File Content Checkpoint Verifies the text in a dynamically generated or accessed file such as .txt,.pdf |
4 |
Table Checkpoint Verifies the information within a table. Not all environments are supported. |
5 |
Text Checkpoint Verify if the text that is displayed within a defined area in a Windows-based application, according to specified criteria. |
6 |
Text Area Checkpoint Verifies if the text string is displayed within a defined area in a Windows-based application, according to specified criteria. |
7 |
Accessibility Checkpoint Verifies the page and reports the areas of the Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines |
8 |
Page Checkpoint Verifies the characteristics of a Web page. It can also check for broken links. |
9 |
Database Checkpoint Verifies the contents of a database accessed by the application under test. |
10 |
XML Checkpoint Verifies the content of the .xml documents or .xml documents in Web pages and frames. |
Inserting CheckPoint
当用户想要插入一个检查点时,必须确保在录制期间仅支持大多数检查点。一旦用户停止录制,检查点将不可用。
When the user wants to insert a checkpoint, one has to ensure that most of the checkpoints are supported during the recording sessions only. Once the user stops recording, checkpoints are not enabled.
以下是在非录制模式下,检查点菜单。
Given below is the checkpoint menu, when the user is NOT in the recording mode.
以下是在录制模式下,检查点菜单。
Given below is the checkpoint menu, when the user is in the recording mode.
Example
可为测试应用程序添加检查点 — “http://easycalculation.com/”
The checkpoints are added for the application under test - "http://easycalculation.com/"
' 1. Inserted Standard Checkpoint
Status = Browser("Math Calculator").Page("Math
Calculator").Link("Numbers").Check CheckPoint("Numbers")
If Status Then
print "Checkpoint Passed"
Else
Print "Checkpoint Failed"
End if
' 2. Inserted BitMap Checkpoint
imgchkpoint = Browser("Math Calculator").Page("Math
Calculator").Image("French").Check CheckPoint("French")
If imgchkpoint Then
print "Checkpoint Passed"
Else
Print "Checkpoint Failed"
End if
Viewing Checkpoint Properties
插入后,如果测试人员想要更改值,可以通过右键单击脚本中的关键字“检查点”并导航到“检查点属性”以进行更改,如下所示 −
After inserting, in case a tester want to change the values, we can do so by right clicking on the keyword 'checkpoint' of the script and navigating to "Checkpoint Properties" as shown below −
您还可以在对象储存库中找到相同的检查点,如下所示。它准确显示了使用哪种类型的检查点、期望值和超时值。
You can locate the same checkpoints in object repository, as well, as shown below. It exactly shows what type of checkpoint is used and what are the expected values, and time out values.