How to access files on the system under test executes the test cases on a remote system (System Under Test - SUT). This means that the test case code does not have access directly to the file system of the SUT. To be able to work with files on the SUT, such as uploading files in the tested application, supports working with remote directories that allow access to files required for the test execution. These remote directories are provided automatically when executing through the API or portal. Supporting Files that are provided for the test case in the portal are available in the path from SystemHelpers.SupportingFilesDirectory, the software executable for a software version in SystemHelpers.InstallerDirectory and files generated during the test exeuction should be copied to SystemHelpers.ArtifactsDirectory so that they can be accessed from the test report in the portal.

In order to test and debug the interactions with these remote directories also when executing from the Designer, it is possible to configure a remote directory on the Test Environment in the Designer. The simplest way to set this up, is to configure a local shared folder on the system under test by following these steps:

  1. Create a new folder "RemoteDirectory" (eg in C:\Temp)

  2. From the contextmenu of the folder go to the "Properties"

  3. In the Sharing tab, click Share and then in the Network access dialog again Share. This will create a shared folder that you can also access over the network.

  4. Enter the Network Path (e.g. \MYPCNAME\RemoteDirectory) that is displayed in the Sharing tab as the remote directory for the test environment in the Designer.

  5. Place the files you need during test execution in the subfolder "SupportingFiles" of the RemoteDirectory folder

Now you can execute the SystemHelpers.SetUpRemoteDirectory(); method once, which will map the newly created shared folder to the R:\ drive of your SUT and ensure the files are accesible from e.g. SystemHelpers.SupportingFilesDirectory.

If the SetupRemoteDirectory was already executed by the installation test case, you don't need to call it from the test case again.

Code example to upload or open a file:

You can find another example in our Demo Project on Github where we use it in TC002 Teststep 5.

var dialog = new FileDialog(t, App.SystemHelpers);
// Replace MyScreen.UploadButton with the correpsonding button from your sw model:
dialog.SetFileName(App.SystemHelpers.SupportingFilesDirectory + "MyFile.txt");

And for downloading a file from a webapplication:

// Replace MyScreen.FileDownload with the correpsonding button from your sw model:
App.Browser.DownloadAndSaveFileAs(App.SystemHelpers.ArtifactsDirectory + "MyFile.txt");

Last updated