diff options
author | 2016-05-02 09:01:50 +0200 | |
---|---|---|
committer | 2016-05-02 12:22:31 +0000 | |
commit | 96a2b487563a5aeebe1a4d4bb31018408771d360 (patch) | |
tree | 78575aa2563b6341c37b8b7bdd2de9985d96bdb0 /ci/tier_handler.py | |
parent | 56d7f7fae5cca0268239fd2b4ce48b5817abd3ae (diff) |
Enhance output when showing tiers and testcases info
JIRA: FUNCTEST-190
Change-Id: I43e26700ee3c92be64d79243c6762a3ccd5d42d3
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'ci/tier_handler.py')
-rw-r--r-- | ci/tier_handler.py | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/ci/tier_handler.py b/ci/tier_handler.py index 46dbc434..58182111 100644 --- a/ci/tier_handler.py +++ b/ci/tier_handler.py @@ -51,11 +51,42 @@ class Tier: return self.name def __str__(self): - return ("Tier info:\n" - " Name: " + self.name + "\n" - " Description: " + self.description + "\n" - " Order: " + str(self.order) + "\n" - " Test cases: " + str(self.get_test_names()) + "\n") + lines = [] + line_max = 50 + line = "" + line_count = 0 + for i in range(len(self.description)): + line += self.description[i] + if line_count >= line_max - 1: + line_count = 0 + lines.append(line) + line = "" + else: + line_count += 1 + if line != "": + lines.append(line) + + out = "" + out += ("+=======================================================+\n") + out += ("| Tier: " + self.name.ljust(47) + "|\n") + out += ("+=======================================================+\n") + out += ("| Order: " + str(self.order).ljust(47) + "|\n") + out += ("| Description: |\n") + for i in range(len(lines)): + out += ("| " + lines[i].ljust(50) + " |\n") + out += ("| Test cases: |\n") + tests = self.get_test_names() + if len(tests) > 0: + for i in range(len(tests)): + out += ("| - %s |\n" % tests[i].ljust(48)) + else: + out += ("| (There are no supported test cases " + .ljust(56) + "|\n") + out += ("| in this tier for the given scenario) " + .ljust(56) + "|\n") + out += ("|".ljust(56) + "|\n") + out += ("+-------------------------------------------------------+\n") + return out class TestCase: @@ -77,10 +108,36 @@ class TestCase: return self.name def __str__(self): - return ("Testcase info:\n" - " Name: " + self.name + "\n" - " Description: " + self.description + "\n" - " " + str(self.dependency) + "\n") + lines = [] + line_max = 50 + line = "" + line_count = 0 + for i in range(len(self.description)): + line += self.description[i] + if line_count >= line_max - 1: + line_count = 0 + lines.append(line) + line = "" + else: + line_count += 1 + if line != "": + lines.append(line) + + out = "" + out += ("+=======================================================+\n") + out += ("| Testcase: " + self.name.ljust(43) + "|\n") + out += ("+=======================================================+\n") + out += ("| Description: |\n") + for i in range(len(lines)): + out += ("| " + lines[i].ljust(50) + " |\n") + out += ("| Dependencies: |\n") + installer = self.dependency.get_installer() + scenario = self.dependency.get_scenario() + out += ("| - Installer: " + installer.ljust(38) + "|\n") + out += ("| - Scenario : " + scenario.ljust(38) + "|\n") + out += ("|".ljust(56) + "|\n") + out += ("+-------------------------------------------------------+\n") + return out class Dependency: |