Skip to content

Commit

Permalink
Use junit-platform-console-standalone so that both JUnit4 and JUnit5 …
Browse files Browse the repository at this point in the history
…tests can be run
  • Loading branch information
theangrydev authored and robert.sloss committed Jan 8, 2019
1 parent ffd8905 commit 60dee71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
5 changes: 1 addition & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</target>

<target name="test">
<test jar="${test.jar.path}" classpathref="all.jars" reports="${reports}"/>
<test jar="${test.jar.path}" classpathref="all.jars" reports="${reports}" package="com.googlecode.yatspec"/>
</target>

<target name="package">
Expand Down
2 changes: 1 addition & 1 deletion build/build.dependencies
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mvn:org.hamcrest:hamcrest-core:jar:1.2
mvn:org.hamcrest:hamcrest-library:jar:1.2
mvn:junit:junit-dep:jar|sources:4.8.2
mvn:org.junit.platform:junit-platform-console-standalone:jar:1.3.2

mvn:antlr:antlr:jar:2.7.7
mvn:org.antlr:stringtemplate:jar:3.2.1
Expand Down
25 changes: 13 additions & 12 deletions build/macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,30 @@
<attribute name="jar"/>
<attribute name="reports"/>
<attribute name="classpathref"/>
<attribute name="package"/>

<sequential>
<mkdir dir="@{reports}"/>
<property name="unzipped.jar" value="@{reports}.unzipped.jar"/>
<mkdir dir="${unzipped.jar}"/>
<unzip dest="${unzipped.jar}" src="@{jar}"/>
<junit printsummary="no" fork="on" failureproperty="failed" forkmode="once">
<!-- https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher -->
<java classpathref="@{classpathref}" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true">
<arg value="--select-package=@{package}"/>
<arg value="--fail-if-no-tests"/>
<arg line="--reports-dir @{reports}"/>
<sysproperty key="yatspec.output.dir" value="@{reports}"/>
<sysproperty key="yatspec.index.enable" value="true"/>
<!--<jvmarg value="-Xdebug"/>-->
<!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,address=nurofen:5005,suspend=y"/>-->
<classpath refid="@{classpathref}"/>
<formatter type="xml"/>
<batchtest todir="@{reports}">
<fileset dir="${unzipped.jar}">
<include name="**/*Test.class"/>
<exclude name="**/*$*"/>
</fileset>
</batchtest>
</junit>

</java>
<junitreport todir="@{reports}">
<fileset dir="@{reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="@{reports}/html"/>
</junitreport>
<delete dir="${unzipped.jar}"/>
<fail message="Tests failed" if="failed"/>
</sequential>
</macrodef>

Expand Down

0 comments on commit 60dee71

Please sign in to comment.