【问题标题】:When compiling Specflow project - generation error reported编译 Specflow 项目时 - 报告生成错误
【发布时间】:2018-03-10 10:23:11
【问题描述】:

我正在 VS2017 中创建一个新的 Specflow 项目。我在功能文件中添加了 1 条规则并生成了初始步骤代码。但是,当我尝试构建项目时,出现以下 2 个错误。 (1) CS1029 #error:“生成错误:对象引用未设置为对象的实例。” (2) 自定义工具报错:Generation error: Object reference not set to an instance of an object。

特征文件包含,

Feature: Change_Theme_Change_Scheme

@Change_Theme_Change_Scheme
Scenario: Verfy change of scheme
    Given I log into Admin site
    And I navigate to Colour Scheme page
    And I select the Kumho theme
    When I click the Save Theme button
    Then Check website main menu background is Red

步骤文件包含,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TechTalk.SpecFlow;
namespace Tyres_and_Service_Tester.Steps
{
    [Binding]
    public sealed class Change_Theme_Change_Scheme
        {
        [Given(@"I log into Admin site")]
        public void GivenILogIntoAdminSite()
        {
            ScenarioContext.Current.Pending();
        }
        [Given(@"I navigate to Colour Scheme page")]
        public void GivenINavigateToColourSchemePage()
        {
            ScenarioContext.Current.Pending();
        }
        [Given(@"I select the Kumho theme")]
        public void GivenISelectTheKumhoTheme()
        {
            ScenarioContext.Current.Pending();
        }
        [When(@"I click the Save Theme button")]
        public void WhenIClickTheSaveThemeButton()
        {
            ScenarioContext.Current.Pending();
        }
        [Then(@"Check website main menu background is Red")]
        public void ThenCheckWebsiteMainMenuBackgroundIsRed()
        {
            ScenarioContext.Current.Pending();
        }
    }
}

项目参考图片

我之前在使用早期版本的 VS 构建 Specflow 项目时没有遇到过这种情况,并且无法弄清楚我做了什么不同的事情 非常感谢您的帮助。托尼

【问题讨论】:

  • 你试过以管理员身份运行 VS 吗?
  • 你在 Visual Studio 中使用了什么样的项目?
  • 请同时发布您的 app.config

标签: specflow


【解决方案1】:

感谢您的所有回复。我决定从头开始再次将 Specflow 包添加到 VS,并重新创建功能、步骤等。正如您可能猜到的那样,这次它起作用了——所以我不知道会发生什么。无论如何,这个问题可以关闭。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-11
    相关资源
    最近更新 更多