如何写给定,何时,然后用于切换选项卡以检查登录

时间:2018-10-25 11:43:57

标签: cucumber gherkin

我想用给定的格式编写手动测试,但是要在相关情况下以这种格式编写测试,并且想要寻求帮助。

这是测试的手动过程:

  • 用户登录网站
  • 用户打开一个新标签页
  • 用户将url粘贴到第二个选项卡中,并且它们使用相同的会话时会自动登录
  • 用户从其中一个标签退出网站
  • 用户刷新另一个标签,它们会自动从那里注销

我不知道该如何以GIVEN,WHEN,THEN风格编写并保持简洁,因此请提供帮助。

我尝试过,但对此不满意:

Given user opens the homepage
And the user logs in
Then the logout button is displayed
Given user selects another tab
And user opens the homepage
And user logs in
Then the log out button is displayed
When I log out of homepage
Then the login panel is displayed
When I switch tabs 
And I refresh the other homepage
Then the login panel is displayed  

我对此不太满意,所以有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

Given user opens the homepage
And the user logs in
Then user opens the Url(MainPage) in another tab
And then clicked on the logout button in one of the tab
And able to see the login panel in the same tab
Then User switched to other tab 
And  Refresh the Page or tab 
Then User now able to see the  login panel in other tab also.

注意 给出,何时,然后 是关键字,我们正在使用它们编写方案,以便使代码更易读为业务。除了可读性之外,它们没有其他影响或功能。

相关问题