Author: janne.t.harkonen
Date: Wed Nov 19 00:37:45 2008
New Revision: 995
Modified:
trunk/tools/testdoc/testdoc.py
Log:
doc improvement, cleanup
Modified: trunk/tools/testdoc/testdoc.py
==============================================================================
--- trunk/tools/testdoc/testdoc.py (original)
+++ trunk/tools/testdoc/testdoc.py Wed Nov 19 00:37:45 2008
@@ -19,52 +19,32 @@
Usage: testdoc.py [options] data_sources
-This script generates a high level documentation of given suite. This
+This script generates a high level documentation of given suite. Generated
documentation includes the names and documentation for each suite and test
case
and also the top level keywords and their documentation for each test.
Options:
-o --output path Where to write the generated documentation. If the
path is a directory, the documentation is
- generated there using name '<suitename>_doc.html'.
+ generated there using name '<suitename>-doc.html'.
-T --title title Set the title of the generated documentation.
Underscores in the title are converted to spaces.
- -N --name name Set the name of the top level test suite. Name is
- automatically capitalized and underscores converted
- to spaces. Default name is created from the name of
- the executed data source.
+ -N --name name Set the name of the top level test suite. See pybot
+ -\\-help for details.
-D --doc document Set the document of the top level test suite.
- Underscores in the document are turned into spaces
- and it may also contain simple HTML formatting
(e.g.
- *bold* and http://url/).
- -M --metadata name:value * Set metadata of the top level test suite.
Name is
- automatically capitalized and underscores converted
- to spaces. Value can contain same HTML formatting
as
- --doc. Example: '--metadata version:1.2'
+ See pybot --help for details.
+ -M --metadata name:value * Set metadata of the top level test suite. See
+ pybot --help for details.
-G --settag tag * Sets given tag(s) to all executed test cases.
- -t --test name * Select test cases to run by name. Name is case and
- space insensitive and it can also be a simple
pattern
- where '*' matches anything and '?' matches any
char.
- If using '*' and '?' in the console is problematic
- see --escape and --argumentfile.
- -s --suite name * Select test suites to run by name. When this option
- is used with --test, --include or --exclude, only
- test cases in matching suites and also matching
other
- filtering criteria are selected. Name can be a
simple
- pattern similarly as with --test and it can contain
- parent name separated with a dot. For example
- '-s X.Y' selects suite 'Y' only if its parent
is 'X'.
- -i --include tag * Select test cases to run by tag. Similarly as name
in
- -\\-test, tag is case and space insensitive and it
- can also be a simple pattern. To include only tests
- which have more than one tag use '&' or 'AND'
between
- tag names. For example '--include tag1&tag2'
includes
- only those tests that have both 'tag1' and 'tag2'.
- -e --exclude tag * Select test cases not to run by tag. These tests
are
- not run even if they are included with --include.
Tag
- names are handled similarly as in --include and
- excluding only tests containing multiple tags works
- the same way using '&' or 'AND'.
+ -t --test name * Select test cases to be included in the
documentation
+ by name. See pybot --help for details on filtering.
+ -s --suite name * Select test suites to be included in the
documentation
+ by name. See pybot --help for details on filtering.
+ -i --include tag * Select test cases to be included in the
documentation
+ by tag. See pybot --help for details on filtering.
+ -e --exclude tag * Select test cases not to be included in the
+ documentation by tag. See pybot --help for details
on
+ filtering.
-h --help Print this help.
"""
@@ -147,13 +127,13 @@
def generate_test_doc(args):
- opts, datasources = _process_arguments(args)
+ opts, datasources = process_arguments(args)
suite = TestSuite(datasources, RobotSettings(opts), SystemLogger())
- outpath = _get_outpath(opts['output'], suite.name)
- _serialize_test_doc(suite, outpath, opts['title'])
+ outpath = get_outpath(opts['output'], suite.name)
+ serialize_test_doc(suite, outpath, opts['title'])
print outpath
-def _serialize_test_doc(suite, outpath, title):
+def serialize_test_doc(suite, outpath, title):
outfile = open(outpath, 'w')
serializer = MySerializer(outfile, suite)
ttuple = time.localtime()
@@ -172,7 +152,7 @@
outfile.write('</body>\n</html>\n')
outfile.close()
-def _process_arguments(args_list):
+def process_arguments(args_list):
argparser = utils.ArgumentParser(__doc__)
try:
opts, args = argparser.parse_args(args_list)
@@ -190,11 +170,11 @@
sys.exit(1)
sys.exit(0)
-def _get_outpath(path, suite_name):
+def get_outpath(path, suite_name):
if not path:
path = '.'
if os.path.isdir(path):
- path = os.path.join(path, '%s_doc.html' %
suite_name.replace(' ', '_'))
+ path = os.path.join(path, '%s-doc.html' %
suite_name.replace(' ', '_'))
return os.path.abspath(path)