我正在使用 flutter_driver 和 flutter_gherkin 包为我的应用程序编写测试。我写了一些功能。例如我有这两个特点:
login.feature
:
@login
Feature: LoginFeature
Test User Login
Scenario: User does not exist
Given I test the initial state of the app
Then I see 'phone' widget
And I input the 'phone' '09190591010'
And I click the 'loginButton' button
Then I see in the flushbar 'No user'
@correctLogin
Scenario: User enters right number
Given I test the initial state of the app
Then I see 'phone' widget
And I input the 'phone' '09190591094'
And I click the 'loginButton' button
Then I see 'Enter code from SMS' text
@correctLogin
Scenario: Recieve SMS in less than 10 seconds
Given I test the initial state of the app
Then I see 'Code automatically entered' text
Then I see 'mainAppBar' widget
logout
@logout
Feature: ExitFeature
Test User Exit
Scenario: open drawer and exit
Given I test the initial state of the app
And I see 'mainAppBar' widget
And I wait for '2000' mili seconds
When I Open 'drawerButton' drawer
And I wait for '2000' mili seconds
Then I see 'drawer' widget
When I click the 'Exit' text
And I wait for '2000' mili seconds
And I see 'cancel' text
When I click the 'exitBtn' button
And I wait for '2000' mili seconds
Then I see 'login' widget
现在为了测试该logout
功能,我需要先运行该login
功能,以便我可以在主视图中。所以第一个问题是:
1.如何按以下顺序运行这些场景:login
-> logout
?login
(没有将场景复制到logout
功能)
第一个问题是关于如何一个接一个地运行功能。第二个问题是关于标签的同一件事。如您所见,我有login
,@correctLogin
和logout
标签。所以第二个问题是:
2. 如何按以下顺序运行标签:@correctLogin
-> logout
?(请注意第一个login
功能场景没有@correctLogin
标签。我也想将此correctLogin
标签与许多其他测试一起使用,因此添加标签logout
不是一个好主意)
任何帮助将不胜感激。