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: str = 'Testreport', tests: Any | List[Any] = '__main__', tags: str | None = None, fixture_tags: str | None = None, html_report: str | List[str] | None = None, junit_xml_report: str | List[str] | None = None, json_report: str | List[str] | None = None, yaml_report: str | List[str] | None = None, report_server: str | List[str] | None = None, extra_report: Any | List[Any] | None = None, create_drafts: bool = False, open_report: bool = False, pattern: str = 'test*.py', metadata: Dict[str, Any] | None = None, parameters: Dict[str, str] | None = None, exit: bool = True, fail_fast: bool = False, minimize_report_size: bool = False, interactive: bool = False, interactive_address: str = '0.0.0.0', interactive_port: int = 8080, open_browser: bool = True, shuffle: bool = False, shuffle_seed: str | int | None = None) int
Test runner for a dry run to watch the test suite.
- Parameters:
title – the test’s title
tests=None – a test-specifier or a list of test-specifiers (folder, file, test-case, test-case-method, module)
ags=None – test filter expression
fixture_tags=None – fixture filter expression
html_report=None – HTML-report filename(s)
junit_xml_report=None – JUnit-XML-report filename(s)
json_report=None – JSON-report filename(s)
yaml_report=None – YAML-report filename(s)
report_server=None – Url or list of urls to report server
extra_report=None – Extra reports that support instance.render(data). This is useful for
htf.DOORSTestReport
for example that needs additional parameters.create_drafts=False – if set to
True
draft reports are created after each testopen_report=False – if set to
True
the HTML test report is opened after the test runpattern="test*.py" – the pattern to be used when searching for python files in folders
metadata=None – a dictionary that contains metadata about the test run
parameters=None – a dictionary that contains parameters for the test run
exit=True – if set to
True
the exit() is called at the end of the testsfail_fast=False – if set to
True
the test run ends after the first failing testminimize_report_size=False – if set to
True
the report size is minimized.interactive=False – if set to
True
the tests are run interactivelyinteractive_address="0.0.0.0" – the ip address the interaction server listens on.
interactive_port=8080 – the port the interaction server listens on.
open_browser=True – if set to
False
browser is not opened automaticallyshuffle=False – set to
True
to shuffle testsshuffle_seed=None – the shuffle seed or ‘last’ to use the last shuffle seed
- Returns:
0
if the run was successful or the number of failed tests in case or errors and failures.- Return type:
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.