5
5
6
6
from getgauge import processor
7
7
from getgauge import static_loader as loader
8
+ from getgauge .exceptions import SkipScenarioException
8
9
from getgauge .messages .messages_pb2 import *
9
10
from getgauge .messages .spec_pb2 import Parameter , ProtoExecutionResult , Span
10
11
from getgauge .parser import Parser
@@ -183,6 +184,8 @@ def test_Processor_execute_step_request(self):
183
184
'' , response .executionResult .errorMessage )
184
185
self .assertEqual (
185
186
'' , response .executionResult .stackTrace )
187
+ self .assertFalse (response .executionResult .skipScenario )
188
+ self .assertEqual ([], response .executionResult .message )
186
189
187
190
def test_Processor_execute_step_request_with_param (self ):
188
191
registry .add_step ('Step <a> with <b>' , impl , '' )
@@ -204,6 +207,8 @@ def test_Processor_execute_step_request_with_param(self):
204
207
'' , response .executionResult .errorMessage )
205
208
self .assertEqual (
206
209
'' , response .executionResult .stackTrace )
210
+ self .assertFalse (response .executionResult .skipScenario )
211
+ self .assertEqual ([], response .executionResult .message )
207
212
208
213
def test_Processor_failed_execute_step_request (self ):
209
214
request = ExecuteStepRequest ()
@@ -219,6 +224,8 @@ def test_Processor_failed_execute_step_request(self):
219
224
self .assertNotEqual (
220
225
'' , response .executionResult .stackTrace )
221
226
self .assertFalse (response .executionResult .recoverableError )
227
+ self .assertFalse (response .executionResult .skipScenario )
228
+ self .assertEqual ([], response .executionResult .message )
222
229
223
230
def test_Processor_failed_execute_step_request_with_continue_on_failure (self ):
224
231
registry .add_step ('Step 4' , failing_impl , '' )
@@ -236,6 +243,25 @@ def test_Processor_failed_execute_step_request_with_continue_on_failure(self):
236
243
self .assertNotEqual ('' , response .executionResult .errorMessage )
237
244
self .assertNotEqual ('' , response .executionResult .stackTrace )
238
245
self .assertTrue (response .executionResult .recoverableError )
246
+ self .assertFalse (response .executionResult .skipScenario )
247
+ self .assertEqual ([], response .executionResult .message )
248
+
249
+ def test_Processor_failed_execute_step_request_with_programmatic_skip (self ):
250
+ registry .add_step ('Skipped Step' , skipped_impl , '' )
251
+
252
+ request = ExecuteStepRequest ()
253
+ request .parsedStepText = 'Skipped Step'
254
+
255
+ response = processor .process_execute_step_request (request )
256
+
257
+ self .assertIsInstance (response , ExecutionStatusResponse )
258
+ self .assertFalse (response .executionResult .failed )
259
+ self .assertEqual (
260
+ '' , response .executionResult .errorMessage )
261
+ self .assertEqual (
262
+ '' , response .executionResult .stackTrace )
263
+ self .assertTrue (response .executionResult .skipScenario )
264
+ self .assertEqual (['Step programmatically skipped' ], response .executionResult .message )
239
265
240
266
def test_Processor_starting_execution_request (self ):
241
267
registry .add_before_suite (impl1 )
@@ -748,6 +774,9 @@ def impl2(context):
748
774
def failing_impl ():
749
775
print ([][1 ])
750
776
777
+ def skipped_impl ():
778
+ raise SkipScenarioException ("Step programmatically skipped" )
779
+
751
780
752
781
if __name__ == '__main__' :
753
782
main ()
0 commit comments