Selenium Framework Creation and Accessing Test Data From Excel
Selenium Framework Creation and Accessing Test Data From Excel
Please take a note that we would be adopting Data Driven Test Automation Framework
for the rest of our tutorials.
In the current tutorial in this series, we would make you acquainted with a sample
framework, the Excels which would store the test data and their Excel manipulations.
On the same lines, we would move forward and introduce new strategies and resources to
mature our framework.
So let’s learn:
Framework creation strategy using a sample project
Access the test data stored in the external data source
Moving ahead, we would start with the description of the project hierarchy that we would be
creating in order to segregate the various project components.
Refer the below image for the project hierarchy created for the sample project. The below
java project can be easily created within the eclipse the way we have created the projects in
the earlier tutorials.
What You Will Learn: [show]
CommonMethods
Like Pre and postconditions, there may be methods and functions those can be used by
more than one test script. Thus, these methods are grouped together in a class. The test
script can access these methods using the object of the common class.
#2) excel files – The excel files are considered to be the data source/data providers for test
script execution. These files store the test data into key-value pairs. Make a note that we
create a separate excel sheet for each of the test script i.e. each test script has its own test
data file. The name of the test script and the corresponding test data files/ excel sheet has
been kept same for the traceability perspective. Check out the sample test data format
below:
Test Data Format
Each of the columns represents a key and each of the rows represents a test data/value.
Specify the multiple rows in order to execute the same test script with multiple data sets.
Mark that the test data formats are solely user defined. Thus based on your requirements,
you can customize the test data files.
#3) library – The folder acts as a repository/artifactory for all the required jar files, libraries,
drivers etc to successfully build the test environment and to execute the test scripts. Refer
the following figure to check out the libraries we would be employed within our project.
#4) logs – The folder contains a .txt file that stores the logging information upon each
execution.
#5) test material – The folder contains the actual test data that needs to be uploaded if
any. This folder would come into picture when we come across test scenarios where the
user is required to upload files, documents, pictures, reports etc.
#6) build.xml – The xml file is used by the “Ant Server” to automate the entire build
process.
#7) log4j.xml – This xml file is used by a Java-based utility named as “Log4j” to generate
the execution logs.
Note: We would study more about the logs, user-defined exceptions and Ant in detail in the
upcoming tutorials. So don’t panic if you get confused between the notions.
Now, as we move forward let us understand the phenomenon where we access the
excel files and populate the test data into our test scripts.
In order to comprehend the process easier, we would break down the process into the
following steps.
In order to access the test data stored in the external data source, we used a java based
API – jxl. We also created the sample code for reading and populating the excel data into
the test scripts.
Next Tutorial #22: In the next tutorial, we would base our tutorial on the concepts of
generics and their accessibility mechanism. We would create a few sample generic
methods and then access them within the test scripts. We would also introduce you to the
concept of Testsuite and the sample code development.
Recommended Reading
Introduction to JUnit Framework and Its Usage in Selenium Script – Selenium
Tutorial #11
Data Driven Framework in Selenium WebDriver Using Apache POI
Cucumber Selenium Tutorial: Cucumber Java Selenium WebDriver Integration
Introduction to Selenium WebDriver – Selenium Tutorial #8
In-Depth Eclipse Tutorials For Beginners
How to Use TestNG Framework for Creating Selenium Scripts - TestNG Selenium
Tutorial #12
Efficient Selenium Scripting and Troubleshoot Scenarios – Selenium Tutorial #27
Debugging Selenium Scripts with Logs (Log4j Tutorial) – Selenium Tutorial #26
CategoriesSelenium TutorialsPost navigation
Most Popular Test Automation Frameworks with Pros and Cons of Each – Selenium
Tutorial #20
Creating Generics and Testsuites – Selenium Tutorial #22
63 thoughts on “Selenium Framework Creation and Accessing Test
Data from Excel – Selenium Tutorial #21”
Comment Navigation
← Older Comments
1. manjunath
hi,
i can’t able to inspect button in web application,
i have tried all the locators. can any one pls help me out
Reply
2. Kenjal Gundecha
superb explanation vignesh
Reply
3. Kenjal Gundecha
Could you please share me the code on [email protected]
Reply
4. Vadim
Hi,
[email protected]
Thanks
Vadim
Reply
5. Pulkit Shah
HI, can you share the framework with me ?
Reply
6. Nagarjuna
can you please share me the code [email protected]
Reply
7. Adesh
I need the framework steps like folder structured framework, as where we will write all types
of actions, test cases description, keywords etc., in the excel sheet for ex : keyword driven
framework.
Reply
8. neha
Where should we add the code given in the last step 6
Reply
9. neha
Where should we add the code given in last step 6?
Reply
10. Anupam Dey
Can you provide details for the CRAFT framework with selenium
Reply
11. Sumit Shukla
Please share the code with me
My Mail ID- [email protected]
Reply
12. Priya
could you share the framework with selenium?
Reply
13. Priya Doolapeta
Please send me the code of the framework. Excellent website and explanation thankyou.
Reply
Comment Navigation
← Older Comments
Leave a Comment
Comment
Name Email
Post Comment
About SoftwareTestingHelp
Helping our community since 2006! Most popular portal for Software professionals
with 100 million+ visits! You will absolutely love our tutorials on Software Testing,
Development, Software Reviews and much more!
Join Over 200,000+ Testers
Get premium ebooks and testing tips.
SUBSCRIBE NOW!
Join Over 300,000+ Followers!
Top FREE Training Tutorials