情景大纲并不是'运行第二个例子时工作

时间:2017-12-22 17:13:12

标签: c# selenium-webdriver selenium-chromedriver specflow

执行方案大纲有一个以上的例子有问题。 我试图清除会话,但它没有工作

这是代码

namespace AutomationPractice
{
  [Binding]
  public class LoginSteps
  {
    [BeforeScenario("LoginProperly")]
    public static void BeforeScenario()
    {
        Browser.Initialize();
    }

    [AfterScenario("LoginProperly")]
    public static void AfterScenario()
    {
        Browser.ClearSession();
        Browser.Close();

    }


    [Given(@"I am on login page")]
    public void GivenIAmOnLoginPage()
    {

        Pages.Navigation.GoToSignIn();
    }

    [Given(@"I have completed the form with '(.*)' and '(.*)'")]
    public void GivenIHaveCompletedTheFormWithAnd(string email, string password)
    {
        Pages.Login.LogIn(email, password);
    }

    [When(@"I press Submit")]
    public void WhenIPressSubmit()
    {
        Pages.Login.ClickLogin();
    }

    [Then(@"I should see my account panel")]
    public void ThenIShouldSeeMyAccountPanel()
    {

        Pages.Account.IsAt();

这是特色文件

Feature: Login
   In order to use my account
   As an application user
   I want to be able to log in and log out

@LoginProperly
Scenario Outline: Login with correct Email adress and Password
Given I am on login page
And I have completed the form with '<email>' and '<password>'
When I press Submit
Then I should see my account panel

Examples: 

| email            | password |
| tescik@gmail.com | 11111    |
| test             | test     |

在第一个场景之后,当逐个运行第二个场景时(email = test,password = test),会出现错误消息

enter image description here

我该怎么做才能解决它?

0 个答案:

没有答案