Медленное модульное тестирование с помощью Cobertura

Я недавно интегрировал Cobertura в свои сценарии сборки Ant, и мне интересно, правильно ли я сделал это, потому что это значительно сократило время, необходимое для запуска модульных тестов.

Вот пример вывода консоли:

...
[junit] Running gov.nyc.doitt.gis.webmap.strategy.markup.ViewportDeterminingMarkupStrategyTest
[junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.38 sec
[junit] Flushing results...
[junit] Flushing results done
[junit] Cobertura: Loaded information on 282 classes.
[junit] Cobertura: Saved information on 282 classes.
[junit] Running gov.nyc.doitt.gis.webmap.strategy.markup.VisibleFeatureTypesMarkupInfoTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.434 sec
[junit] Flushing results...
[junit] Flushing results done
[junit] Cobertura: Loaded information on 282 classes.
[junit] Cobertura: Saved information on 282 classes.
[junit] Running gov.nyc.doitt.gis.webmap.strategy.markup.basemap.BasemapByViewportStrategyTest
[junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 2.016 sec
[junit] Flushing results...
[junit] Flushing results done
[junit] Cobertura: Loaded information on 282 classes.
[junit] Cobertura: Saved information on 282 classes.
[junit] Running gov.nyc.doitt.gis.webmap.strategy.markup.basemap.BasemapByZoomLevelAndCenterPointStrategyTest
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 1.853 sec
[junit] Flushing results...
[junit] Flushing results done
[junit] Cobertura: Loaded information on 282 classes.
[junit] Cobertura: Saved information on 282 classes.
...

Кажется подозрительным, что после каждого запуска теста Кобертура говорит:

[junit] Cobertura: Loaded information on 282 classes.
[junit] Cobertura: Saved information on 282 classes.
...

Вот моя задача модульного тестирования из моего сценария сборки Ant:

    <target name="unit-test" depends="compile-unit-test">
    <delete dir="${reports.xml.dir}" />
    <delete dir="${reports.html.dir}" />
    <mkdir dir="${reports.xml.dir}" />
    <mkdir dir="${reports.html.dir}" />

    <junit fork="yes" dir="${basedir}" failureProperty="test.failed" printsummary="on">
        <!--
                Note the classpath order: instrumented classes are before the
                original (uninstrumented) classes.  This is important.
            -->
        <classpath location="${instrumented.dir}" />
        <classpath refid="test-classpath" />

        <formatter type="xml" />
        <test name="${testcase}" todir="${reports.xml.dir}" if="testcase" />
        <batchtest todir="${reports.xml.dir}" unless="testcase">
            <fileset dir="TestSource">
                <include name="**/*Test.java" />
                <exclude name="**/XmlTest.java" />
                <exclude name="**/ElectedOfficialTest.java" />
                <exclude name="**/ThematicManagerFixturesTest.java" />
            </fileset>
        </batchtest>
    </junit>
</target>

Кажется ли моя установка и вывод правильными? Нормально ли, что модульные тесты при запуске в одиночку занимают 2,234 секунды, а при запуске в сценарии сборки с Cobertura - 3 минуты?

8
задан palacsint 22 May 2014 в 11:46
поделиться