简体   繁体   中英

Visual Studio 2013 Coded UI, Test Lab, remote testing, Test agent configuration

Using Visual Studio C# Coded UI Automation, I am trying to configure Test Agent to execute my automated test cases remotely. The test cases use .csv files to validate data. I saved all the .csv files on the remote machine and updated the QTAgentService.exe.config with the correct “WorkingDirectory” value (path). Now, the test case passes the first time I execute it, but it deletes all the .csv files from the “WorkingDirectory” when it is done execution. What should I do to have the .csv files not deleted at every execution or is there another way to use the saved .csv files when testing remotely?

You should add the .csv file to your project and set it to copy if newer/copy always. And add the following attribute to your existing [TestMethod] :

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", 
"|DataDirectory|\\data.csv", "data#csv", DataAccessMethod.Sequential),
DeploymentItem("data.csv"), TestMethod]

Ofcourse changing the filename to your own. This will deploy the file when building and set the context to that file regardless of the location of the deployment.

This won't fix your issue with the deletion, but it will make sure you always have the .csv file available.

Source.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM