Added --single-scenario, --single-feature and --single-fail flags in test_executor

Reviewers: buda

Reviewed By: buda

Differential Revision: https://phabricator.memgraph.io/D367
This commit is contained in:
Matej Gradiček 2017-05-16 09:02:20 +00:00
parent 2d0fcc82e3
commit 5e7b039bcd
2 changed files with 31 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import logging
import datetime
import time
import json
import sys
from steps.test_parameters import TestParameters
from neo4j.v1 import GraphDatabase, basic_auth
from steps.graph_properties import GraphProperties
@ -18,6 +19,17 @@ def before_scenario(context, step):
def after_scenario(context, scenario):
test_results.add_test(scenario.status)
if context.config.single_scenario or \
(context.config.single_fail and scenario.status == "failed"):
print("Press enter to continue")
sys.stdin.readline()
def after_feature(context, feature):
if context.config.single_feature:
print("Press enter to continue")
sys.stdin.readline()
def before_all(context):
context.driver = create_db_driver(context)

View File

@ -26,6 +26,12 @@ def parse_args():
"INFO", "DEBUG"], help="Logging level, default is DEBUG.")
argp.add_argument("--unstable", action="store_true",
help="Include unstable feature from features.")
argp.add_argument("--single-fail", action="store_true",
help="Pause after failed scenario.")
argp.add_argument("--single-scenario", action="store_true",
help="Pause after every scenario.")
argp.add_argument("--single-feature", action="store_true",
help="Pause after every feature.")
return argp.parse_args()
@ -54,6 +60,13 @@ def main():
add_config("--output-folder", dict(
help="Folder where results of tests are written."))
add_config("--root", dict(help="Folder with test features."))
add_config("--single-fail",
dict(action="store_true", help="Pause after failed scenario."))
add_config("--single-scenario",
dict(action="store_true", help="Pause after every scenario."))
add_config("--single-feature",
dict(action="store_true", help="Pause after every feature."))
# list with all options
# options will be passed to the cucumber engine
@ -78,6 +91,12 @@ def main():
behave_options.append(args.db_uri)
behave_options.append("--root")
behave_options.append(args.root)
if (args.single_fail):
behave_options.append("--single-fail")
if (args.single_scenario):
behave_options.append("--single-scenario")
if (args.single_feature):
behave_options.append("--single-feature")
behave_options.append("--output-folder")
behave_options.append(args.output_folder)