This document discusses automating tests using Selenium and interacting with Excel data. It provides an example test scenario that 1) browses to a website, 2) finds and selects reservation items, 3) fills in flight information from an Excel sheet, 4) finds and clicks a button, and 5) repeats for all test data in the Excel sheet. It also lists prerequisites for the test automation and provides code snippets for initializing drivers and Excel objects, reading from Excel, and cleaning up after the test.
2. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
AUTOMATION TEST SCENARIO:
1. Automation shall browse to Delta Airlines main web page via
https://www.delta.com
2. Finds Item «One Way» reservation and selects it.
3. Fills up the following flight information from an external excel data sheet;
I. FROM
II. TO
III. DEPART DATE
4. Finds Item «Find Flights» button and clicks on it.
5. Repeat step-1 to step-4 for the test data stored in an excel sheet below
3. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
This video tutorial is NOT prepared for introductory purpose. We assume that
audiences have already had background on Selenium and C# technologies.
Before we move forward, please make sure you have below pre-requisites which
have been downloaded and installed into your development environment.
Selenium Web Driver (version >3.0.0)
Chrome Web Driver (one of the latest versions suitable for your operating
system)
Internet Explorer Driver (one of the latest versions suitable for your operating
system)
NUnit Framework (any version greater than 2.6.4)
NUnit Test Adapter (version 2.x for NUnit framework >= 2.x)
Let’s get started.
4. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
Include all necessary assemblies
into your class file.
Define Excel spread sheet
objects to work with.
Define two integer fields for
holding number of rows and columns
used in excel.
5. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
Initialize your driver and catchErrors objects.
Initialize excel workbook, worksheet,
range objects. In workbook object,
make sure your excel file is located in
a valid directory (i.e. C:UsersFile.xlsx).
Finally, set your row and count
variables
to respected count values from Excel
Range object.
6. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
Include this block of codes in your test method.
7. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
Create you Tear Down method to make sure all drivers closed, shutted-down and all excell
processes and events are released/closed.
Let Garbage Collection collects all non-used objects.
8. Turgay Koklu
Founder, Principle Consultant
K-Tech Solutions Inc.
E: turgay.koklu@kokluteknoloji.com
P: (+90) 532 442 5210 Istanbul-TURKEY
Build and run your test!!