STM - Lab - Manul III Cse II Sem
STM - Lab - Manul III Cse II Sem
Objective:
Describes the benefits of automated testing
Understand the WinRunner testing process
Work with WinRunner user interface
Theory:
Understanding the Testing Process
The WinRunner testing process consists of 6 main phases:
6 Reporting defects
If you have the TestDirector 7.0i, the Web Defect Manager (TestDirector 6.0), or the Remote
Defect Reporter (TestDirector 6.0), you can report any defects to a database. The Web
Defect Manager and the Remote Defect Reporter are included in TestDirector, Mercury
Interactive’s software test management tool.
To start WinRunner:
Choose Programs > WinRunner > WinRunner on the Start menu.
The first time you start WinRunner, the Welcome to WinRunner window
opens. From the welcome window you can create a new test, open an
existing test, or view an overview of WinRunner in your default browser.
The first time you select one of these options, the WinRunner main screen opens with the
“What’s New in WinRunner” section of the help file on top. If you do not want the welcome
window to appear the next time you start WinRunner, clear the Show on startup check box.
Each test you create or run is displayed by WinRunner in a test window. You can open
many tests at one time.
The User toolbar displays the tools you frequently use to create test scripts.
By default, the User toolbar is hidden.
To display the User toolbar choose Window > User Toolbar. When you
create tests, you can minimize the WinRunner window and work exclusively
from the toolbar.
Theory:
Context Sensitive
Context Sensitive mode records your operations in terms of the GUI objects in your
application. WinRunner identifies each object you click (such as a window, menu, list, or
button), and the type of operation you perform (such as press, enable, move, or select).
For example, if you record a mouse click on the OK button in the Flight Reservation
Login window, WinRunner records the following TSL statement in your test script:
button_press ("OK");
When you run the script, WinRunner reads the command, looks for the
OK button, and presses it.
When choosing a record mode, consider the following points
1 Start WinRunner.
2 Open a new test.
3 Start the Flight Reservation application and log in.
4 Start recording in Context Sensitive mode.
5 Open order #3.
6 Stop recording.
7 Save the test.
In this exercise you will test the process of sending a fax. You will start recording in Context
Sensitive mode, switch to Analog mode in order to add a signature to the fax, and then
switch back to Context Sensitive mode
You are now ready to run your recorded test script and to analyze the test results.
WinRunner provides three modes for running tests. You select a mode from the toolbar.
Use Verify mode when running a test to check the behavior of
your application, and when you want to save the test results.
Use Debug mode when you want to check that the test script runs
smoothly without errors in syntax. See Lesson 7 for more information.
Use Update mode when you want to create new expected results for a
GUI checkpoint or bitmap checkpoint.
1 Check that WinRunner and the main window of the Flight Reservation
application are open onyour desktop.
2 Make sure that the saved test window is active in WinRunner.
3 Make sure the main window of the Flight Reservation application is active.
4 Make sure that Verify mode is selected in the toolbar.
5 Choose Run from Top.
Choose Run > Run from Top or click the Run from Top button. The Run Test
Conclusion:-
WinRunner Results - H:\Program Files\Mercury
Interactive\WinRunner\tmp\noname14
============================================================
========================
Expected results folder: H:\Program Files\Mercury
Interactive\WinRunner\tmp\noname14\exp
Test Results Name: H:\Program Files\Mercury
Interactive\WinRunner\tmp\noname14\res1
Operator Name:
Date: Tue Mar 17 12:00:21 2015
Summary:
Test Result: OK
Total number of bitmap checks: 0
Total number of GUI checks: 0
Total Run Time: 00:00:04
Detailed Results Description
Line Event Result Details Time
Test Result: OK
Total number of bitmap checks: 0
Total number of GUI checks: 0
Total Run Time: 00:00:04
Detailed Results Description
Line Event Result Details Time
When working with an application, you can determine whether it is functioning properly
according to the behavior of its GUI objects. If a GUI object does not respond to input as
expected, a defect probably exists somewhere in the application’s code. You check GUI
objects by creating GUI checkpoints. A GUI checkpoint examines the behavior of an object’s
properties.
For example, you can check: the content of a field whether a radio button is on or
off whether a pushbutton is enabled or disable
Conclusion
Test Result: OK
Total number of bitmap checks: 0
Total number of GUI checks: 3
Total Run Time: 00:00:02
Detailed Results Description
Line Event Result Details Time
Theory:
If your application contains bitmap areas, such as drawings or graphs, you can check
these areas using a bitmap checkpoint. A bitmap checkpoint compares captured bitmap
images pixel by pixel.
Conclusion:
WinRunner Results - H:\Documents and Settings\JNEC-12\Desktop\bit
======================================================================
===
Expected results folder: H:\Documents and Settings\JNEC-
12\Desktop\bit\exp Test Results Name: H:\Documents and
Settings\JNEC-12\Desktop\bit\res3 Operator Name:
Date: Tue Mar 17 11:44:42 2015
Summary:
Test Result: OK
Total number of bitmap
checks: 2 Total number of
GUI checks: 0 Total Run
Time: 00:00:38 Detailed
Results Description Line
Event Result Details Time
When you create a default check on a database, you create a standard database checkpoint
that checks the entire result set using the following criteria:
The default check for a multiple-column query on a database is a case sensitive check on
the entire result set by column name and row index.
The default check for a single-column query on a database is a case sensitive check on the
entire result set by row position.
If you want to check only part of the contents of a result set, edit the expected value of the contents,
or count the number of rows or columns, you should create a custom check instead of a default
check. For information on creating a custom check on a database, see “Creating a Custom Check on
a Database,”
WinRunner captures the data specified by the query and stores it in the test’s exp folder.
WinRunner creates the msqr*.sql query file and stores it and the database checklist in the test’s
chklist folder. A database checkpoint is inserted in the test script as a db_check statement.
Creating a Default Check on a Database Using Data Junction
You can create a default check on a database using Data Junction.
When you create a custom check on a database, you create a standard database checkpoint in
which you can specify which properties to check on a result set.
6. WinRunner takes several seconds to capture the database query and restore the
WinRunner window.
The Objects pane contains “Database check” and the name of the *.sql query file or *.djs
conversion file included in the database checkpoint. The Properties pane lists the different types
of checks that can be performed on the result set. A check mark indicates that the item is
selected and is included in the checkpoint.
7. Select the types of checks to perform on the database. You can perform the following
checks: ColumnsCount: Counts the number of columns in the result set.
Content: Checks the content of the result set, as described in “Creating a Default Check on a
Database,”
RowsCount: Counts the number of rows in the result set.
If you want to edit the expected value of a property, first select it. Next, either click the Edit
Expected Value button, or double-click the value in the Expected Value column.
o For ColumnsCount or RowCount checks on a result set, the expected value is displayed in the
Expected Value field corresponding to the property check. When you edit the expected
value for these property checks, a spin box opens. Modify the number that appears in the
spin box.
o For a Content check on a result set, <complex value> appears in the Expected Value field
corresponding to the check, since the content of the result set is too complex to be displayed
in this column. When you edit the expected value, the Edit Check dialog box opens. In
the Select Checks tab, you can select which checks to perform on the result set, based on
the data captured in the query. In the Edit Expected Data tab, you can modify the expected
results of the data in the result set.
You can make changes to a checklist you created for a runtime database record checkpoint. Note
that a checklist includes the connection string to the database, the SQL statement or a query, the
database fields in the data source, the controls in your application, and the mapping between
them. It does not include the success conditions of a runtime database record checkpoint.
o For a database field previously included in the checklist, the database field is displayed along
with the application control to which it is mapped. You can use the pointing hand to map the
displayed field name to a different application control or text string in a Web page.
o If you modified the SQL statement or query in Microsoft Query so that it now references
an additional database field in the data source, the checklist will now include a new
database field. You must match this database field to an application control. Use the
pointing hand to identify the control or text that matches the displayed field name.
4. Click Next to continue.
o The Finished screen is displayed.
5. Click Finish to modify the checklist used in the runtime record checkpoint(s).
Theory:
Once you have successfully debugged and run your test, you may want to see how the same test
performs with multiple sets of data. To do this, you convert your test to a data-driven test and
create a corresponding data table with the sets of data you want to test.Converting your test to a
data-driven test involves the following steps:
Adding statements to your script that open and close the data table.
Adding statements and functions to your test so that it will read from the data table and run in
a loop while it applies each set of data.
Replacing fixed values in recorded statements and checkpoint statements with parameters,
known as parameterizing the test.You can convert your test to a data-driven test using the
DataDriver Wizard or you can modify your scriptmanually. When you run your data-driven test,
WinRunner runs the parameterized part(s) of the test one time (called an iteration) for each set
of data in the data table, and then displays the results for all of the iterations in a single Test
Results window.
In Lesson 7 you created a test that opened a specific flight order and read the number of tickets,
price per ticket, and total price from a fax order dialog box in order to check that the total price
was correct. In this lesson you will create a test that performs the same check on several flight
orders in order to check that your application computes the correct price for various quantities
and prices of tickets.
1 Create a new test from the test experiment 6.
2 Run the DataDriver Wizard.
3 Create a data table for the test.
4 Assign a table variable name.
5 Select global parameterization options.
6 Select the data to parameterize.
7 Open the data table.
8 Add data to the table.
9 Save and close the table.
10Save the test.
11Locate the Fax Order window in the flight1a.gui GUI map file.
12 Modify the window label with a regular expression.
13 Close the Modify dialog box.
14 Modify the tl_step statements.
Locate the first tl_step statement in your script. Delete the words “total is
Conclusion
Test Batch Runner enables you to run tests in a collective, successive test run.
In this topic:
Start the Test Batch Runner from the Start menu, or from the following path:
<UFT One installation folder/bin/UFT OneBatchRunner.exe.
Tip: Once open, if you are using a concurrent license, select Test > Close UFT One after
Test Run to close UFT One and release the license once the test run is complete.
Back to top
Tip: You can include or exclude a test in your batch list from running during a particular batch
run without affecting the other tests in the batch.
Add a test batch a. Select File > Add or click the Add button .
file (.mtb)
b. Navigate to the folder in which the batch file is saved.
Add individual
1. Select Tests > Add or click the Add button .
tests
2. In the Browse For Folder dialog box, select the folder
in which your tests are located.
Note: When adding tests through the Tests > Add menu command, you must select all the
tests from the target folder.
If you do not want to run all the tests in the target folder, select the check boxes next to the tests you
want to run before you run the test batch.
Back to top
The Output pane allows you view the results of the test run in run time, including:
In the Command Line window, enter UFTBatchRunnerCMD.exe and the source switch
followed by the test batch file (.mtb) or folder containing the test.
For example, your command line might contain text like this:
Note: Passing test parameters is supported for running single tests only, and not for all tests in
a folder.
To run a test batch using a Runtime Engine license only, with UFT One on hidden mode, add the -
visible N parameter to your command line.
For example:
This file includes details about whether the test passed or failed and errors in running the test.
In the Tests pane, click the results link for a specific test in the Report column.
1 Create a new test from the lesson7 test and load the GUI map.
If WinRunner is not already open, choose Start > Programs > WinRunner >
WinRunner. If the Welcome window is open, click the Open Test button. Otherwise,
choose File > Open and select the test you created in Lesson 7. The lesson7 test opens.
Choose File > Save As and save the test as lesson8 in a convenient location on your
hard drive.
If you are working in the Global GUI Map File mode, confirm that the GUI map is loaded.
To do this, choose Tools > GUI Map Editor. In the GUI Map Editor choose View > GUI
Files and confirm that flight4a.GUI is contained in the GUI File list.
Excel table with this name and saves it in the test folder.
3 Assign a table variable name.
Accept the default table variable name, table.
At the beginning of a data-driven test, the Microsoft Excel data table you
wish to use is assigned as the value of the table variable. Throughout the
script, only the table variable name is used. This makes it easy for you to
assign a different data table to the script at a later time without making
changes throughout the script.
4 Select global parameterization options.
Select Add statements to create a data-driven test. This adds TSL
statements to the test that define the table variable name, open and close the
data table, and run the appropriate script selection in a loop for each row in the
data table.
Select Parameterize the test and choose the Line by line option. When
you select Parameterize the test, you instruct WinRunner to find fixed values in
recorded statements and selected checkpoints and to replace them with
parameters. The Line by line option instructs the wizard to open a screen for
each line of the selected test that can be parameterized so that you can choose
whether or not to parameterize that line.
Click Next.
In this test you are going to open a different fax order in each iteration and
the Order Number radio button must be selected each time. Thus, for this
script line, keep the selection, Do not replace this data, and click Next.
The next line by line screen refers to the Order Number box. This is the box
you want to change for each iteration. Note that the value “3” is highlighted and
listed in the Argument to be replaced box to indicate that this is the value
selected for parameterization.
Select A new column under Replace the selected value with data from: and type
Order_Num in the adjacent box. The new column option creates a column titled
Order_Num in the lesson8.xls table, and enters the value 3 in the first row of the column.
FYI:
The following elements are added or modified in your parameterized test:
The table = line defines the table variable.
The ddt_open statement opens the table, and the subsequent lines confirm that
the data-driven test opens successfully.
The ddt_get_row_count statement checks how many rows are in the table, and therefore,
how many iterations of the parameterized section of the test to perform.
The for statement sets up the iteration loop.
The ddt_set_row statement tells the test which row of the table to use on each iteration.
In the edit_set statement, the value, “3” is replaced with a ddt_val
statement.
The ddt_close statement closes the table.
In the flight application, the name of the Fax Order window changes to
reflect the fax order number. If you run the test as it is, the test will fail on
the second iteration, because the Flight Application will open a window
In this exercise you will use a regular expression in the physical description of
the Fax Order window so that WinRunner can ignore variations in the
window’s label.
1 Locate the Fax Order window in the flight4a.GUI GUI map file.
Choose Tools > GUI Map Editor. Choose View > GUI Files. Select flight4a.GUI in
the GUI file box. Select the Fax Order No. 3 window icon.
2 Modify the window label with a regular expression.
Select Modify. The Modify window opens. In the Physical Description
label line, add an ! immediately following the opening quotes to indicate that
this is a regular expression. Delete the space and the number 3 at the end of
the line and replace this text with * to indicate that the text following this
phrase can vary.
Note that the tl_step event is listed five times and that the details for each
iteration include the actual number of tickets, price and total cost that was
checked.
6 Close the test results.
Choose File > Exit to close the Test Results window.
7 Close the Flight Reservation application.
Choose File > Exit.
Mode
Must be one of the following:
-Install
Commands the installation program to run in interactive (GUI) mode.
-SilentInstall
Commands the installation program to run in silent mode.
-SilentUninstall
Commands the installation program to uninstall the product in silent mode.
-Uninstall
Commands the installation program to uninstall the product in interactive (GUI) mode.
Notes:
If you specify the -Uninstall or -SilentUnInstall argument, the installation program
will ignore the other command-line arguments and uninstall TestExecute.
Options
The following arguments are optional. If the argument value includes spaces, enclose it in
double quotes. For example:
-log="C:\my install files"
-Log=Log_Path
Saves the installation log to the specified folder. For example:
-log=C:\source
If the folder name is omitted, the log will be saved to the folder where the installation
package resides:
-log
-InstallPath=Application_Path
TestExecute is installed into the specified folder.
-ExternalData=Data_Path
TestExecute is installed by using the specified external installation package (.exe).
-CleanUp
TestExecute and all its features are removed from the computer and the installation information
is removed from the Programs and Features feature of Windows. Use it if the ordinary
uninstallation has failed to remove all product files from the computer.
Modules
-IntelligentQuality, -Desktop, -Web, -Mobile
The specified modules and add-ons will be installed and activated.
By installing the Intelligent Quality add-on in silent mode, you confirm that you consent to
the third-party terms of use.
If a module or add-on is not specified as an argument parameter, it will not be installed. For
example, the Desktop and Mobile modules will be installed, but the Web module and the add-
ons will be skipped:
<path_to_installation_package>\TestExecute1490_Release.exe -SilentInstall -Desktop -Mobile
The Desktop module and the Intelligent Quality add-on will be installed, but the Web and
Mobile modules will be skipped: