Mikhail R
Mikhail R

Reputation: 421

Unable to execute scenarion outline in SpecFlow

I have this test scenario

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           |

And this method

    [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);
    }

It doesn't work.

It works perfectly as the normal test scenario

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

With this block of code

 [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);
    }

I tried single quotation marks (') around placeholders and inside the method. I tried to add and word between parameters. No luck.

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();
  }
 }
}

Upvotes: 0

Views: 56

Answers (1)

Hagashen Naidu
Hagashen Naidu

Reputation: 128

Try removing the space from "reference value" in the table and the usage.

Upvotes: 1

Related Questions