STM-Lab Manual
STM-Lab Manual
Vision
To develop competent and socially responsible engineers in the
domain of Artificial Intelligence & Machine Learning for noteworthy
contributions to the society.
Mission
To educate the students in fundamental principles of computing
and develop the skills needed to solve practical problems using
contemporary computer-based technologies.
Graduates will have the ability to adapt, contribute and innovate new systems in the key domains of
PEO1
Artificial Intelligence and Machine Learning.
PEO2 Graduates will have the ability to pursue higher education in reputed institutions with AI Specialization.
Graduates will be ethically and socially responsible solution providers and entrepreneurs in the field of
PEO3
Computer Science and Engineering with AI&ML Specialization.
Engineering Knowledge: Apply the knowledge of Mathematics, Science, Engineering fundamentals, and
P01
an engineering specialization to the solution of complex engineering problems.
P02 Problem Analysis: Identify, formulate, research literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of Mathematics, Natural Sciences, and
Engineering Sciences.
Design/Development of Solutions: Design solutions for complex engineering problems and design
PO3 system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
Conduct Investigations of Complex Problems: Use research-based knowledge and research methods
PO4 including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and modern
PO5 engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
The Engineer and Society: Apply reasoning informed by the contextual knowledge to assess societal,
PO6 health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
Environment and Sustainability: Understand the impact of the professional engineering solutions in
PO7 societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development
Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
PO8
engineering practice
Individual and Team Work: Function effectively as an individual, and as a member or leader in diverse
PO9
teams, and in multidisciplinary settings.
Project Management and Finance: Demonstrate knowledge and understanding of the engineering and
PO11 management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
Life-long Learning: Recognize the need for, and have the preparation and ability to engage in
PO12
independent and life-long learning in the broadest context of technological change.
Apply the fundamental Knowledge for problem analysis and conduct investigations in Artificial
PSO1
Intelligence and Machine Learning for sustainable development
Design and development of solutions by using modern software for the purpose of execution of the
PSO2
projects in specialized areas.
PSO3 Inculcate effective communication and ethics for lifelong learning with social awareness
Prerequisites:
1. A course on “Java programming”.
Course Objectives:
1. Understand knowledge of Software Testing Methods.
2. Develop skills in software test automation and management using latest tools.
List of Experiments:
1. Recording in context sensitive mode and analog mode
2. GUI checkpoint for single property
3. GUI checkpoint for single object/window
4. GUI checkpoint for multiple objects
5. a) Bitmap checkpoint for object/window
a) Bitmap checkpoint for screen area
6. Database checkpoint for Default check
7. Database checkpoint for custom check
8. Database checkpoint for run time record check
9. a) Data driven test for dynamic test data submission
b) Data driven test through flat files
c) Data driven test through front grids
d) Data driven test through excel test
10. a) Batch testing without parameter passing b)
Batch testing with parameter passing
11. Data driven batch
12. Silent mode test execution without any interruption
13. Test case for calculator in windows application
Use Context Sensitive mode to test your application by operating on its user
interface.
To record a test in context sensitive mode:
1. Choose Test > Record–Context Sensitive or click the Record–Context Sensitive button.
The letters Rec are displayed in dark blue text with a light blue background on
the Record button to indicate that a context sensitive record session is active.
2. Perform the test as planned using the keyboard and mouse.
Insert checkpoints and synchronization points as needed by choosing the appropriate commands
from the User toolbar or from the Insert menu menu: GUI Checkpoint, Bitmap Checkpoint,
Database Checkpoint, or Synchronization Point.
3. To stop recording, click Test > Stop Recording or click Stop.
EXPERIMENT 2
GUI CHECKPOINT FOR SINGLE PROPERTY
You can check a single property of a GUI object. For example, you can check whether a button
is enabled or disabled or whether an item in a list is selected. To create a GUI checkpoint for a
property value, use the Check Property dialog box to add one of the following functions to the test
script: button_check_info scroll_check_info
edit_check_info static_check_info
list_check_info win_check_info
obj_check_info
To create a GUI checkpoint for a property value:
1. Choose Insert > GUI Checkpoint > For Single Property. If you are recording in Analog mode, press the
CHECK GUI FOR SINGLE PROPERTY softkey in order to avoid extraneous mouse
movements.
The WinRunner window is minimized, the mouse pointer becomes a pointing hand, and a help window opens
on the screen.
2. Click an object.
The Check Property dialog box opens and shows the default function for the selected object.
WinRunner automatically assigns argument values to the function.
1. Click an object name in the Objects pane. The Properties pane lists all the properties for the
selected object.
2. Select the properties you want to check.
o 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 to edit it.
o To add a check in which you specify arguments, first select the property for which you want to
specify arguments. Next, either click the Specify Arguments button, or double-click in the Arguments
column. Note that if an ellipsis (three dots) appears in the Arguments column, then you must specify
arguments for a check on this property. (You do not need to specify arguments if a default argument
are specified.) When checking standard objects, you only specify arguments for certain properties of
edit and static text objects. You also specify arguments for checks on certain properties of nonstandard
objects.
o To change the viewing options for the properties of an object, use the Show Properties buttons.
3. Click OK to close the Check GUI dialog box.
Win Runner captures the GUI information and stores it in the test’s expected results folder. The
Win Runner window is restored and a GUI checkpoint is inserted in the test script as
an obj_check_gui or a win_check_gui statement. For more information, see “Understanding GUI
Checkpoint Statements”.
EXPERIMENT 4
GUI checkpoint for multiple objects
You can use a GUI checkpoint to check two or more objects in a window. For a complete list
of standard objects and the properties you can check, see “Property Checks and Default Checks”.
To create a GUI checkpoint for two or more objects:
1. Choose Insert > GUI Checkpoint > For Multiple Objects or click the GUI Checkpoint
for Multiple Objects button on the User toolbar. If you are recording in Analog mode, press the
CHECK GUI FOR MULTIPLE OBJECTS softkey in order to avoid extraneous mouse
movements. The Create GUI Checkpoint dialog box opens.
2. Click the Add button. The mouse pointer becomes a pointing hand and a help window opens.
3. To add an object, click it once. If you click a window title bar or menu bar, a help window
prompts you to check all the objects in the window.
4. The pointing hand remains active. You can continue to choose objects by repeating step 3
above for each object you want to check.
5. Click the right mouse button to stop the selection process and to restore the mouse pointer to
its original shape. The Create GUI Checkpoint dialog box reopens.
6. The Objects pane contains the name of the window and objects included in the GUI checkpoint.
To specify which objects to check, click an object name in the Objects pane.
The Properties pane lists all the properties of the object. The default properties are selected.
o 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 to edit it.
o To add a check in which you specify arguments, first select the property for which you want to
specify arguments. Next, either click the Specify Arguments button, or double-click in
the Arguments column. Note that if an ellipsis appears in the Arguments column, then you
mustspecify arguments for a check on this property. (You do not need to specify arguments if a
default argument is specified.) When checking standard objects, you only specify arguments
for certain properties of edit and static text objects.You also specify arguments for
checks on certain properties of nonstandard objects.
o To change the viewing options for the properties of an object, use the Show Properties buttons.
7. To save the checklist and close the Create GUI Checkpoint dialog box, click OK.
WinRunner captures the current property values of the selected GUI objects and stores it in
the expected results folder. A win_check_gui statement is inserted in the test script.
EXPERIMENT 5
A. Bitmap checkpoint for object/window
You can capture a bitmap of any window or object in your application by pointing to it. The
method for capturing objects and for capturing windows is identical. You start by choosing Insert
> Bitmap Checkpoint > For Object/Window. As you pass the mouse pointer over the windows of
your application, objects and windows flash. To capture a window bitmap, you click the
window’s title bar. To capture an object within a window as a bitmap, you click the object itself.
Note that during recording, when you capture an object in a window that is not the active
window, WinRunner automatically generates a set_window statement.
To capture a window or object as a bitmap:
● Choose Insert > Bitmap Checkpoint > For Object/Window or click the Bitmap
Checkpoint for Object/Window button on the User toolbar. Alternatively, if you are
recording in Analog mode, press the CHECK BITMAP OF OBJECT/WINDOW softkey.
The WinRunner window is minimized, the mouse pointer becomes a pointing hand, and a
help window opens.
● Point to the object or window and click it. WinRunner captures the bitmap and
generates a win_check_bitmap or obj_check_bitmap statement in the script.
The TSL statement generated for a window bitmap has the following syntax:
win_check_bitmap ( object, bitmap, time
); For an object bitmap, the syntax is:
obj_check_bitmap ( object, bitmap, time
);
For example, when you click the title bar of the main window of the Flight Reservation
application, the resulting statement might be:
win_check_bitmap ("Flight Reservation", "Img2", 1);
However, if you click the Date of Flight box in the same window, the statement might be:
obj_check_bitmap ("Date of Flight:", "Img1", 1);
● Text before: Displays the text that appears immediately before the text to
check. (Displayed only when the Select text from a Web page check box is
checked.)
● Text after: Displays the text that appears immediately after the text to check.
(Displayed only when the Select text from a Web page check box is selected.)
27
● Select text from a Web page: Enables you to indicate the text on your Web page containing
the value to be verified.
The Matching Record Criteria screen enables you to specify the number of matching database
records required for a successful checkpoint.
● Exactly one matching record: Sets the checkpoint to succeed if exactly one matching
database record is found.
● One or more matching records: Sets the checkpoint to succeed if one or more matching
database records are found.
● No matching records: Sets the checkpoint to succeed if no matching database records are found.
When you click Finish on the Runtime Record Checkpoint wizard, a db_record_check statement
is inserted into your script.
Comparing Data in Different
Formats
Suppose you want to compare the data in your application to data in the database, but the data is in
different formats. You can follow the instructions below to create a runtime database record
checkpoint without using the Runtime Record Checkpoint Wizard. Note that this feature is
for advanced WinRunner users only.
For example, in the sample Flight Reservation application, there are three radio buttons in the Class
box. When this box is enabled, one of the radio buttons is always selected. In the database of
the
sample Flight Reservation application, there is one field with the values 1, 2, or 3 for the
matching class.
To check that data in the application and the database have the same value, you must
perform the following steps:
1. Record on your application up to the point where you want to verify the data on the screen.
Stop your test. In your test, manually extract the values from your application.
2. Based on the values extracted from your application, calculate the expected values for
the database. Note that in order to perform this step, you must know the mapping relationship
between both sets of values. See the example below.
3. Add these calculated values to any edit field or editor (e.g. Notepad). You need to have one
edit field for each calculated value. For example, you can use multiple Notepad windows, or
another application that has multiple edit fields.
4. Use the GUI Map Editor to teach WinRunner:
o the controls in your application that contain the values to check
o the edit fields that will be used for the calculated values
5. Add TSL statements to your test script to perform the following operations:
o extract the values from your application
o calculate the expected database values based on the values extracted from your application
o write these expected values to the edit fields
6. Use the Runtime Record Checkpoint wizard, described in “Using the Runtime Record Checkpoint
Wizard,” to create a db_record_check statement.
When prompted, instead of pointing to your application control with the desired value, point to
the edit field where you entered the desired calculated value.
Example of Comparing Different Data Formats in a Runtime Database Record Checkpoint
The following excerpts from a script are used to check the Class field in the database against the
radio buttons in the sample Flights application. The steps refer to the instructions.
step 1
1
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.
For a Content check on a r esult 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.
8. Click OK to close the Check Database dialog box.WinRunner captures the current property values and
stores them in the test’s exp folder. WinRunner stores the database query in the test’s chklist folder. A
database checkpoint is inserted in the test
Now add a DataSource TestStep and select the DataSource type “Directory” from the dropdown
in the toolbar. You should now have:
32
Now, select the directory where your input files are stored, add an applicable filter (e.g. “*.txt”
or
“*.xml” for text or XML files respectively), and potentially
encoding.
Now click on the icon from the screen below and enter a property that will contain the
content of each file
Quick tip: If your property is named “Filename” it will contain the name of the file instead of
file’s
contents.
2. Create Test Steps
Now you need to add a Test Request to your TestCase which you will use to test the Web Service.
Press the SOAP Request button in the TestCase editor and select the ConversionRate operation in
the CurrencyConverterSoap Interface.
33
Press OK in all dialogs. A SOAP Request Step will be added to the TestCase and the editor for
the request is opened. Switch to the XML editor (if not already there):
Now, I’m operating under the assumption that you have a fully built request in each of the files
in your directory.
An example of an input file would be:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://www.webserviceX.NET/">
<soapenv:Header/>
<soapenv:Body>
<web:ConversionRate>
<web:FromCurrency>SEK</web:FromCurrency>
<web:ToCurrency>USD</web:ToCurrency>
</web:ConversionRate>
</soapenv:Body>
</soapenv:Envelope>
34
So, based on that, remove all the content in the XML tab, right-click and select the path to your
DataSource property:
35
3. Add DataSource Loop
As a final step, we just need to iterate through all the files in our DataSource. So in your
TestCase, add a DataSource loop step, and double click it to configure as in the picture below:
Click OK.
4. That’s it
Now if you click on the icon in the test case window, you can see the whole test run
through each file:
36
C. Data driven test through excel test
Data-driven testing (DDT) is taking a test, parameterizing it and then running that test with varying
data. This allows you to run the same test case with many varying inputs, therefore
increasing coverage from a single test. In addition to increasing test coverage, data driven testing
allows the ability to build both positive and negative test cases into a single test. Data-driven
testing allows you to test the form with a different set of input values to be sure that the application
works as expected.
It is convenient to keep data for automated tests in special storages that support sequential access to
a set of data, for example, Excel sheets, database tables, arrays, and so on. Often data is stored either
in a text file and are separated by commas or in Excel files and are presented as a table. If you
need to add more data, you simply modify the file either in any text editor or in Microsoft Excel (in
case of hard-coded values, you should modify both data and code).
Data-driven test includes the following operations performed in a
loop:
• Retrieving input data from
storage
• Entering data in an application
form
• Verifying the
results
• Continuing with the next set of input
data
Pre-requisites:
1. Java JDK 1.5 or above
2. Apache POI library v3.8 or above
3. Eclipse 3.2 above
4. Selenium server-standalone-
2.47.x.jar
5. TestNG-6.9
Data Excel
Scenario -Open the application and login with different username and password. This data will
be coming from excel sheet
Step 1: The first and the foremost step is to create the test data with which we would be executing
the test scripts. Download JAR files of Apache POI and Add Jars to your project library. Let us
create an excel file and save it as “Credentials.xlsx” and place it in the created package location.
We will use the data excel file and the file looks as
below
37
Step 2: Create a POM class file under com.coe.pom name it as “Loginpage.java”. Inside a login
page we write code to identify the webelements of login page using @FindBy annotation. To
initialize the web elements we use initelements of page factory class. We utilize the element s by
writing a method to it.
Step 3: Create a ‘New Class‘file, by right click on the package com.coe.script and select New
> Class and name it as “SuperClass.java”, and create a new class file with a name
“ValidLoginLogout.java”.
Step 4: Create some test data in excel that we will pass to script. For demo purpose I have taken
username and password in excel.
Step 5: Copy and paste the below mentioned code under com.coe.pom package
class.
38
EXPERIMENT 10
A. Batch testing without parameter passing
A batch test is a test script that calls other tests. You program a batch test by typing call statements
directly into the test window and selecting the Run in batch mode option in the Run category of
the General Options dialog box before you execute the test.
A batch test may include programming elements such as loops and decisionmaking statements.
Loops enable a batch test to run called tests a specified number of times. Decision-making
statements such
as if/else and switch condition test execution on the results of a test called previously by the
same batch script. See “Enhancing Your Test Scripts with Programming,” for more
information.
For example, the following batch test executes three tests in succession, then loops back and calls
the tests again. The loop specifies that the batch test should call the tests ten times.
for (i=0; i<10; i+
+)
{
call "c:\\pbtests\\open" ();
call "c:\\pbtests\\setup" ();
call "c:\\pbtests\\save" ();
}
To enable a batch test:
1. Choose Tools > General Options.
The General Options dialog box opens.
2. Click the Run category.
3. Select the Run in batch mode check box.
Running a Batch Test:You execute a batch test in the same way that you execute a regular test.
Choose a mode (Verify, Update, or Debug) from the list on the toolbar and choose Test > Run
from Top. See “Understanding Test Runs,” for more information.
When you run a batch test, WinRunner opens and executes each called test. All messages
are suppressed so that the tests are run without interruption. If you run the batch test in Verify
mode, the current test results are compared to the expected test results saved earlier. If you are
running the batch test in order to update expected results, new expected results are created in the
expected results folder
39
for each test. See “Storing Batch Test Results” below for more information. When the batch test
run is completed, you can view the test results in the Test Results window.
Note that if your tests contain TSL texit statements, WinRunner interprets these statements
differently for a batch test run than for a regular test run. During a regular test run, texit
terminates test execution. During a batch test run, texit halts execution of the current test only
and control is
returned to the batch
test.
40
EXPERIMENT 11
Data driven batch
When you test your application, you may want to check how it performs the same operations with
multiple sets of data. For example, suppose you want to check how your application responds to ten
separate sets of data. You could record ten separate tests, each with its own set of data.
Alternatively, you could create a data-driven test with a loop that runs ten times. In each of the ten
iterations, the test is driven by a different set of data. In order for WinRunner to use data to drive
the test, you must substitute fixed values in the test with parameters. The parameters in the test are
linked with data stored in a data table. You can create data-driven tests using the DataDriver wizard
or by manually adding data-driven statements to your test scripts.
For non-data-driven tests, the testing process is performed in three steps: creating a test; running the
test; analyzing test results. When you create a data-driven test, you perform an extra two-part step
between creating the test and running it: converting the test to a data-driven test and creating a
corresponding data table.
The following diagram outlines the stages of the data-driven testing process in
WinRunner:
41
EXPERIMENT 12
Silent mode test execution without any interruption
1 Silent Mode to continue test execution without any interruption, we can use this run setting.
1 Navigation Click Tools menu → Choose General options→ Select Run Tab → Select Run in batch mode
(Figure III . 18 . 1 ) − Click ... NOTE In silent mode , WinRunner is not able to execute tester
interactive statements .
42
EXPERIMENT 13
Test case for calculator in windows application
43
Functionality Test Cases
● Check the addition of two integer numbers.
● Check the addition of two negative numbers.
● Check the addition of one positive and one negative number.
● Check the subtraction of two integer numbers.
● Check the subtraction of two negative numbers.
● Check the subtraction of one negative and one positive number.
● Check the multiplication of two integer numbers.
● Check the multiplication of two negative numbers.
● Check the multiplication of one negative and one positive number.
● Check the division of two integer numbers.
● Check the division of two negative numbers.
● Check the division of one positive number and one integer number.
● Check the division of a number by zero.
● Check the division of a number by negative number.
● Check the division of zero by any number.
● Check if the functionality using BODMAS/BIDMAS works as expected.
44