How to access files on the system under test
Last updated
Last updated
TestResults.io 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, TestResults.io 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 TestResults.io 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:
Create a new folder "RemoteDirectory" (eg in C:\Temp)
From the contextmenu of the folder go to the "Properties"
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.
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.
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:
And for downloading a file from a webapplication:
Another Example can be found in TestCase 007 TestStep 1: