New to Telerik Test Studio? Download free 30-day trial

Add External Data Source To Your Test Project

Test Studio supports multiple external data types to be used as a source for data driven testing. In this article you can find a list of the supported data files and how to reference these in a Test Studio project.

If you have already added an external data source to your project, follow this link and check how to bind this data source to a test.

Add an Excel Spreadsheet

In the below section you can read how to prepare the Excel file and add it to the Test Studio project.

Prepare the Excel File

Note

When preparing the Excel data sheet, consider that the first row of the Excel spreadsheet is used to define the column names when binding data to the steps.

Excel

In the above example, Input A is the name of the first column, Input B is the name of the second column, and Results is the name of the third column. You use these names when attaching the columns to the input values of the test steps.

Tip

For numeric-only fields, you may need to add an apostrophe, also known as a single quote character ( ' ), to the beginning of the number for the data to render correctly in Test Studio. This is an Excel command to store the number as text.

Add the Excel File to Project

Click the Add button in the Data Sources section of the Project tab to open the Create new data source dialog.

add-data-source

Ensure the selected type of file is the Excel. Then enter the path to the prepared Excel file, or click the three dots button ("...") to browse and select it from your local disk. Click the Create button to save this data source definition in the project.

Create new data source

Tip

Check what options there are to limit the rows used from the Excel sheet to data drive a test.

Add an XML File

In the below section you can read how to prepare the XML file and add it to the Test Studio project.

Prepare the XML File

XML files are type of documents that both humans and machines can read. The structure of the document is defined by tags and Test Studio uses these to define the data source values. Here is an example of a basic XML file with two columns:

<Searches>
   <Search UserName="john.smith" Password="johnspass" />
   <Search UserName="bob.brown" Password="bobspass" />
   <Search UserName="sam.jones" Password="samspass" />
</Searches>

Search is the equivalent of an Excel Sheet. UserName and Password translate as the column names.

Add the XML File to Project

Click the Add button in the Data Sources section of the Project tab to open the Create new data source dialog.

Bind XML file

Ensure the selected type of file is the XML. Then enter the path to the prepared XML file, or click the three dots button ("...") to browse and select it from your local disk. Click the Create button to save this data source definition in the project.

Add a CSV File

In the below section you can read how to prepare the CSV file and add it to the Test Studio project.

Prepare the CSV File

CSV files can be created in any spreadsheet application or directly in Notepad if you follow the *.csv formatting conventions - each line with comma separated values, the same number of commas in each line. Here is an example of a basic CSV file with two columns:

CSV file

Just like an Excel spreadsheet, the first row of data will be used to define the column names - UserName and Password.

Add the CSV File to Project

Click the Add button in the Data Sources section of the Project tab to open the Create new data source dialog.

Bind CSV file

Ensure the selected type of file is the CSV. Then enter the path to the prepared CSV file, or click the three dots button ("...") to browse and select it from your local disk. Click the Create button to save this data source definition in the project.

Add a Database Source

Adding a database source requires additional details compared to adding an Excel spreadsheet, CSV, or XML file. When you select Database in the Create new data source dialog, you have a number of new options, which you need to specify in order to define your database connection.

  • Provider - select which database provider to use to access your database. The list, that is displayed in this drop-down, depends on which providers have been installed on your computer. If you are not sure what to select, you can contact your database administrator.
  • Connection String - enter a valid connection string that is supplied to the selected Provider. The connection string instructs the provider the details on how to connect to your database.
  • Test - click this button to test the connection to your database. A dialog indicating success will display if the connection is established.
  • Friendly Name - enter a name to represent this database connection definition. The name entered here is displayed in the Manage Data Sources window.

Database source

Tip

Find examples for How to connect to a SQL Database and How to connect to an Oracle Database.

In this article
Not finding the help you need? Improve this article