Skip to content

Commit

Permalink
Generate test cases documentation from robot test suites.
Browse files Browse the repository at this point in the history
Resolves: #547

Change-Id: I5b08b57b3955f0abd5cf4b0bc2201a8651297392
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
  • Loading branch information
sivassrr authored and geissonator committed May 19, 2017
1 parent 3c205b1 commit 4470957
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -175,3 +175,17 @@ python ./tools/github_issues_to_csv <github user> openbmc/openbmc
Example for getting openbmc-test-automation issues
python ./tools/github_issues_to_csv <github user> openbmc/openbmc-test-automation
```
Command to generate Robot test cases test documentations
```shell
./tools/generate_test_document <Robot test cases directory path> <test case document file path>

Example for generating tests cases documentation for tests directory
./tools/generate_test_document tests testsdirectoryTCdocs.html

Example for generating tests cases documentation (tests,gui,extended TCs)
# Note: Invoke the tool with out argument
./tools/generate_test_document
```
96 changes: 96 additions & 0 deletions tools/generate_test_document
@@ -0,0 +1,96 @@
#!/bin/bash

# This program will generate test documenation from the robot test cases.

# Description of argument(s):
# test_dir_path Test directory where robot test cases are available.
# test_case_doc_file_path The test case document file path to be stored.


###############################################################################
function get_parms {

# Get program parms.

test_dir_path="${1}" ; shift
test_case_doc_file_path="${1}" ; shift

return 0

}
###############################################################################


###############################################################################
function validate_parms {

# Validate program parameters.

num_parms="${1}" ; shift

(( ${num_parms} == 0 )) && return 0

if [ -z "${test_dir_path}" ] ; then
echo "**ERROR** You must provide test directory as the first positional" \
"parameter." >&2
return 1
fi

if [ -z "${test_case_doc_file_path}" ] ; then
echo "**ERROR** You must provide file path as the second positional" \
"parameter." >&2
return 1
fi

return 0

}
###############################################################################


###############################################################################
function generate_all_test_document {

# Generate all test case documents

local ret_code=0
python -m robot.testdoc tests testsdirectoryTCdocs.html || ret_code=1
python -m robot.testdoc extended extendeddirectoryTCdocs.html || ret_code=1
python -m robot.testdoc gui guidirectoryTCdocs.html || ret_code=1
python -m robot.testdoc systest systestdirectoryTCdocs.html || ret_code=1

return ${ret_code}
}
###############################################################################


###############################################################################
function main_function {

get_parms "$@" || return 1

validate_parms $# || return 1

if (( ${num_parms} == 0 )) ; then
generate_all_test_document || return 1
return 0
fi

echo ${test_dir_path} ${test_case_doc_file_path}
python -m robot.testdoc ${test_dir_path} ${test_case_doc_file_path}\
|| return 1

return 0

}
###############################################################################


###############################################################################
# Main

main_function "${@}"
rc="${?}"
exit "${rc}"

###############################################################################

0 comments on commit 4470957

Please sign in to comment.