Project Data Values File

The Project Data Values File is a standard Java properties file that defines global values used throughout the project. It follows the key=value format and utilizes dot notation to organize data hierarchically. This structure ensures consistency across test cases by centralizing commonly used values in a single location.

Because these values are global, they apply to the entire project, allowing for greater flexibility and maintainability. Test cases can reference these values dynamically, reducing redundancy and making updates easier.

This file plays a crucial role in maintaining test reliability and simplifying configuration management. Below, we’ll break down its format and key sections.

# Data Values File
# Contains all the seed values / defaults for the web site
#
# Project Name: swaglabs
#
# data settings
# project.page.section=Data Value
# Page title
swaglabs.pagetitle.homepage=Swag Labs
# Login Users
swaglabs.login.standarduser=standard_user
swaglabs.login.lockedoutuser=locked_out_user
swaglabs.login.problemuser=problem_user
swaglabs.login.performanceglitchuser=performace_glitch_user
swaglabs.login.userpassword=secret_sauce
swaglabs.login.errormessage=Epic sadface: Sorry, this user has been locked out.
# Sort Options
swaglabs.sortvalue.atoz=az
swaglabs.sortvalue.ztoa=za
swaglabs.sortvalue.pricelow=lohi
swaglabs.sortvalue.pricehigh=hilo
swaglabs.sorttext.atoz=Name (A to Z)
swaglabs.sorttext.ztoa=Name (Z to A)
swaglabs.sorttext.pricelow=Price (low to high)
swaglabs.sorttext.pricehigh=Price (high to low)
# Banner page titles
swaglabs.banner.products=Products
swaglabs.banner.shoppingcart=Your Cart
swaglabs.banner.checkout=Checkout: Your Information
swaglabs.banner.checkoutoverview=Checkout: Overview
swaglabs.banner.checkoutcompete=Checkout: Complete!
# product names swaglabs.products.backpack=Sauce Labs Backpack swaglabs.products.bikelight=Sauce Labs Bike Light swaglabs.products.tshirt=Sauce Labs Bolt T-Shirt swaglabs.products.jacket=Sauce Labs Fleece Jacket swaglabs.products.onesie=Sauce Labs Onesie swaglabs.products.tshirtred=Test.allTheThings() T-Shirt (Red)

Key Structure and Usage

The Project Data Values File follows a structured dot notation format to organize key-value pairs efficiently. The format follows this pattern:

project.page_or_section.item=value

Key Components

  • Project – Represents the project name, which may also be the website under test.
  • Page or Section – Defines a specific page (e.g., login, checkout) or a section within a page (e.g., pageheader, mainmenu).
  • Item – The actual data element associated with the page or section.

Example

mywebsite.login.username_field=id_user
mywebsite.login.password_field=id_pass
mywebsite.pageheader.logo_xpath=//div[@class='logo']

Why Use This Format?

  • No Hardcoded Values – Test cases reference keys instead of hardcoded values, making maintenance easier.
  • Simplifies Updates – If a value changes (e.g., an element ID or XPath), it only needs to be updated in one place.
  • Enhances Readability & Organization – Keeps project-wide settings structured and easy to manage.

This approach ensures flexibility and scalability, making automation frameworks more maintainable as projects evolve.