【问题标题】:How to use Specflow srsprofile in mstest runsettings如何在 mstest 运行设置中使用 Specflow srsprofile
【发布时间】:2021-02-25 11:02:37
【问题描述】:

我的一个项目使用规范流 + MSTest + MSBuildGeneration 工具。我在我的 srsprofile 中定义了几个过滤器标签,并创建了一个类似下面的运行设置文件

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- Configurations that affect the Test Framework -->
  <RunConfiguration>
    <!-- Path relative to solution directory -->
    <!--<ResultsDirectory>..\..\..\Reports\LastRun\</ResultsDirectory>-->

    <!-- [x86] | x64  
      - You can also change it from menu Test, Test Settings, Default Processor Architecture -->
    <TargetPlatform>x86</TargetPlatform>

    <!-- Framework35 | [Framework40] | Framework45 -->
    <TargetFrameworkVersion>Framework46</TargetFrameworkVersion>
  </RunConfiguration>

  <!-- test adapter -->
  <MsTest>
    <Profile>sample.srprofile</Profile>
  </MsTest>
</RunSettings>

UnitTest 提供者

  <specFlow>
    <stepAssemblies>
      <stepAssembly assembly="MyProject.Steps" />
    </stepAssemblies>
    <unitTestProvider name="MsTest" />
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
  </specFlow>

由于我使用的是 MSTest 而不是 SpecRun,因此我认为适配器应该是 MsTest,但是对于定义的过滤器,测试没有显示在 Visual Studio 2017 的测试资源管理器中。我做错了吗?在 srsprofile 中为 mstest 使用过滤器标签是否有不同的方法?

【问题讨论】:

  • specFlow 测试是完全显示,还是现在才显示在指定的过滤器下?
  • SpecFlow 测试显示没有任何测试设置或运行设置。但我不想一次运行所有过滤器标签,我想控制它,我相信这将通过 runsettings 文件来完成,您在其中提供定义过滤器的 srprofile 路径,但我只是不知道一种与 MsTest 一起使用的方法

标签: c# visual-studio mstest specflow runsettings


【解决方案1】:

srProfile- 文件是 SpecFlow+ Runner(又名 SpecRun)的一项功能。它的功能仅在此处可用。您不能将它与 MSTest 一起使用。

据我所知,根本没有办法在runsettings文件中设置过滤器。

它的文档是:https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019


全面披露:我是 SpecFlow 和 SpecFlow+ 的社区经理

【讨论】:

  • 啊!太糟糕了,我可能会尝试将其切换到 SpecRun,谢谢 Andreas
猜你喜欢
  • 2019-12-17
  • 1970-01-01
  • 2015-05-04
  • 1970-01-01
  • 1970-01-01
  • 2017-01-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多