SmartestQADocs
TR EN
DATA-DRIVEN

Datasource

Connect external data sources to your tests. Create data-driven tests using API, Excel/CSV and Database data.

Overview

Datasource allows you to pull data from external sources for use in your tests. Define a datasource and use it in your testcase with the ${variable} syntax.

Excel / CSV

Read data from spreadsheet files

Static

Database

Pull from database with SQL queries

JDBC

How It Works

1. Create Datasource

API, Excel or DB

2. Link to Testcase

Select datasource

3. Use Variables

${column_name}

4. Iteration

Run for each row

Excel / CSV Datasource

Load test data from Excel (.xlsx, .xls) or CSV files. Ideal for data-driven testing.

Page Layout

Navigate to Datasource page and click the Excel/CSV tab. The page has two sections:

Left Panel - Excel Files List

Displays all previously uploaded Excel/CSV files. Click on any file name to view or edit its details.

Excel Files x

login_test_data
user_credentials
form_validation_data
Right Panel - Upload & Edit

The main content area where you upload and configure Excel/CSV files.

Excel DataSource

Upload Excel Description

Click to select a file

Supported: XLSX, XLS, CSV

File Name
Save Delete

How to Upload a File

  1. 1 Go to Datasource page and click the Excel/CSV tab
  2. 2 In the upload area, click "Select File" or drag and drop your file (XLSX, XLS or CSV)
  3. 3 Enter a File Name to identify the datasource
  4. 4 Check the "Header" checkbox if the first row of your file contains column headers
  5. 5 Click "Save" to upload and store the file

Header Option

When the Header checkbox is enabled, the first row of the file is used as column names. These column names become the variable names you can use in your tests with ${column_name} syntax.

Header enabled (first row = column names)

username password expected
admin@test.com Admin123! success
user@test.com User456! success

Use as: ${username}, ${password}

Header disabled (auto-generated column names)

col_0 col_1 col_2
username password expected
admin@test.com Admin123! success

Use as: ${col_0}, ${col_1}

Managing Files

View / Edit

Click a file name in the left panel to view or update its details

Delete

Select a file and click the Delete button to remove it

Supported Formats

.xlsx

Excel 2007+

.xls

Excel 97-2003

.csv

Comma Separated

Database Datasource (JDBC)

Define your database connection via JDBC. This section only configures connection settings; to run SQL queries, use the Database (JDBC) step inside your testcase.

Page Layout

Top Tabs

Simple DB Excel/CSV

Left Panel

DB Configurations list and add new connection button ()

Right Panel

Database Connection form — enter connection details

Connection Form (Database Connection)

Fill in the following fields:

1

Name

A name to identify this connection

2

Database Url

JDBC connection URL

3

JDBC Driver Class

Driver class for your database type

4

Username

Database username

5

Password

Database password

Action Buttons

Test Connection

Test the connection

Save

Save the connection

Delete

Delete the connection

Example JDBC URLs

# PostgreSQL
jdbc:postgresql://localhost:5432/mydb
# MySQL
jdbc:mysql://localhost:3306/mydb
# SQL Server
jdbc:sqlserver://localhost:1433;databaseName=mydb
# Oracle
jdbc:oracle:thin:@localhost:1521:mydb

Note: This page is only for defining database connections. To run SQL queries, use the Database (JDBC) step inside your testcase.

Usage in Tests

After linking the datasource to the testcase, use column names in the ${column_name} format.

1. Linking Datasource to Testcase

On the testcase detail page, find the Datasource dropdown in the right panel and select the datasource you created.

Datasource:

2. Using Variables

Type Action - Email field

${username}

→ Different email typed on each iteration

Type Action - Password field

${password}

→ Different password typed on each iteration

3. Iteration Example

When test is run with a 3-row Excel datasource:

Iter 1 Type "admin@test.com" → Type "Admin123!" → ✓ success
Iter 2 Type "user@test.com" → Type "User456!" → ✓ success
Iter 3 Type "invalid@test.com" → Type "wrong" → ✗ error (expected)

Variable Syntax Reference

Basic Usage

${column_name}

Uses the datasource column value

Combined with Global Param

${base_url}/users/${user_id}

Combines global and datasource variables

Usage in Assertions

Expected: ${expected_result}

Expected value comes from datasource

Usage in API Steps

{"email": "${email}", "name": "${name}"}

Variables inside JSON body

Best Practices

Meaningful Column Names

Use descriptive names like username, password, expected instead of a, b, c.

Separate Test Data

Use separate datasources or an expected_result column for positive and negative cases.

Environment for Sensitive Data

Store sensitive data like passwords as environment variables, not in datasources.

Too Many Rows

Use 10-50 rows covering meaningful test scenarios instead of 1000+ rows.

Direct Connection to Production DB

Do not connect to production databases; use staging or test DB instead.

Hardcoded Credentials

Do not write API tokens or DB passwords directly; use Global Parameters.