Невозможно выполнить наброски сценария в SpecFlow - PullRequest
0 голосов
/ 14 мая 2018

У меня есть этот тестовый сценарий

Scenario Outline: Compare values from the table with references values
    When I opened App
    And I open feature "DC"
    When The value in the '<table>' '<row>' '<column>' must be equal to the '<reference value>'

    Examples: 
    | table      | row | column | reference value|
    | sU         | 2   | 1      | 5.01           |

И этот метод

    [When(@"The value in the (.*) (.*) (.*) must be equal to the (.*)")]
    public void GivenSelectValueFromTheTable(string tablename, int row, int column, string expectedValue)
    {
        var valuefromanalysisreporttable = (ISG)Control(tablename);
        var actualValue = valuefromthetable[row, column];
        Assert.AreEqual(expectedValue, actualValue);
    }

Это не работает.

Отлично работает как обычный тестовый сценарий

Then The value in the table "sU" "4" "1" must be equal to the "5.01"

С этим блоком кода

 [Then(@"The value in the table ""(.*)"" ""(.*)"" ""(.*)"" must be equal to the ""(.*)""")]
    public void GivenSelectValueFromTheTable(string tablename, int row, int column, string expectedValue)
    {
        var valuefromthetable = (ISG)Control(tablename);
        var actualValue = valuefromanalysisreporttable[row, column];
        Assert.AreEqual(expectedValue, actualValue);
    }

Я пробовал одинарные кавычки (') вокруг заполнителей и внутри метода. Я пытался добавить и слово между параметрами. Не повезло.

Message: Assert.Inconclusive failed. No matching step definition found for one or more steps.
using System;
using TechTalk.SpecFlow;

namespace MyNamespace
{
[Binding]
public class StepDefinitions
{
  [When(@"The value in the '(.*)' '(.*)' '(.*)' must be equal to the '(.*)'")]
public void WhenTheValueInTheMustBeEqualToThe(string sgridUpper0, int p1, int p2, Decimal p3)
{
ScenarioContext.Current.Pending();
  }
 }
}

1 Ответ

0 голосов
/ 14 мая 2018

Попробуйте удалить пробел из «ссылочного значения» в таблице и использовать.

...