55
66from getgauge import processor
77from getgauge import static_loader as loader
8+ from getgauge .exceptions import SkipScenarioException
89from getgauge .messages .messages_pb2 import *
910from getgauge .messages .spec_pb2 import Parameter , ProtoExecutionResult , Span
1011from getgauge .parser import Parser
@@ -183,6 +184,8 @@ def test_Processor_execute_step_request(self):
183184 '' , response .executionResult .errorMessage )
184185 self .assertEqual (
185186 '' , response .executionResult .stackTrace )
187+ self .assertFalse (response .executionResult .skipScenario )
188+ self .assertEqual ([], response .executionResult .message )
186189
187190 def test_Processor_execute_step_request_with_param (self ):
188191 registry .add_step ('Step <a> with <b>' , impl , '' )
@@ -204,6 +207,8 @@ def test_Processor_execute_step_request_with_param(self):
204207 '' , response .executionResult .errorMessage )
205208 self .assertEqual (
206209 '' , response .executionResult .stackTrace )
210+ self .assertFalse (response .executionResult .skipScenario )
211+ self .assertEqual ([], response .executionResult .message )
207212
208213 def test_Processor_failed_execute_step_request (self ):
209214 request = ExecuteStepRequest ()
@@ -219,6 +224,8 @@ def test_Processor_failed_execute_step_request(self):
219224 self .assertNotEqual (
220225 '' , response .executionResult .stackTrace )
221226 self .assertFalse (response .executionResult .recoverableError )
227+ self .assertFalse (response .executionResult .skipScenario )
228+ self .assertEqual ([], response .executionResult .message )
222229
223230 def test_Processor_failed_execute_step_request_with_continue_on_failure (self ):
224231 registry .add_step ('Step 4' , failing_impl , '' )
@@ -236,6 +243,25 @@ def test_Processor_failed_execute_step_request_with_continue_on_failure(self):
236243 self .assertNotEqual ('' , response .executionResult .errorMessage )
237244 self .assertNotEqual ('' , response .executionResult .stackTrace )
238245 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 )
239265
240266 def test_Processor_starting_execution_request (self ):
241267 registry .add_before_suite (impl1 )
@@ -748,6 +774,9 @@ def impl2(context):
748774def failing_impl ():
749775 print ([][1 ])
750776
777+ def skipped_impl ():
778+ raise SkipScenarioException ("Step programmatically skipped" )
779+
751780
752781if __name__ == '__main__' :
753782 main ()
0 commit comments