C# SpecFlow查找步骤定义,但不执行它们

C# SpecFlow查找步骤定义,但不执行它们,c#,automated-tests,nunit,specflow,test-framework,C#,Automated Tests,Nunit,Specflow,Test Framework,我正在使用NUnit+SpecFlow+Selenium构建一个测试框架。我有两个项目的解决方案(到目前为止)。在顶层,我有套件框架:PageFactory、DriverFactory、CommonPages等。另一个项目有实际的测试(cucumber)、测试步骤和测试页面。 两个项目都安装了相同的NuGet软件包,第二个项目引用了套件框架 一切似乎都很好:我在框架上有[BeforeTestRun]、[beforetscenario]和[beforetscenario],当我运行测试时,它能够找

我正在使用NUnit+SpecFlow+Selenium构建一个测试框架。我有两个项目的解决方案(到目前为止)。在顶层,我有套件框架:PageFactory、DriverFactory、CommonPages等。另一个项目有实际的测试(cucumber)、测试步骤和测试页面。 两个项目都安装了相同的NuGet软件包,第二个项目引用了套件框架

一切似乎都很好:我在框架上有
[BeforeTestRun]
[beforetscenario]
[beforetscenario]
,当我运行测试时,它能够找到并执行它们,但当代码到达Cucumber特性时,它只是跳过它们,我的意思是它会突出显示它们,但不会深入到它们

我检查了步骤定义,它们就在那里(我可以转到定义,不管它们在哪个项目中,它都会找到它们),并且绑定似乎是正确的。

到目前为止,这是我的代码示例:

功能:在该文件中,背景是指放置在框架项目上的文件,场景是指同一项目中的功能步骤

Feature: Reports
    As an admin
    I want to access to the Reports
    So I can see the information related to my product

Background: 
    When I navigate to the 'Reports' page
    And I navigate to my product reports

@Regression
Scenario: I can open the report
    When I click on the 'overall' tile
    Then the report is displayed
    And the data matches the database
后退步骤:

using UI.Suite.CommonPages.Pages;
using OpenQA.Selenium;
using TechTalk.SpecFlow;

namespace UI.Suite.CommonPages.Steps
{
    [Binding]
    public class SideBarNavigation
    {
        private readonly SideMenuComponent sideMenuComponent;

        public SideBarNavigation(IWebDriver driver)
        {
            sideMenuComponent = new SideMenuComponent(driver);
        }

        [When(@"I navigate to the '(.*)' page")]
        public void NavigateTo(string page)
        {
            sideMenuComponent.SideMenuNavigation(page);
        }
    }
}
场景步骤:

using NUnit.Framework;
using TechTalk.SpecFlow;
using UI.Products.Tests.Pages;
using OpenQA.Selenium;

namespace UI.Products.Tests.Steps
{
    [Binding]
    public class ReportsSteps
    {
        private readonly ReportsPage _reports;

        public ReportsSteps(IWebDriver driver)
        {
            _reports = new ReportsPage(driver);
        }

        [When(@"I navigate to my product reports")]
        public void WhenINavigateToMyProducts()
        {
            _reports.SelectMyProduct();
        }

        [When(@"I click on the '(.*)' tile")]
        public void WhenIClickOnAGivenReport(string report)
        {
            _reports.SelectReportTileAndConfig(report);
        }

        [Then(@"the report is displayed")]
        public void TheReportDisplays()
        {
            Assert.IsTrue(_reports.HasReportLoaded(), "The report has not loaded correctly");
        }

        [Then(@"the data matches the database")]
        public void TheDataDisplays()
        {
            Assert.IsTrue(_reports.DoesUIMatchDB(), "The data on the database does not match the UI");
        }
    }
}
谢谢你的帮助