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



我想以给定的格式编写手动测试,然后格式,但我正在努力为相关场景以这种格式编写测试,并想寻求帮助。

这是测试的手动过程:

  • 用户登录网站
  • 用户打开新选项卡
  • 用户将 url 粘贴到第二个选项卡中,他们会自动登录,因为它使用相同的会话
  • 用户从其中一个选项卡注销网站
  • 用户刷新另一个选项卡,他们会自动从那里注销

我不知道如何在给定,何时,然后样式中写下它并保持简洁,所以我需要一些帮助。

我做了一个尝试,但我对此不满意:

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  

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

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.

注意给定,何时,然后是关键字,我们用来编写场景,以便代码对于业务更具可读性。除了可读性之外,它们没有任何影响或功能。

最新更新