[Python] How to write test steps to the generated html report with pytest-html?

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    I can't find a way to add string to my HTML report that represent my test steps.

    I saw in https://pypi.org/project/pytest-html/ that I should try with:

    extra.text('Add some simple Text')


    but seems that it doesn't work.

    from pytest_html import extras

    class FirstFeatureTests:

    def setup_class(self):
    print("\n------------ in setup_class ------------")

    def teardown_class(self):
    print("------------ in teardown_class ------------")

    @mark.example
    def test_1_first_feature(self):
    print("starting test !!!!!")
    extras.text("step 1: ")
    extras.text('step 2: ')
    assert True


    I expect that each test will contains test steps represented as string with iformative description.

    is there any way to do so?

    Continue reading...

Compartilhe esta Página