Example #1
0
 def pytest_sessionfinish(self):
     """
     所有case执行完毕后,生成html格式测试报告
     :return:
     """
     demo_util.pause_show_info("pytest_sessionfinish in TxtReport")
     file_dir = os.path.abspath(os.path.dirname(__file__))
     file_path = os.path.join(file_dir, "txt_report.txt")
     demo_util.gen_report_file(file_path, "txt test")
Example #2
0
 def pytest_sessionfinish(self):
     """
     所有case执行完毕后,生成html格式测试报告
     :return:
     """
     demo_util.pause_show_info("pytest_sessionfinish in HtmlReport")
     file_dir = os.path.abspath(os.path.dirname(__file__))
     file_path = os.path.join(file_dir, "html_report.txt")
     demo_util.gen_report_file(file_path, "html test")
Example #3
0
def test_gen_report_file(tmpdir):
    print("***run case gen_report_file")
    out_dir = str(tmpdir.mkdir("output").realpath())
    output_file = os.path.join(out_dir, "test")
    content = "test abc"
    demo_util.gen_report_file(output_file, content)
    assert os.path.isfile(output_file)
    with open(output_file) as f:
        result_content = f.read()
    assert result_content == content
Example #4
0
def test_gen_report_file(tmpdir):
    print("***run case gen_report_file")
    out_dir = str(tmpdir.mkdir("output").realpath())
    output_file = os.path.join(out_dir, "test")
    content = "test abc"
    demo_util.gen_report_file(output_file, content)
    assert os.path.isfile(output_file)
    with open(output_file) as f:
        result_content = f.read()
    assert result_content == content