【问题标题】:Test works when debugging using VS, throws System.IO.IOException when using mstest.exe使用 VS 调试时测试有效,使用 mstest.exe 时抛出 System.IO.IOException
【发布时间】:2017-10-05 15:30:29
【问题描述】:

在自动执行回归测试期间,我注意到了一个奇怪的行为。当我使用mstest.exe /test:XYZ /... 执行它们时它们会失败,但是当我在 Visual Studio (2015 Enterprise) 中调试它们时它们工作正常。 原因:

Test method XYZ threw exception: 
System.IO.IOException:  not found as file or resource.

测试创建了一些文件和文件夹,我尝试读取一个新创建的文件。正如我刚刚指出的:如果我使用 Visual Studio 运行测试,它工作正常 - 使用 mstest.exe 时它不起作用。

知道为什么吗?

【问题讨论】:

    标签: testing visual-studio-2015 automated-tests mstest regression-testing


    【解决方案1】:

    MsTest.exe 保留用于向后兼容。你应该使用vstest.console.exe。这通常可以纠正在 IDE 中运行时存在的大多数问题,但不能从 CLI 中解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-28
      • 2020-12-16
      • 1970-01-01
      • 2019-08-02
      • 2012-08-07
      相关资源
      最近更新 更多