Date post: | 04-Apr-2018 |
Category: |
Documents |
Upload: | krishna-keshav |
View: | 216 times |
Download: | 0 times |
of 18
7/29/2019 QTP-PPT-DAY3-CHAP1
1/18
2008, Cognizant Technology Solutions. All Rights Reserved.The information contained herein is subject to change without notice. Testing ServicesTesting Services
QTP Training
7/29/2019 QTP-PPT-DAY3-CHAP1
2/18
Database Checkpoints
7/29/2019 QTP-PPT-DAY3-CHAP1
3/18
Objectives
After completing this chapter, you will be
able to:
Understanding Database checkpoint
CreatingaDatabaseCheckpoint Importing Data from a Database
Modifying Database checkpoint
Parameterize Expected Data
7/29/2019 QTP-PPT-DAY3-CHAP1
4/18
Database checkpointsUnderstanding Database checkpoints
Database Checkpoint checks the contents of a database accessed byYour application.
To do this, you define a query on your database. Then you create a
Database checkpoint that checks the results of the query.
You can define a database query in the following ways:
Using Microsoft Query. You can install Microsoft Query from the custominstallation of Microsoft Office.
By manually defining an SQL statement.
You create a database checkpoint based on the results of the query
(result set) you defined on a database. You can create a check on adatabase to check the contents of the entire result set, or a part of it.
Quick Test captures the current data from the database, saves this
information as expected data, and inserts a database checkpoint into
the test.
7/29/2019 QTP-PPT-DAY3-CHAP1
5/18
5
Database Checkpoints
DATABASE OBJECTIVES
7/29/2019 QTP-PPT-DAY3-CHAP1
6/18
Database checkpoints
Creating a Database Checkpoint
1 . Choose Insert > Checkpoint > Database Checkpoint
The Database Query Wizard opens.
2 . Select your database selection preferences and click Next. You can choosefrom the following options:
CreatequeryusingMicrosoftQueryOpens Microsoft Query,enabling you to create a new query. Once you finish defining your
query, you return to QuickTest. This option is available only if you have
Microsoft Query installed on your computer.
7/29/2019 QTP-PPT-DAY3-CHAP1
7/18
Database checkpoints
Specify SQL statement manuallyOpens the Specify SQL statement
screen in the wizard, which enables you to specify the connection stringand an SQL statement.
Maximum number of rowsSelect this check box if you would like tolimit the number of rows and enter the maximum number of database rows
to check or output. You can specify a maximum of 32,000 rows.
Show me how to use Microsoft QueryDisplays an instruction screen
when you click Next before opening Microsoft Query. (Enabled only whenCreate query using Microsoft Query is selected).
7/29/2019 QTP-PPT-DAY3-CHAP1
8/18
Database checkpoints
3. If you chose Create query using Microsoft Query in the previous step,Microsoft Query opens. Choose a data source and define a query.
If you chose Specify SQL statement in the previous step, the Specify SQL
statement screen opens. Specify the connection string and the SQL statement,
and click Finish.
4. The Checkpoint Properties dialog box opens. Select the checks to perform on
the result set. You can also modify the
expected data in the result set.
5. Click OK to close the dialog box. A checkpoint or output value statement is
added for the selected object in the Keyword View and Expert View.
7/29/2019 QTP-PPT-DAY3-CHAP1
9/18
Database checkpoints
Importing Data from a Database
You can import data from a database by selecting a query from
Microsoft Query or by manually specifying an SQL statement.
You can install Microsoft Query from the custom installation option
of Microsoft Office.
Note: Contrary to importing an Excel file (File > Import From
File), existing data in the Data Table is not replaced when you
import data from a database. If the database you import contains
a column with the same name as an existing column, the database
column is added as a new column with the column name followed
by a sequential number. For example, if your Data Table already
contains a column called departures, a database column by the
same name would be inserted into the Data Table as departures1.
7/29/2019 QTP-PPT-DAY3-CHAP1
10/18
Databasecheckpoints
To import data from a database:1. Right-click on the Data Table sheet to which you want to import the data
and select Sheet > Import > From Database. The Database Query
Wizard opens.
7/29/2019 QTP-PPT-DAY3-CHAP1
11/18
Database checkpoints
2.Select your database selection preferences and click Next. You can choose
from the following options:
Create query using Microsoft QueryOpens Microsoft Query,enabling you to create a new query. Once you finish defining your
query, you exit back to QuickTest. This option is only available if you
have Microsoft Query installed on your computer.
Specify SQL statement manually
Opens the Specify SQLstatement screen in the wizard, which enables you to specify theconnection string and an SQL statement.
Maximum number of rowsSelect this check box and enter themaximum number of database rows to import. You can specify a
maximum of 32,000 rows. Show me how to use Microsoft QueryDisplays an instruction
screen before opening Microsoft Query when you click Next. (Enabledonly when Create query using Microsoft Query is selected).
7/29/2019 QTP-PPT-DAY3-CHAP1
12/18
Database checkpoints
3 . If you chose Create query using Microsoft Query in the previous step,
Microsoft Query opens. Choose a data source and define a query.
If you chose Specify SQL statement manually in the previous step, the
following screen opens:
Specify the connection string and the SQL statement and click Finish.
Connection string
Enter the connection string or click Create to openthe ODBC Select Data Source dialog box. You can select a .dsn file in the
ODBC Select Data Source dialog box or create a new .dsn file to have it
insert the connection string in the box for you.
SQL statementEnter the SQL statement.
4 . QuickTest takes several seconds to capture the database query and
restore the QuickTest window. The resulting data from the database query
is displayed in the Data Table.
7/29/2019 QTP-PPT-DAY3-CHAP1
13/18
Modifying a Database CheckpointModify SQL Query
You can modify the SQL query definition and the expected data in an
existing database checkpoint.
To modify the SQL query definition:
1 . In the Keyword View, right-click the database object that you want to
modify.
2 . Select Object Properties.
3 . Modify the SQL and connection string properties as necessary and click OK.Modify Expected Data
To modify the expected data in a database checkpoint:
1 . In the Keyword View or Expert View, right-click the database checkpoint
that you want to modify and select Checkpoint Properties. Alternatively,
select the step containing the checkpoint and choose Edit > Step Properties
> Checkpoint Properties. The Database Checkpoint Properties dialog box
opens.
2 . Modify the settings
Database checkpoints
7/29/2019 QTP-PPT-DAY3-CHAP1
14/18
Database checkpoints
Parameterize Expected Data
The Database Checkpoint Properties dialog box enables you to specify which
cell contents of your database to check and which verification method and type
to use. You can also edit or parameterize the expected data for the cells
included in the check.
7/29/2019 QTP-PPT-DAY3-CHAP1
15/18
You can modify the value of a cell or you can parameterize it to use a
Value from an external source, such as the Data Table or an environment
variable.
To modify or parameterize several cells in the result set,
Select a cell
Set your preferences for that cell in the Expected Data tab.
Repeat the process for each cell you want to modify.
Database checkpoints
7/29/2019 QTP-PPT-DAY3-CHAP1
16/18
You can modify the value of a cell or you can parameterize it to use a
Value from an external source, such as the Data Table or an environment
variable.
To modify or parameterize several cells in the result set,
Select a cell
Set your preferences for that cell in the Expected Data tab.
Repeat the process for each cell you want to modify.
Database checkpoints
7/29/2019 QTP-PPT-DAY3-CHAP1
17/18
17
Manipulating a Query forParameterization
7/29/2019 QTP-PPT-DAY3-CHAP1
18/18
2008, Cognizant Technology Solutions. All Rights Reserved.The information contained herein is subject to change without notice.
Thank you
Testing ServicesTesting Services