| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 |  | 
 | 3 | # This program will generate test documenation from the robot test cases. | 
 | 4 |  | 
 | 5 | # Description of argument(s): | 
 | 6 | # test_dir_path            Test directory where robot test cases are available. | 
 | 7 | # test_case_doc_file_path  The test case document file path to be stored. | 
 | 8 |  | 
 | 9 |  | 
 | 10 | ############################################################################### | 
 | 11 | function get_parms { | 
 | 12 |  | 
 | 13 |   # Get program parms. | 
 | 14 |  | 
 | 15 |   test_dir_path="${1}" ; shift | 
 | 16 |   test_case_doc_file_path="${1}" ; shift | 
 | 17 |  | 
 | 18 |   return 0 | 
 | 19 |  | 
 | 20 | } | 
 | 21 | ############################################################################### | 
 | 22 |  | 
 | 23 |  | 
 | 24 | ############################################################################### | 
 | 25 | function validate_parms { | 
 | 26 |  | 
 | 27 |   # Validate program parameters. | 
 | 28 |  | 
 | 29 |   num_parms="${1}" ; shift | 
 | 30 |  | 
 | 31 |   (( ${num_parms} == 0 )) && return 0 | 
 | 32 |  | 
 | 33 |   if [ -z "${test_dir_path}" ] ; then | 
 | 34 |     echo "**ERROR** You must provide test directory as the first positional" \ | 
 | 35 |          "parameter." >&2 | 
 | 36 |     return 1 | 
 | 37 |   fi | 
 | 38 |  | 
 | 39 |   if [ -z "${test_case_doc_file_path}" ] ; then | 
 | 40 |     echo "**ERROR** You must provide file path as the second positional" \ | 
 | 41 |          "parameter." >&2 | 
 | 42 |     return 1 | 
 | 43 |   fi | 
 | 44 |  | 
 | 45 |   return 0 | 
 | 46 |  | 
 | 47 | } | 
 | 48 | ############################################################################### | 
 | 49 |  | 
 | 50 |  | 
 | 51 | ############################################################################### | 
 | 52 | function generate_all_test_document { | 
 | 53 |  | 
 | 54 |   # Generate all test case documents | 
 | 55 |  | 
 | 56 |   local ret_code=0 | 
 | 57 |   python -m robot.testdoc tests testsdirectoryTCdocs.html || ret_code=1 | 
 | 58 |   python -m robot.testdoc extended extendeddirectoryTCdocs.html || ret_code=1 | 
 | 59 |   python -m robot.testdoc gui guidirectoryTCdocs.html || ret_code=1 | 
 | 60 |   python -m robot.testdoc systest systestdirectoryTCdocs.html || ret_code=1 | 
| Sivas SRR | 9bd2f83 | 2017-05-29 10:57:57 -0500 | [diff] [blame^] | 61 |   python -m robot.testdoc xcat xcatdirectoryTCdocs.html || ret_code=1 | 
 | 62 |   python -m robot.testdoc mnfg mnfgdirectoryTCdocs.html || ret_code=1 | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 63 |  | 
 | 64 |   return ${ret_code} | 
 | 65 | } | 
 | 66 | ############################################################################### | 
 | 67 |  | 
 | 68 |  | 
 | 69 | ############################################################################### | 
 | 70 | function main_function { | 
 | 71 |  | 
 | 72 |   get_parms "$@" || return 1 | 
 | 73 |  | 
 | 74 |   validate_parms $# || return 1 | 
 | 75 |  | 
 | 76 |   if (( ${num_parms} == 0 )) ; then | 
 | 77 |     generate_all_test_document || return 1 | 
 | 78 |     return 0 | 
 | 79 |   fi | 
 | 80 |  | 
 | 81 |   echo ${test_dir_path} ${test_case_doc_file_path} | 
 | 82 |   python -m robot.testdoc ${test_dir_path} ${test_case_doc_file_path}\ | 
 | 83 |     || return 1 | 
 | 84 |  | 
 | 85 |   return 0 | 
 | 86 |  | 
 | 87 | } | 
 | 88 | ############################################################################### | 
 | 89 |  | 
 | 90 |  | 
 | 91 | ############################################################################### | 
 | 92 | # Main | 
 | 93 |  | 
 | 94 |   main_function "${@}" | 
 | 95 |   rc="${?}" | 
 | 96 |   exit "${rc}" | 
 | 97 |  | 
 | 98 | ############################################################################### |