示例#1
0
        public void RunAction(string action, StepDefinitionType stepDefinitionType, Table table)
        {
            switch (stepDefinitionType)
            {
            case StepDefinitionType.Given:
            {
                _runner.Given(action, null, table);
            }
            break;

            case StepDefinitionType.When:
            {
                _runner.When(action, null, table);
            }
            break;

            case StepDefinitionType.Then:
            {
                _runner.Then(action, null, table);
            }
            break;

            default:
                throw new ArgumentOutOfRangeException(nameof(stepDefinitionType), stepDefinitionType, null);
            }
        }
        public virtual void UserCannotEnterTheSystem()
        {
            ScenarioInfo scenarioInfo =
                new TechTalk.SpecFlow.ScenarioInfo("user cannot enter the system", new[] { "positive" });

#line 7
            this.ScenarioSetup(scenarioInfo);
#line 8
            testRunner.Given(
                "I try to connect the service",
                (string)(null),
                (TechTalk.SpecFlow.Table)(null),
                "Given ");
#line 9
            testRunner.When(
                "the result should be connected successfully",
                (string)(null),
                (TechTalk.SpecFlow.Table)(null),
                "When ");
#line 10
            testRunner.When(
                "I enter the login: wrongUser and password: wrongPassword",
                (string)(null),
                (TechTalk.SpecFlow.Table)(null),
                "When ");
#line 11
            testRunner.Then(
                "the result should be <user is not found>",
                (string)(null),
                (TechTalk.SpecFlow.Table)(null),
                "Then ");
#line hidden
            this.ScenarioCleanup();
        }
示例#3
0
        public virtual void GetExistingData()
        {
            ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Get existing data", (string[])null);

#line 3
            this.ScenarioSetup(scenarioInfo);
#line 4
            testRunner.Given("pageNumber is set to 1", (string)null, (TechTalk.SpecFlow.Table)null, "Given ");
#line 5
            testRunner.And("pageSize is set to 25", (string)null, (TechTalk.SpecFlow.Table)null, "And ");
#line 6
            testRunner.When("request send to server", (string)null, (TechTalk.SpecFlow.Table)null, "When ");
#line 7
            testRunner.Then("response contains 200 status code", (string)null, (TechTalk.SpecFlow.Table)null, "Then ");
#line 8
            testRunner.And("Shows is not empty", (string)null, (TechTalk.SpecFlow.Table)null, "And ");
#line 9
            testRunner.And("Errors is empty", (string)null, (TechTalk.SpecFlow.Table)null, "And ");
#line hidden
            this.ScenarioCleanup();
        }
        private void ExecuteStep(SpecFlowStep step)
        {
            var    docStringArg = step.Argument as DocString;
            string docString    = docStringArg?.Content;
            var    dataTableArg = step.Argument as DataTable;
            Table  dataTable    = null;

            if (dataTableArg != null && dataTableArg.Rows.Any())
            {
                dataTable = new Table(dataTableArg.Rows.First().Cells.Select(c => c.Value).ToArray());
                foreach (var row in dataTableArg.Rows.Skip(1))
                {
                    dataTable.AddRow(row.Cells.Select(c => c.Value).ToArray());
                }
            }
            switch (step.StepKeyword)
            {
            case StepKeyword.Given:
                testRunner.Given(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.When:
                testRunner.When(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.Then:
                testRunner.Then(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.And:
                testRunner.And(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.But:
                testRunner.But(step.Text, docString, dataTable, step.Keyword);
                break;
            }
        }
示例#5
0
 public static void Given(this ITestRunner testRunner, string text, string multilineTextArg)
 {
     testRunner.Given(text, multilineTextArg, null);
 }
示例#6
0
 public static void Given(this ITestRunner testRunner, string text)
 {
     testRunner.Given(text, null, null);
 }
示例#7
0
 public void Given(string step, string multilineTextArg, Table tableArg)
 {
     testRunner.Given(step, multilineTextArg, tableArg);
 }
示例#8
0
 protected void Given(string given, string keyword = "Given ")
 {
     testRunner.Given(given, null, null, keyword);
 }
示例#9
0
 public void Given(string text, string multilineTextArg, Table tableArg, string keyword = null)
 {
     _runner.Given(text, multilineTextArg, tableArg, keyword);
     _outputWriter.WriteStep(text);
     GhprPluginHelper.TestExecutionEngineHelper.OnGiven(_engine.ScenarioContext);
 }
示例#10
0
 public void Given(string text, string multilineTextArg, Table tableArg, string keyword = null)
 {
     _TestRunner.Given(Transform(text), Transform(multilineTextArg), Transform(tableArg), keyword);
 }