File tree 4 files changed +51
-0
lines changed
4 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,14 @@ def add_run_subparser(self):
104
104
dest = 'junit' ,
105
105
help = "Junit folder to store results. If not passed junit reports will not be generated"
106
106
)
107
+ run_subparser .add_argument (
108
+ "-o" ,
109
+ "--behave-opts" ,
110
+ action = 'append' ,
111
+ default = None ,
112
+ dest = 'behave_opts' ,
113
+ help = "Pass other arguments to behave"
114
+ )
107
115
108
116
def add_update_subparser (self ):
109
117
self .subparsers .add_parser ('update' , help = "update suites" )
Original file line number Diff line number Diff line change @@ -341,6 +341,12 @@ def run(self):
341
341
except Exception :
342
342
pass
343
343
344
+ behave_opts = None
345
+ try :
346
+ behave_opts = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_BEHAVE_OPTS )
347
+ except Exception :
348
+ pass
349
+
344
350
verbose = None
345
351
try :
346
352
verbose = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_VERBOSE )
@@ -381,6 +387,11 @@ def run(self):
381
387
if verbose != "yes" :
382
388
command .append ('--no-skipped' )
383
389
390
+ if behave_opts :
391
+ if type (behave_opts ) is str :
392
+ behave_opts = behave_opts .split ()
393
+ command .extend (behave_opts )
394
+
384
395
if ansible_conf :
385
396
command .extend (['-D' , 'ANSIBLE={0}' .format (ansible_conf )])
386
397
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class CTFCliConfig(object):
36
36
CONFIG_TESTS_CONFIG_PATH = 'TestsConfigPath'
37
37
CONFIG_BEHAVE_DATA = 'BehaveData'
38
38
CONFIG_BEHAVE_TAGS = 'BehaveTags'
39
+ CONFIG_BEHAVE_OPTS = 'BehaveOpts'
39
40
CONFIG_JUNIT = 'Junit'
40
41
CONFIG_EXEC_TYPE = 'ExecType'
41
42
CONFIG_REMOTE_TYPE = 'remote_type'
@@ -101,6 +102,7 @@ def _add_commandline_arguments(self, cli_conf):
101
102
cli_conf .tests_config_path )if cli_conf .tests_config_path else None ,
102
103
self .CONFIG_BEHAVE_DATA : cli_conf .behave_data ,
103
104
self .CONFIG_BEHAVE_TAGS : cli_conf .behave_tags ,
105
+ self .CONFIG_BEHAVE_OPTS : cli_conf .behave_opts ,
104
106
self .CONFIG_JUNIT : cli_conf .junit ,
105
107
self .CONFIG_EXEC_TYPE : 'ansible' ,
106
108
self .CONFIG_REMOTE_TYPE : cli_conf .remote_type ,
Original file line number Diff line number Diff line change @@ -49,6 +49,36 @@ Feature: Run parameters
49
49
INFO: Running behave inside working directory 'behave -v -t tag1 -t ~tag2 -D
50
50
"""
51
51
52
+ Scenario : Behave opts
53
+ Given a directory named "features"
54
+ And a file named "features/foo.feature" with:
55
+ """
56
+ Feature: test feature
57
+
58
+ Scenario: First scenario
59
+
60
+ Scenario: Second scenario
61
+
62
+ Scenario: Third scenario
63
+ """
64
+ When I successfully run "ctf run --behave-opts 'features/foo.feature:5'"
65
+ Then the command output should contain:
66
+ """
67
+ INFO: Running behave inside working directory 'behave features/foo.feature:5'
68
+ """
69
+ And the command output should contain:
70
+ """
71
+ Scenario: Second scenario
72
+ """
73
+ And the command output should not contain:
74
+ """
75
+ Scenario: First scenario
76
+ """
77
+ And the command output should not contain:
78
+ """
79
+ Scenario: Third scenario
80
+ """
81
+
52
82
Scenario : Run with existing work directory
53
83
Given a directory named "workdir"
54
84
When I successfully run "ctf -v run"
You can’t perform that action at this time.
0 commit comments