【问题标题】:Failed to get the file for deployment item while run test case in MTM在 MTM 中运行测试用例时获取部署项文件失败
【发布时间】:2016-12-01 09:29:43
【问题描述】:

我们在代码中部署xml文件,语句如下:

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\Scripts\\SmokeTestSuite2016Q1\\TestData\\RPSmokeTestData.xml", "SM_Test_012",DataAccessMethod.Sequential),DeploymentItem("RPSmokeTestData.xml"), TestMethod]

在本地运行良好,但即使在运行时我们收到如下警告:

Test Run deployment issue: Failed to get the file for deployment item 'RPSmokeTestData.xml': System.IO.FileNotFoundException: Could not find file 'D:\Automation\xxx\bin\Debug\RPSmokeTestData.xml'.



Warning: Test Run deployment issue: Failed to get the file for deployment item 'RPSmokeTestData.xml' specified by the test 'xxx.Scripts.SmokeTestSuite2016Q1.SmokeTest.RPSmokeTestUITest.SM_Test_012': System.IO.FileNotFoundException: Could not find file 'D:\Automation\RPSmokeTestData.xml'.



Warning: Test Run deployment issue: The assembly or module 'Microsoft.Practices.ServiceLocation' directly or indirectly referenced by the test container 'd:\automation\xxx\bin\debug\xxx.dll' was not found.

但测试运行成功。

现在我们将代码签入到我们在不同环境中维护的 TFS 服务器并排队构建。

完成构建后,我们尝试从本地机器上的 MTM 运行测试,测试控制器和代理都在本地运行。

  1. 没有 xml 文件的测试用例运行成功,但是如果我们尝试运行需要 xml 文件中的测试数据的测试用例,我们会收到以下错误。

TestOutcome '警告';消息'警告:测试运行部署问题: 无法获取部署项“RPSmokeTestData.xml”的文件 由测试指定 'demo.SmokeTestSuite2016Q1.SmokeTest.SmokeTestUITest2016Q1.SM_Test_004': System.IO.FileNotFoundException:找不到文件 'C:\Users\deepan\AppData\Local\VSEQT\QTController\RPSmokeTestData.xml'.'."

【问题讨论】:

    标签: c# testing tfs automation mtm


    【解决方案1】:

    根据错误信息。看来您正在寻找 .xml 文件的错误位置。

    默认情况下,TFS 构建将构建输出放置在与在 VS 中本地构建时不同的位置

    当您使用 TFS Build 时,它的文件夹结构如下:

    [workspace dir]\Sources\[projectdir]
    [workspace dir]\Binaries\
    

    TFS Build 将构建输出重定向到 Binaries 文件夹。因此,如果您在 C:\Users\deepan\AppData\Local\ 中查找自定义操作,它不会找到它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 2021-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多