aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorrexlee8776 <limingjiang@huawei.com>2016-03-28 04:35:56 -0400
committerqi liang <liangqi1@huawei.com>2016-04-01 03:16:12 +0000
commitc62baf6b2cfb901109e31e0b34a193b0ece99b79 (patch)
tree307bc03e726e8e5e8d1120485ec11b5275095a5f /yardstick
parent010a22930664ac2663d331865ef29492dfa82f94 (diff)
add "yardstick testcase show" command function
"yardstick testcase show" will show the details of specific test case yardstick testcase show <case-name> (e.g. yardstick testcase show opnfv_yardstick_tc001) JIRA:- Change-Id: Ibb91625dc3e6802855f28160ee0aa8c7e386cf7a Signed-off-by: rexlee8776 <limingjiang@huawei.com>
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/cmd/commands/testcase.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/yardstick/cmd/commands/testcase.py b/yardstick/cmd/commands/testcase.py
index c37fcc214..5205eb93e 100644
--- a/yardstick/cmd/commands/testcase.py
+++ b/yardstick/cmd/commands/testcase.py
@@ -10,6 +10,7 @@
""" Handler for yardstick command 'testcase' """
from yardstick.cmd import print_hbar
from yardstick.common.task_template import TaskTemplate
+from yardstick.common.utils import cliargs
import os
import yaml
import sys
@@ -42,6 +43,26 @@ class TestcaseCommands(object):
self._format_print(self.testcase_list)
return True
+ @cliargs("casename", type=str, help="test case name", nargs=1)
+ def do_show(self, args):
+ '''Show details of a specific test case'''
+ testcase_name = args.casename[0]
+ testcase_path = self.test_case_path + testcase_name + ".yaml"
+ try:
+ with open(testcase_path) as f:
+ try:
+ testcase_info = f.read()
+ print testcase_info
+
+ except Exception as e:
+ print(("Failed to load test cases:"
+ "\n%(testcase_file)s\n%(err)s\n")
+ % {"testcase_file": testcase_path, "err": e})
+ raise e
+ except IOError as ioerror:
+ sys.exit(ioerror)
+ return True
+
def _get_record(self, testcase_file):
try: