oldani / HtmlTestRunner

A Test Runner in python, for Human Readable HTML Reports
MIT License
295 stars 171 forks source link

Access name of generated report #83

Open Michael-Steshenko opened 3 years ago

Michael-Steshenko commented 3 years ago

Description

I wan't to access the report file and do actions on it after it's generated, but there is no way I see to get the file name, it would be easy to save the file name in the runner object so it can be accessed later.

I also want to be able to know if some tests failed via code, Is there a way I'm missing?

this code is responsible for generating the file name.

def generate_file(self, testRunner, report_name, report):
        dir_to = testRunner.output
        if not os.path.exists(dir_to):
            os.makedirs(dir_to)

        if testRunner.timestamp:
            report_name += "_" + testRunner.timestamp
        report_name += ".html"

        path_file = os.path.abspath(os.path.join(dir_to, report_name))

I can implement that functionality if needed.