fbpx

Courses Offered: Java, Python, Selenium, AWS, Salesforce, DevOps, Angular

Usage of .properties files in Selenium

Table of Contents

Introduction of .properties file

A .properties file, distinguished by its .properties extension, is a text-based file structure. In this file format, each entry is stored as a key-value pair, with the key and value separated by an equal sign and each pair written on a separate line.

These files primarily serve to store configurations or data, including strings utilized for Internationalization and localization purposes. To handle .properties files in Java, the Properties class from the java.util package is utilized. This class, a legacy from JDK 1.0, inherits behavior from the Hashtable class, which is thread-safe and used within the Map interface of the Collection Framework.

Syntax:
key = value

Example:
testerName = Pradip
browser = Firefox
url = www.jbktutorials.com/
username = kiran@gmail.com
password = 12345

 

Uses :

.properties files are extensively employed in Data-driven testing, a software testing approach involving the execution of identical steps with various sets of data. This method facilitates sourcing test data or output values from external data files, promoting flexibility and avoiding hardcoding. Consequently, it aids in maintaining a clear distinction between test scripts and data, enabling the execution of the same test scripts with multiple sets of input data and their corresponding expected results.

.properties files play a pivotal role in testing by segregating configurable parameters and settings from the codebase. This isolation empowers testers to modify values within the file without necessitating changes in the source code. Such files typically contain key-value pairs, encompassing details such as URLs, database configurations, environmental settings, and other constants essential in testing procedures. This separation streamlines test management, making it adaptable across various testing environments.

 

Summary :

These files offer versatility, facilitating manageability and reusability in the testing process, allowing testers to configure and manage different aspects of their tests without directly altering the codebase.

Our Campus Drive

Subscribe to Us on YouTube

Get daily updates on:
  • Technical
  • Interview 
  • Upcoming Campus 
  • Job-Related Fairs

Are you looking for a better job?
Talk to our Career Expert Now !


Recommended Videos

Request a Callback

For any Queries? Talk to our Experts
+918888809416

Available 24x7 to answer your queries

Enquiry Now

Register Now