I would like to get the path (in the context of the file system) to which the current test project belongs.
This is doable with a coded solution. Create a coded step inside of a test:
This will store the current project path inside the string variable currentProjectFolder. The actual path string can be, for example:
- C:\Users\smith\Documents\Test Studio Projects\TestProject1
- C:\MySampleProject\TestResults\smith_Smith 2011-11-21 12_56_51\Out
You might also want to get the path of the data source files attached to your test project. When a project contains a data source, it's stored in Project Folder\Data. For instance, your test might be data bound to an Excel file by the name of excelSample.xlsx. This file will be stored under Project Folder\Data\excelSample.xlsx. Here's how to get this path in code:
string dataSourcePath = this.ExecutionContext.DeploymentDirectory + @"\Data\excelSample.xlsx";
Dim dataSourcePath As String = Me.ExecutionContext.DeploymentDirectory + "\Data\excelSample.xlsx"
It's still possible to edit or replace it from that location in a coded step. This will work even if the test is data bound to the file in question.