From 5e7b039bcd3b3492affb0b776d7847cdbcd2ad80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Gradi=C4=8Dek?= Date: Tue, 16 May 2017 09:02:20 +0000 Subject: [PATCH] Added --single-scenario, --single-feature and --single-fail flags in test_executor Reviewers: buda Reviewed By: buda Differential Revision: https://phabricator.memgraph.io/D367 --- tck_engine/environment.py | 12 ++++++++++++ tck_engine/test_executor.py | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/tck_engine/environment.py b/tck_engine/environment.py index b80c63d99..2ca4cbf4b 100644 --- a/tck_engine/environment.py +++ b/tck_engine/environment.py @@ -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) diff --git a/tck_engine/test_executor.py b/tck_engine/test_executor.py index 6e9a86edf..dac8d56b7 100644 --- a/tck_engine/test_executor.py +++ b/tck_engine/test_executor.py @@ -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)