askimed/nf-test

Add classname attribute to testcase in junit xml output

Closed this issue · 0 comments

As shown in this unofficial documentation of the junitxml format. Within a testsuite element it is customary to include the classname attribute on each testcase underneath it.

Current output:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
    <testsuite name="Test Process GATK4_HAPLOTYPECALLER" time="109.199" tests="4" skipped="0"
        failures="0" timestamp="2024 07 08 15:48:29">
        <testcase name="homo_sapiens - [bam, bai] - fasta - fai - dict" time="36.809"
            status="PASSED"></testcase>
        <testcase name="homo_sapiens - [cram, crai] - fasta - fai - dict" time="26.686"
            status="PASSED"></testcase>
        <testcase name="homo_sapiens - [cram, crai] - fasta - fai - dict - sites - sites_tbi"
            time="22.962" status="PASSED"></testcase>
        <testcase
            name="homo_sapiens - [cram, crai, dragstr_model] - fasta - fai - dict - sites - sites_tbi"
            time="22.736" status="PASSED"></testcase>
    </testsuite>
</testsuites>

Desired output:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
    <testsuite name="Test Process GATK4_HAPLOTYPECALLER" time="109.199" tests="4" skipped="0"
        failures="0" timestamp="2024 07 08 15:48:29">
        <testcase classname="Test Process GATK4_HAPLOTYPECALLER" name="homo_sapiens - [bam, bai] - fasta - fai - dict" time="36.809"
            status="PASSED"></testcase>
        <testcase classname="Test Process GATK4_HAPLOTYPECALLER" name="homo_sapiens - [cram, crai] - fasta - fai - dict" time="26.686"
            status="PASSED"></testcase>
        <testcase classname="Test Process GATK4_HAPLOTYPECALLER" name="homo_sapiens - [cram, crai] - fasta - fai - dict - sites - sites_tbi"
            time="22.962" status="PASSED"></testcase>
        <testcase classname="Test Process GATK4_HAPLOTYPECALLER" name="homo_sapiens - [cram, crai, dragstr_model] - fasta - fai - dict - sites - sites_tbi"
            time="22.736" status="PASSED"></testcase>
    </testsuite>
</testsuites>

This classname attribute gets used to group testcases by some downstream report writers and parsers such as junit2html.