简体   繁体   English

Visual Studio 2013编码的UI,测试实验室,远程测试,测试代理配置

[英]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. 使用Visual Studio C#编码的UI自动化,我试图将测试代理配置为远程执行自动化测试用例。 The test cases use .csv files to validate data. 测试用例使用.csv文件来验证数据。 I saved all the .csv files on the remote machine and updated the QTAgentService.exe.config with the correct “WorkingDirectory” value (path). 我将所有.csv文件保存在远程计算机上,并使用正确的“ WorkingDirectory”值(路径)更新了QTAgentService.exe.config。 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. 现在,该测试用例在我第一次执行时通过,但是在完成执行后,它会从“ WorkingDirectory”中删除所有.csv文件。 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? 我应该怎么做才能在每次执行时不删除.csv文件,或者在进行远程测试时还有另一种使用保存的.csv文件的方法吗?

You should add the .csv file to your project and set it to copy if newer/copy always. 您应该将.csv文件添加到您的项目中,并将其设置为如果总是较新/复制总是要复制。 And add the following attribute to your existing [TestMethod] : 并将以下属性添加到您现有的[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. 这无法解决删除问题,但可以确保始终提供.csv文件。

Source. 资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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