2013-01-07 5 views
1

VS2010, SpecFlow 1.9.0, NUnit 2.6.2 및 ReSharper 7.1을 사용 중입니다. 여기서 응용 프로그램에서 stepAssemblies 태그를 통해 그들을 찾을 내가 SpecFlow 말한Specflow ignores F # 단계 어셈블리의 단계

[<TechTalk.SpecFlow.Binding>] 
module StepDefinitions 

open TechTalk.SpecFlow 
open NUnit.Framework 

let [<Given>] ``I have entered (.*) into the calculator`` (a: int) = 
    ScenarioContext.Current.Pending() 

let [<When>] ``I press the add button`` = 
    ScenarioContext.Current.Pending() 

let [<Then>] ``the result should be (.*) on the screen`` (r: int) = 
    ScenarioContext.Current.Pending() 

: 나는 별도의 F 번호 어셈블리 단계 정의를 구현 한

Feature: SpecFlowFeature1 
    In order to avoid silly mistakes 
    As a math idiot 
    I want to be told the sum of two numbers 

@mytag 
Scenario: Add two numbers 
    Given I have entered 50 into the calculator 
    And I have entered 70 into the calculator 
    When I press the add button 
    Then the result should be 120 on the screen 

: 나는 예에서 찍은 기능 파일이 .config

그러나 테스트를 실행하면 Given 및 Then 단계는 있지만 When 단계는 찾지 못합니다. 내가 얻는 오류는 다음과 같습니다.

No matching step definition found for one or more steps. 
using System; 
using TechTalk.SpecFlow; 

namespace MyNamespace 
{ 
    [Binding] 
    public class StepDefinitions 
    { 
     [When(@"I press the add button")] 
     public void WhenIPressTheAddButton() 
     { 
      ScenarioContext.Current.Pending(); 
     } 
    } 
} 

Given I have entered 50 into the calculator 
-> pending: StepDefinitions.I have entered (.*) into the calculator(50) 
And I have entered 70 into the calculator 
-> skipped because of previous errors 
When I press the add button 
-> No matching step definition found for the step. Use the following code to create one: 
     [When(@"I press the add button")] 
     public void WhenIPressTheAddButton() 
     { 
      ScenarioContext.Current.Pending(); 
     } 

Then the result should be 120 on the screen 
-> skipped because of previous errors 

어딘가에 잘못되었거나 F #이 지원되는 버그가 있습니까?

+2

등가 실제로'하게된다 ]''나는() ScenarioContext.Current.Pending를 (=)'추가 button''을 눌러 -주의 여분'()'후' –

+0

button' 도! 나는 오래 동안 그것을 봤다. 어리석은 질문에 대한 미안 해요 :(당신이 답변에 당신의 의견을 이동하면 나는 당신에게 포인트를 수여! – Akash

답변

5

는 C#의 올바른 번역은 실제로

let [<When>] ``I press the add button``() = 
    ScenarioContext.Current.Pending() 

참고 추가 ()입니다. 이것이 원래 버전에서 누락 되었기 때문에이 함수는 다른 서명을 가졌기 때문에 발견되지 않았습니다. 주어진 C 번호에

관련 문제