diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-06-29 07:12:29 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-08-17 09:24:49 +0000 |
commit | ecaecd74a20e4845fb748077b759a5697ba86f1c (patch) | |
tree | a26e7f5b5b456a78c29ab135f4862a9ca4b2ae25 /functest/cli/commands/cli_testcase.py | |
parent | 94d1bddfdd97379e50e4c12f26116441e836d0f6 (diff) |
API proposal for functest
1. Propose a basic framework for API
2. And these functions have been realized:
1) Show environment
2) Prepare Environment
3) Show credentials
4) List all testcases
5) Show a testcase
6) List all tiers
7) Show a tier
8) List all testcases within given tier
JIRA: FUNCTEST-843
Change-Id: Ib961446708077b56465eda0052f6d38806b62594
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/cli/commands/cli_testcase.py')
-rw-r--r-- | functest/cli/commands/cli_testcase.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py index cb3d4739..65dd9ab7 100644 --- a/functest/cli/commands/cli_testcase.py +++ b/functest/cli/commands/cli_testcase.py @@ -20,7 +20,7 @@ import functest.utils.functest_utils as ft_utils import functest.utils.functest_vacation as vacation -class CliTestcase(object): +class Testcase(object): def __init__(self): self.tiers = tb.TierBuilder( @@ -33,15 +33,11 @@ class CliTestcase(object): for tier in self.tiers.get_tiers(): for test in tier.get_tests(): summary += (" %s\n" % test.get_name()) - click.echo(summary) + return summary def show(self, testname): description = self.tiers.get_test(testname) - if description is None: - click.echo("The test case '%s' does not exist or is not supported." - % testname) - - click.echo(description) + return description @staticmethod def run(testname, noclean=False, report=False): @@ -62,3 +58,20 @@ class CliTestcase(object): for test in tests: cmd = "run_tests {}-t {}".format(flags, test) ft_utils.execute_command(cmd) + + +class CliTestcase(Testcase): + + def __init__(self): + super(CliTestcase, self).__init__() + + def list(self): + click.echo(super(CliTestcase, self).list()) + + def show(self, testname): + testcase_show = super(CliTestcase, self).show(testname) + if testcase_show: + click.echo(testcase_show) + else: + click.echo("The test case '%s' does not exist or is not supported." + % testname) |