openclover / clover

This repository contains source code of OpenClover Core as well as its integrations: Clover-for-Ant, Clover-for-Eclipse and Clover-for-IDEA plugins. Sources are licensed under Apache 2.0 license.
Other
61 stars 16 forks source link

Feature Request: get the valid test results (coverage data) from an ant-bulid test run via "@RunWith(Parameterized.class)". Further informations can be found in the separate project "clover-examples/parameterized-junit4-example". #243

Open udoline opened 7 months ago

udoline commented 7 months ago

Here is a sample, how it will be using

<target name="runUnitParamterizedTestBatch"  depends="check.tns.admin, compileTests, runTests.init" if="clover.active"
    description="workaround: detecting correct coverage data via openclover-4.5.1 during paramterized test executions">
    <property name="junit.unittest.module.name" value="required" />
    <property name="junit.unittest.selector" value="required" />
    <property name="junit.unittest.forkmode" value="once" />
    <property name="junit.unittest.timeout" value="240" />
    <property name="junit.unittest.maxmemory" value="334m" />
    <junit fork="yes" forkmode="${junit.unittest.forkmode}" timeout="${junit.unittest.timeout}" maxmemory="${junit.unittest.maxmemory}" 
           showoutput="yes" printsummary="on" haltonfailure="false" haltonerror="false" failureproperty="tests.failures" errorproperty="tests.errors">

        <formatter type="xml">
        <!-- customized junit formatter -->
        <formatter classname="org.openclover.ant.taskdefs.optional.junit.CloverJUnitResultFormatter"/>

        <batchtest todir="${dir.report.junit}">
            <fileset dir="${dir.up}/${junit.unittest.module.name}/${dir.src.test}">
                <selector refid="${junit.unittest.selector}" />
            </fileset>
        </batchtest>
    </junit>
</target>
marek-parfianowicz commented 7 months ago

Thank you for your contribution. I'm working on one large refactoring task in OpenClover, once I finish it, probably in a week or two, I will review your changes.