在行为(Python)中执行方案期间是否有跳过步骤的选项。我有以下情况:
Scenario: Opening and closing driver by clicking and sliding
When swipe right
Then drawer should appear
When swipe left
Then drawer should disappear
Given part is for Android # now only Android executes, iOS not
When click hamburger
Then drawer should appear
When click outside drawer
Then drawer should disappear
现在我有一些变量与上下文一起传递,我在每一步之前检查tit是否为真:
@when('swipe right')
def step_slide_right(context):
dc = context.device_commands
if dc.check_if_this_is_the_platform(context.run_test_for):
dc.slide_right()
是否有任何功能可以在before_step(context,step)
skip_step
内跳过,而不是在每一步中调用if dc.check_if_this_is_the_platform(context.run_test_for):...
。
答案 0 :(得分:0)
我认为步骤中没有@skip_if
,但据我所知,1.2.5中添加的功能可能适用于您的目的。您将概述两种方案,并标记它们@use.with_os=Android
和@use.with_os=iOS
(请参阅Active Tag Logic)。
@use.with_os=Android
Scenario: Opening and closing driver by clicking and sliding
When swipe right
Then drawer should appear
When swipe left
Then drawer should disappear
Given part is for Android # now only Android executes, iOS not
When click hamburger
Then drawer should appear
When click outside drawer
Then drawer should disappear
@use.with_os=iOS
Scenario: Opening and closing driver by clicking and sliding
When swipe right
Then drawer should appear
When swipe left
Then drawer should disappear
然后在您的运行命令中包含-D os=Android
或-D os=iOS
(请参阅userdata)。
它将使用为该设备标记的方案。