Dry run

The dry run feature is supported by the HILSTER Testing Framework since version htf-1.2.

The dry run feature works like a normal test run but marks all tests to be skipped and is fast as a result.

This is useful feature if you want check your test selection with or without tagging. It can also be used to easily create a test specification if your test specifications are included in the docstring of your tests.

The test specification can be read within an HTML-report or you can use a JSON-report to create another document using the contained data.

htf.dryrun()

htf.dryrun() can be used to do a dry run of a test suite from a Python script. It accepts the same parameters as htf.main() and htf.run() do and so it can easily be substituted.

htf.dryrun(title='Testreport', tests='__main__', tags=None, html_report=None, junit_xml_report=None, json_report=None, extra_report=None, pattern='test*.py', metadata=None, exit=True, verbosity=1, failfast=None, catchbreak=None)

Test runner for a dry run to watch the test suite.

Parameters:
  • title (str) – the test’s title
  • tests=None (test-specifier or list of test-specifiers) – a test-specifier ora list of test-specifiers (folder, file, test-case, test-case-method, module)
  • tags=None (str) – tags filter expression
  • html_report=None (str or list of str) – HTML-report filename(s)
  • junit_xml_report=None (str or list of str) – JUnit-XML-report filename(s)
  • json_xml_report=None (str or list of str) – JSON-report filename(s)
  • extra_report=None (instance or list of instances) – Extra reports that support instance.render(data). This is useful for htf.DOORSTestReport for example that needs additional parameters.
  • pattern="test*.py" (str) – the pattern to be used when searching for python files in folders
  • metadata=None (dict) – a dictionary that contains metadata about the test run
  • exit=True (bool) – if set to True the exit() is called at the end of the tests
  • verbosity=1 (int) – the verbosity level (the higher the level the more verbose is the output)
  • failfast=None (bool) – if set to True the test run ends after the first failing test
  • catchbreak=None (bool) – if set to True CTRL-C is catched wile tests run. If CTRL-C is pressed the test run is stopped after the current test.
  • argv=None – the arguments to be parsed (useful for testing). If set to None sys.argv is used instead.
  • parse_args=False – if set to True argv or sys.argv is parsed using argparse (useful as a command-line utility)
Returns:

0 if the run was successful or the number of failed tests in case or errors and failures.

Return type:

int

htf dryrun

To dry run from command line use htf dryrun .... It accepts the same parameters as htf run does and so it can easily be substituted.