Zdravim,
jako dlouholety uzivatel Antu nemohu prijit na jednu vec a myslim si,
ze to zacala delat az JUnit 4.X. Kazdopadne mam takovyhle nejaky task:
<target name="test" depends="init,compile-test">
<junit fork="yes" haltonfailure="no">
<batchtest fork="yes"
todir="${reports-tests}">
<fileset
dir="${src-test-java}">
<include name="**/*Test.java" />
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
<formatter type="plain"
usefile="false" />
<formatter type="xml"
usefile="yes" />
<classpath refid="cp-test-run"
/>
<bootclasspath
refid="bcp-test-run" />
<sysproperty
key="org.omg.CORBA.ORBClass" value="org.jacorb.orb.ORB" />
<sysproperty
key="org.omg.CORBA.ORBSingletonClass"
value="org.jacorb.orb.ORBSingleton" />
</junit>
</target>
V balicku ${src-test-java} jsou soubory NecoTest, NecoJinehoTest s
testy jednotek, ale bohuzel take nektere dalsi artefakty, ktere sice
vyhovuji masce *Test.java, ale neobsahuji vlastni JUnit testy (jsou to
napriklad vygenerovane stuby pro CORBA klienty a podobne). Problem je,
ze se to JUnitu nejak nelibi a ja nevim, jak docilit toho, aby takove
soubory proste preskocil. Mam pak v reportech spoustu takovychto chyb,
ktere nejen rusi, ale borti nas CI tool:
ServiceDescriptorLoader.ServiceDescriptorLoaderTest.initializationError0
0.0060 1
structTest.StructSimpleTest.initializationError0 0.0070 1
structTestContext.gen.Test.initializationError0 0.0060 77
structTestContext.gen.Test.initializationError1 0.0010 77
structTest.gen.Test.initializationError0 0.0070 156
structTest.gen.Test.initializationError1 0.0010 156
S temito backtracy:
java.lang.Exception: No runnable methods
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
--
Lukas Zapletal
http://lukas.zapletalovi.com