Using an absolute path or a deployment item
In many of our plugins file names need to be specified, used for reading data from those files into the plugin during test runs (like test data, certificates, etc). Theese files also need to be available to the agents in order for the plugin to work. There are 2 major solutions to make the file accessable to the plugin on the agent.
The file is on the local file system on each agent or a shared network drive with the exact same path (i.e. same drive letter and absolute/unc path like c:\certs\cert.p12 or //servername/share/path/users.csv)
The file is deployed automatically to all participating agents using the built in deployment features of VS Before the test starts and put in the temporary test run folder on each agent. Only the filename is entered using no path or drive letter (i.e like cert.p12 or users.csv).
The second option is in most cases preferred since the file can be added to the solution, updated in VS and automatically copied and updated to all agents currently in ready state on the controller test rig. If the file is to be version controlled by an SCM like GIT or TFS the second option makes this possible if the file is also added to the solution as an existing item.
The first option is preferred if the files content need to be diffrent on each agent, and required to be independent from the files in the solution, and the auto split per agent feature that is available in some plugins does not suffice.
Using deployment items
Two steps are involved.
Step 1: Adding the file to the solution
This step is optional and not required, however recommended. A warning will be displayed later if files are added as deployment items that are outside of the solution.
Here we added the file in a Testdata folder in the Test Project in the Solution. Right click on the Testdata folder and choose "Add -> Existing Item...". The file will be copied into the solution folder (not linked).
Step 2: Adding the file as an deployment item in your test settings
If you use several testsetting files for diffrent controllers, make sure to use the correct one and activate it. You can find your testsettings files under in Solution Explorer under Solution -> Solution Items and you activate one from the menu "Load Test -> Select Active Test Setting" or by right clicking a testsettings file and choose "Active Load and Web Test Settings".
Add the files (or the entire Testdata directory) in the testsettings file for your test rig under Deployment and click Apply
The specified files will now be automatically deployed (copied) to each agent each time the test is started (during the normal deployment process of the tests to be run). If you add a directory (in this case \TestProject1\Testdata) instead of the individual files, all files when running the test in this directory will be automatically deployed to all agents (without using the Testdata directory as a sub directory). This way, when adding new files to be deployed, the testsettings file needs not to be amended with the new files, the files only need to be put into the Testdata directory in the solutions project.