Dynamic parameter
-------------------

It's possible to dynamically add a parameter to a test result:


    >>> import allure

    >>> def test_dynamic_parameter():
    ...     allure.dynamic.parameter("username", "John Doe")


The parameter name and value are shown in the "Parameters" section of the test
details view. Additionally, the value is shown near the test name in the test
tree view.


Affecting the history of test execution in Allure TestOps
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Parameters also affect how Allure TestOps keeps history and retry records
across test results. Two test results that differs from each other in a
parameter value are considered as belonging to different test cases, thus
forming separate histories.

This behavior can be changed with ``excluded`` argument:


    >>> import allure
    ... import os

    >>> def test_excluded_dynamic_parameter():
    ...     allure.dynamic.parameter("work-dir", os.getcwd(), excluded=True)


Such a parameter isn't taken into account by Allure TestOps when it decides
whether two test results actually belong to a single test case. This is useful
if you want to add environment-related information (such as host names, OS, PID,
paths, versions, etc.) but keep history the same if the information is changed.


Masking a sensitive parameter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A parameter value can be masked with ``mode`` argument. The masked value is shown
as ``******`` in the report. This is useful for sensitive parameters like
passwords or key phrases:


    >>> import allure

    >>> def test_masked_dynamic_parameter():
    ...     allure.dynamic.parameter("password", "qwerty", mode=allure.parameter_mode.MASKED)


WARNING: Although the value is masked in the report, it is still present in the
test result files (but not in report files, i.e., the files generated by
allure reporter).


Hiding a parameter from the report
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A parameter can be hidden from the report completely. It still affects the
history of the test case though. This is useful if you want to force Allure
TestOps to distribute otherwise indistinguishable test results across different
test cases:


    >>> import allure
    >>> import socket

    >>> def test_hidden_dynamic_parameter():
    ...     allure.dynamic.parameter("hostname", socket.gethostname(), mode=allure.parameter_mode.HIDDEN)
