Skip to content

Commit

Permalink
Configure execution sequence for WEB and API tests
Browse files Browse the repository at this point in the history
File was configured to run tests in next sequence:
1. API test suite
2. WEB test suite
Only if API test suite is passed, will run WEB test suite. It's means
that, if one or more tests from API test suite has failed, WEB test suite
will skipped.
  • Loading branch information
bambula4000 committed Apr 3, 2019
1 parent 711d8de commit 425028c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions suite.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pylint: disable=no-value-for-parameter
import sys
import os
from typing import Tuple, Any, List

from pyats import easypy

from pyats.easypy.main import EasypyRuntime
Expand Down Expand Up @@ -54,19 +56,27 @@
_deployment_tests = (deploy_app,)


def main(runtime: EasypyRuntime) -> None:
for test_module in _api_tests + _web_tests + _deployment_tests:
def tests_runner(test_suite: Tuple, instance: Any) -> List: # type: ignore
test_suite_results = list()
for test_module in test_suite:
full_test_path = test_module.__file__
easypy.run( # pylint: disable=no-member
test_result = easypy.run( # pylint: disable=no-member
taskid=" -> ".join(
(
os.path.dirname(full_test_path).split(os.sep)[-1],
os.path.basename(full_test_path),
)
),
testscript=full_test_path,
**mandatory_aetest_arguments(runtime.testbed, device_name="vm"),
**mandatory_aetest_arguments(instance, device_name="vm"),
)
test_suite_results.append(str(test_result))
return test_suite_results


def main(runtime: EasypyRuntime) -> None:
if "failed" not in tests_runner(_api_tests, runtime.testbed):
tests_runner(_web_tests, runtime.testbed)


if __name__ == "__main__":
Expand Down

0 comments on commit 425028c

Please sign in to comment.