开发者

How to copy a reference file to an agent system in TFS 2010?

开发者 https://www.devze.com 2023-03-13 15:46 出处:网络
I want to copy a file which has the verified results to the system having agent so that I can compare it with actual runtime data and create a result file. If bot开发者_如何学JAVAh the file contents a

I want to copy a file which has the verified results to the system having agent so that I can compare it with actual runtime data and create a result file. If bot开发者_如何学JAVAh the file contents are same then the result is pass else it is fail.


I believe you're looking for the DeploymentItem attribute. You decorate your TestMethod with it like this:

[TestMethod]
[DeploymentItem("testFile1.txt")]
public void ConstructorTest()
{
    // Create the file to deploy
    Car.CarInfo();
    string file = "testFile1.txt";
    // Check if the created file exists in the deployment directory
    Assert.IsTrue(File.Exists(file), "deployment failed: " + file +
    " did not get deployed");
}

You'll also want to include the file (testFile1.txt) in your build somehow, so that the binary is dropped next to your test binary. I usually just include the file in the solution, and then mark "Copy to Output Directory" as "Copy if newer" in the properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消