Skip to content

Commit

Permalink
LPS-40407 Smarter way of testing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchandotcom committed Oct 4, 2013
1 parent e60e142 commit 09def36
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 56 deletions.
79 changes: 75 additions & 4 deletions build-common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -951,14 +951,85 @@ Please set the environment variable ANT_OPTS to the recommended value of
<propertyregex
global="true"
input="${test.package}"
property="test.class"
property="test.package.dir"
regexp="\."
replace="/"
/>

<ant target="test-class">
<property name="test.class" value="${test.class}/*Test" />
</ant>
<if>
<available file="test/integration" type="dir" />
<then>
<resourcecount property="test.integration.other.count">
<fileset
dir="test/integration"
excludes="**/${test.package.dir}/*PersistenceTest.java"
includes="**/${test.package.dir}/*Test.java"
/>
</resourcecount>

<if>
<not>
<equals arg1="${test.integration.other.count}" arg2="0" />
</not>
<then>
<var name="test.class" value="**/${test.package.dir}/*Test" />

<ant target="test-cmd">
<property name="junit.forkmode" value="once" />
<property name="test.excludes" value="**/*PersistenceTest.class" />
<property name="test.type" value="integration" />
</ant>
</then>
</if>

<resourcecount property="test.integration.persistence.count">
<fileset
dir="test/integration"
includes="**/${test.package.dir}/*PersistenceTest.java"
/>
</resourcecount>

<if>
<not>
<equals arg1="${test.integration.persistence.count}" arg2="0" />
</not>
<then>
<var name="test.class" value="**/${test.package.dir}/*PersistenceTest" />

<ant target="test-cmd">
<property name="junit.forkmode" value="once" />
<property name="test.type" value="integration" />
</ant>
</then>
</if>
</then>
</if>

<if>
<available file="test/unit" type="dir" />
<then>
<resourcecount property="test.unit.count">
<fileset
dir="test/unit"
includes="**/${test.package.dir}/*Test.java"
/>
</resourcecount>

<if>
<not>
<equals arg1="${test.unit.count}" arg2="0" />
</not>
<then>
<var name="test.class" value="**/${test.package.dir}/*Test" />

<ant target="test-cmd">
<property name="junit.forkmode" value="perTest" />
<property name="test.type" value="unit" />
</ant>
</then>
</if>
</then>
</if>
</target>

<target name="test-unit" depends="compile,compile-test-unit">
Expand Down
55 changes: 3 additions & 52 deletions build-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3062,58 +3062,9 @@ Please set "ie.driver.zip" in test.properties to point to "IEDriverServer_x64_2.
</target>

<target name="test-package">
<propertyregex
global="true"
input="${test.package}"
property="test.class"
regexp="\."
replace="/"
/>

<resourcecount property="test.portal-impl.count">
<fileset dir="portal-impl/test" includes="**/${test.class}/*Test.java" />
</resourcecount>

<if>
<not>
<equals arg1="${test.portal-impl.count}" arg2="0" />
</not>
<then>
<ant dir="portal-impl" target="test-class" inheritAll="false">
<property name="test.class" value="${test.class}/*Test" />
</ant>
</then>
</if>

<resourcecount property="test.portal-service.count">
<fileset dir="portal-service/test" includes="**/${test.class}/*Test.java" />
</resourcecount>

<if>
<not>
<equals arg1="${test.portal-service.count}" arg2="0" />
</not>
<then>
<ant dir="portal-service" target="test-class" inheritAll="false">
<property name="test.class" value="${test.class}/*Test" />
</ant>
</then>
</if>

<resourcecount property="test.util-java.count">
<fileset dir="util-java/test" includes="**/${test.class}/*Test.java" />
</resourcecount>

<if>
<not>
<equals arg1="${test.util-java.count}" arg2="0" />
</not>
<then>
<ant dir="util-java" target="test-class" inheritAll="false">
<property name="test.class" value="${test.class}/*Test" />
</ant>
</then>
</if>
<ant dir="portal-service" target="test-package" inheritAll="false" />
<ant dir="portal-impl" target="test-package" inheritAll="false" />
<ant dir="util-java" target="test-package" inheritAll="false" />
</target>

<target name="test-unit">
Expand Down

0 comments on commit 09def36

Please sign in to comment.