C# 单个SpecFlow测试未显示在测试资源管理器中
所以,让我先说一句,我肯定这是我忘记的一件小事,但即使是我的经理也无法解释为什么会发生这种情况。我使用SpecFlow编写了一组测试。我们的结构使用Dto文件、页面对象文件、功能文件和Steps文件。我的设置: VS 2019 VisualStudio扩展的SpecFlow SpecFlow开发室(Visual Studio 2019) 套餐: MongoDB.Bson、.Driver.Driver.Core 2.10.1 Selenium.Firefox.WebDriver 0.26.0 SpecFlow 3.1.78 SpecFlow.Tools.MsBuild.Generation v 3.1.78 xunit.core、.extensibility.core、.extensibility.execution、.runner.visualstudio 2.4.1 除此之外,我可以回答大多数问题,尽管找到答案可能需要时间。昨天,我们更新了.netcore框架,但这本不应该成为问题。这里的问题是,我添加了两个测试组,一个用于银行,一个用于计划设置。我想我的设置是相同的: 首先使用addnewitem>C#Code file创建Dto文件,文件的编写方式相同,可能需要合并,但这既不在这里也不在那里 第二个-使用“添加新项”>“SpecFlow”>“SpecFlow要素文件”创建要素文件,并重命名为“测试名称” 第三个-使用Add New Item>SpecFlow>SpecFlow步骤定义创建步骤文件,并将步骤添加到末尾,重命名为功能的测试名称 第四,编写功能代码并将所有步骤链接到所有步骤定义 第五,建造和祈祷 银行显示,计划设置不显示。如果有必要,我可以附加代码,但我甚至不确定测试是基于什么文件构建的。将在澄清或继续之前等待建议。我宁愿不玩扩展,但如果我必须的话,我会的。我的经理以前从未见过这种情况,并建议做更多的研究 我所做的: 重新生成的要素文件 注释掉所有新代码,只保留已知的旧代码(在不同的测试中)工作 漂洗和重复代码-这是在我们迁移到.net代码之前发生的,所以我不得不重写我所做的很多事情,为什么不呢? 交换扩展-这真的打破了我以前的.net回购协议 这两项测试都是由同一位工程师在同一天编写的,时间间隔不到几个小时。唯一的区别是,更高级的自动化工程师现在不在,所以他没有在设置过程中帮助我,但这也不重要,因为我还必须在迁移后重写银行代码,而且这个代码可以正常工作 提前谢谢 澄清答复: 是的,我写了两个测试——一个显示,一个不显示 feature.cs文件具有相同的顶部部分,但以下是整个文件:C# 单个SpecFlow测试未显示在测试资源管理器中,c#,visual-studio,automated-tests,specflow,C#,Visual Studio,Automated Tests,Specflow,所以,让我先说一句,我肯定这是我忘记的一件小事,但即使是我的经理也无法解释为什么会发生这种情况。我使用SpecFlow编写了一组测试。我们的结构使用Dto文件、页面对象文件、功能文件和Steps文件。我的设置: VS 2019 VisualStudio扩展的SpecFlow SpecFlow开发室(Visual Studio 2019) 套餐: MongoDB.Bson、.Driver.Driver.Core 2.10.1 Selenium.Firefox.WebDriver 0.26.0 Sp
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:3.1.0.0
// SpecFlow Generator Version:3.1.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace Abarca.Tests.UI.SpecFlow.Features.Clients.ClientBenefitSetup
{
using TechTalk.SpecFlow;
using System;
using System.Linq;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.1.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public partial class ClientBenefitSetupBenefitPlanSettingsFeature : object, Xunit.IClassFixture<ClientBenefitSetupBenefitPlanSettingsFeature.FixtureData>, System.IDisposable
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
private string[] _featureTags = ((string[])(null));
private Xunit.Abstractions.ITestOutputHelper _testOutputHelper;
#line 1 "ClientBenefitSetupBenefitPlanSettings.feature"
#line hidden
public ClientBenefitSetupBenefitPlanSettingsFeature(ClientBenefitSetupBenefitPlanSettingsFeature.FixtureData fixtureData, Abarca_Tests_UI_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper)
{
this._testOutputHelper = testOutputHelper;
this.TestInitialize();
}
public static void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new
TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"),
"ClientBenefitSetupBenefitPlanSettings", "\tThis feature tests all
functionalities contained in the Benefit Plan Settings sc" +
"reen under the LOB Section of the Client Benefit Setup.", ProgrammingLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
public static void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
public virtual void TestInitialize()
{
}
public virtual void TestTearDown()
{
testRunner.OnScenarioEnd();
}
public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioInitialize(scenarioInfo);
testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs<Xunit.Abstractions.ITestOutputHelper>(_testOutputHelper);
}
public virtual void ScenarioStart()
{
testRunner.OnScenarioStart();
}
public virtual void ScenarioCleanup()
{
testRunner.CollectScenarioErrors();
}
public virtual void FeatureBackground()
{
#line 4
#line hidden
TechTalk.SpecFlow.Table table169 = new TechTalk.SpecFlow.Table(new string[] {
"attribute",
"value"});
table169.AddRow(new string[] {
"User",
"Automation"});
table169.AddRow(new string[] {
"Password",
"@Abca123"});
table169.AddRow(new string[] {
"UserType",
"Employee"});
#line 5
testRunner.Given("I have successfully logged in to Darwin", ((string)(null)), table169, "Given ");
#line hidden
#line 10
testRunner.And("I access the Client Benefit Setup option in the menu", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table170 = new TechTalk.SpecFlow.Table(new string[] {
"attribute",
"value"});
table170.AddRow(new string[] {
"SearchId",
"abca"});
#line 11
testRunner.And("I filter by the ID column within the Client Benefit Setup List screen", ((string)(null)), table170, "And ");
#line hidden
#line 14
testRunner.And("I press the Edit link for the filtered record within the Client Benefit Setup scr" +
"een", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
#line 15
testRunner.And("I press the Line of Business link within the Clients Edit screen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table171 = new TechTalk.SpecFlow.Table(new string[] {
"attribute",
"value"});
table171.AddRow(new string[] {
"SearchId",
"020"});
#line 16
testRunner.And("I filter by the ID column within the Line Of Business List screen", ((string)(null)), table171, "And ");
#line hidden
#line 19
testRunner.And("I press the Edit link for the filtered record within the Line of Business List sc" +
"reen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
#line 20
testRunner.And("I press the Benefit Plans link within the Line of Business Edit screen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table172 = new TechTalk.SpecFlow.Table(new string[] {
"attribute",
"value"});
table172.AddRow(new string[] {
"SearchId",
"020"});
#line 21
testRunner.And("I filter by the ID column within the Benefit Plans List screen", ((string)(null)), table172, "And ");
#line hidden
#line 24
testRunner.And("I press the Edit link for the filtered record within the Benefit Plans List scree" +
"n", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
#line 25
testRunner.And("I press the Benefit Plan Settings link within the Benefit Plans screen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table173 = new TechTalk.SpecFlow.Table(new string[] {
"attribute",
"value"});
table173.AddRow(new string[] {
"SearchId",
"020"});
#line 26
testRunner.And("I filter by the Name column within the Benefit Plan Settings screen", ((string)(null)), table173, "And ");
#line hidden
#line 29
testRunner.And("I press the Edit link for the filtered record within the Benefit Plans Settings L" +
"ist screen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
}
void System.IDisposable.Dispose()
{
this.TestTearDown();
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.1.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class FixtureData : System.IDisposable
{
public FixtureData()
{
ClientBenefitSetupBenefitPlanSettingsFeature.FeatureSetup();
}
void System.IDisposable.Dispose()
{
ClientBenefitSetupBenefitPlanSettingsFeature.FeatureTearDown();
}
}
}
}
#pragma warning restore
#endregion
//------------------------------------------------------------------------------
//
//此代码由SpecFlow生成(http://www.specflow.org/).
//SpecFlow版本:3.1.0.0
//SpecFlow生成器版本:3.1.0.0
//
//对此文件的更改可能会导致不正确的行为,如果
//重新生成代码。
//
// ------------------------------------------------------------------------------
#区域设计器生成的代码
#pragma警告禁用
命名空间Abarca.Tests.UI.SpecFlow.Features.Clients.ClientBenefitSetup
{
使用TechTalk.SpecFlow;
使用制度;
使用System.Linq;
[System.CodeDom.Compiler.GeneratedCodeAttribute(“TechTalk.SpecFlow”,“3.1.0.0”)]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
公共部分类ClientBenefitSetupBenefitPlanSettings功能:对象,Xunit.IClassFixture,System.IDisposable
{
私有静态TechTalk.SpecFlow.ITestRunner testRunner;
私有字符串[]特征标签=((字符串[])(空));
私有Xunit.Abstractions.ITestOutputHelper\u testOutputHelper;
#第1行“ClientBenefitSetupBenefitPlanSettings.feature”
#隐藏线
公共客户端好处设置好处计划设置功能(客户端好处设置好处计划设置功能.FixtureData FixtureData,Abarca\U测试\U UI\XUnitAssemblyFixture assemblyFixture assemblyFixture,Xunit.Abstracts.IteStoutHelper testOutputHelper)
{
这是._testOutputHelper=testOutputHelper;
这个。TestInitialize();
}
公共静态无效功能设置()
{
testRunner=TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo FeatureInfo=新建
TechTalk.SpecFlow.FeatureInfo(新系统、全球化、文化信息(“美国”),
“ClientBenefitSetupBenefitPlanSettings”,“\t此功能测试所有
“福利计划设置”中包含的功能+
“客户端福利设置的LOB部分下的reen。”,ProgrammingLanguage.CSharp,((字符串[])(null));
testRunner.OnFeatureStart(featureInfo);
}
公共静态无效功能拆卸()
{
testRunner.OnFeatureEnd();
testRunner=null;
}
公共虚拟无效测试初始化()
{
}
公共虚拟void TestTearDown()
{
testRunner.OnScenarioEnd();
}
公共虚拟void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo ScenarioInfo)
{
testRunner.OnScenarioInitialize(场景信息);
testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_TestOutputhHelper);
}
公共虚拟void场景开始()
{
testRunner.OnScenarioStart();
}
公共虚拟void ScenarioCleanup()
{
testRunner.CollectScenarioErrors();
}
公共虚拟void功能背景()
{
#第4行
#隐藏线
TechTalk.SpecFlow.table169=新的TechTalk.SpecFlow.Table(新字符串[]){
“属性”,
“价值”});
表169.AddRow(新字符串[]){
“用户”,
“自动化”};
表169.AddRow(新字符串[]){
“密码”,
“@Abca123”});
表169.AddRow(新字符串[]){
“用户类型”,