Exemplo n.º 1
0
def _write_xunit_output(test_cases, result, output_xml, job_id):
    xml = X.convert_suite_and_result_to_xunit(test_cases, result)

    log.info("Writing Xunit XML output to {f}".format(f=output_xml))
    with open(output_xml, "w+") as f:
        f.write(str(xml))

    # give the user some feedback that tests were run.
    xsuite = X.XunitTestSuite.from_xml(output_xml)
    slog.info(str(xsuite))
    slog.info(xsuite)
    nfailed_tests = xsuite.nfailure
    nerrors = xsuite.nerrors

    jenkins_xml = X.xunit_file_to_jenkins(output_xml, job_name=job_id)

    output_dir = os.path.dirname(output_xml)
    jenkins_name = "_".join(["jenkins", os.path.basename(output_xml)])
    jenkins_xml_file = os.path.join(output_dir, jenkins_name)

    log.info("Writing Jenkins XML output to {f}".format(f=jenkins_xml_file))
    with open(jenkins_xml_file, "w") as f:
        f.write(str(jenkins_xml))

    log.info(
        "Completed running {t} tests. {e} errors and {n} failed tests.".format(
            e=nerrors, n=nfailed_tests, t=len(xsuite)
        )
    )
Exemplo n.º 2
0
def _write_xunit_output(test_cases, result, output_xml, job_id):
    xml = X.convert_suite_and_result_to_xunit(test_cases, result)

    log.info("Writing Xunit XML output to {f}".format(f=output_xml))
    with open(output_xml, 'w+') as f:
        f.write(str(xml))

    # give the user some feedback that tests were run.
    xsuite = X.XunitTestSuite.from_xml(output_xml)
    slog.info(str(xsuite))
    slog.info(xsuite)
    nfailed_tests = xsuite.nfailure
    nerrors = xsuite.nerrors
    nskipped = xsuite.nskipped

    jenkins_xml = X.xunit_file_to_jenkins(output_xml, job_name=job_id)

    output_dir = os.path.dirname(output_xml)
    jenkins_name = "_".join(['jenkins', os.path.basename(output_xml)])
    jenkins_xml_file = os.path.join(output_dir, jenkins_name)

    log.info("Writing Jenkins XML output to {f}".format(f=jenkins_xml_file))
    with open(jenkins_xml_file, 'w') as f:
        f.write(str(jenkins_xml))
    
    log.info("Completed running {t} tests. {s} skipped, {e} errors, and {n} failed tests.".format(e=nerrors, n=nfailed_tests, s=nskipped, t=len(xsuite)))
Exemplo n.º 3
0
def _write_xunit_output(test_cases, result, output_xml, job_id):
    """Returns a XunitTestSuite instance"""
    xml = X.convert_suite_and_result_to_xunit(test_cases, result)

    log.debug("Writing Xunit XML output to {f}".format(f=output_xml))
    with open(output_xml, 'w+') as f:
        f.write(str(xml))

    xsuite = X.XunitTestSuite.from_xml(output_xml)
    # give the user some feedback that tests were run.
    # slog.info(str(xsuite))
    # slog.info(xsuite)
    nfailed_tests = xsuite.nfailure
    nerrors = xsuite.nerrors
    nskipped = xsuite.nskipped

    jenkins_xml = X.xunit_file_to_jenkins(output_xml, job_name=job_id)

    output_dir = os.path.dirname(output_xml)
    jenkins_name = "_".join(['jenkins', os.path.basename(output_xml)])
    jenkins_xml_file = os.path.join(output_dir, jenkins_name)

    log.info("Writing Jenkins XML output to {f}".format(f=jenkins_xml_file))
    with open(jenkins_xml_file, 'w') as f:
        f.write(str(jenkins_xml))
    
    log.info("Completed running {t} tests. {s} skipped, {e} errors, and {n} failed tests.".format(e=nerrors, n=nfailed_tests, s=nskipped, t=len(xsuite)))
    return xsuite
Exemplo n.º 4
0
def _generate_jenkins_xml(test_name):
    suite, result = _get_and_run_test_suite()
    x = X.convert_suite_and_result_to_xunit(
        [suite], result, name="pbsmrtpipe.tests.test_xunit_output")
    xunit_file = tempfile.NamedTemporaryFile(suffix=".xml").name
    with open(xunit_file, "w") as xml_out:
        xml_out.write(str(x))
    return X.xunit_file_to_jenkins(xunit_file, test_name)