askimed / nf-test

Simple test framework for Nextflow pipelines
https://www.nf-test.com
MIT License
146 stars 25 forks source link

Add classname attribute to testcase in junit xml output #228

Closed kenibrewer closed 4 months ago

kenibrewer commented 4 months ago

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.