Here are 2 files from ant4hg project.
I use : <au:plainlistener logLevel="${log.level}" /> to set log level and
<au:logcapturer /> to cacth them.

2009/7/10 Martijn Kruithof <j...@kruithof.xs4all.nl>

> Hello
>
> I am trying to test the adaptet get task using antunit, but I keep getting
> failures i cannot explain
> I do run the testcase in a simple build file without using antunit and the
> log does contain the correct line, when running from antunit the
> assertLogContains does not match. Is there any way to see the log of the
> task running inside antunit?
>
> Similar issue for a failure, when running independent of antunit I do see
> the BuildException with the message wanted, when running from antunit,
> another exception is claimed to be thrown (with another message).
>
> How do I troubleshoot these issues using antunit?
>
> Br Martijn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
>
>
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="ant4hg-tests" basedir="." default="help" xmlns:au="antlib:org.apache.ant.antunit" xmlns="antlib:org.apache.tools.ant">

	<taskdef resource="net/sourceforge/ant4hg/antlib.xml" classpath="../lib/ant4hg.jar" />
	<taskdef resource="org/apache/ant/antunit/antlib.xml" uri="antlib:org.apache.ant.antunit" classpath="../lib/ant-antunit.jar" />

	<property name="tmp.dir" value="ant4hg-test-dir" />
	<property name="log.level" value="info" /><!-- debug | info -->

	<target name="help" description="Print help">
		<echo message="Usage: " />
		<echo message="> ant all" />
		<echo message="  execute all tests" />
	</target>

	<target name="all" depends="f001-init,f002-status,f003-log,f004-add,f005-remove,f006-commit,f007-update" description="Execute all tests">
		<delete dir="${tmp.dir}" />
	</target>

	<target name="f001-init" description="Execute init tests">
		<test functionnality="f001" />
	</target>

	<target name="f002-status" description="Execute status tests">
		<test functionnality="f002" />
	</target>

	<target name="f003-log" description="Execute log tests">
		<test functionnality="f003" />
	</target>

	<target name="f004-add" description="Execute add tests">
		<test functionnality="f004" />
	</target>

	<target name="f005-remove" description="Execute remove tests">
		<test functionnality="f005" />
	</target>

	<target name="f006-commit" description="Execute commit tests">
		<test functionnality="f006" />
	</target>

	<target name="f007-update" description="Execute update tests">
		<test functionnality="f007" />
	</target>

	<!-- FUNCTION : execute test -->
	<macrodef name="test">
		<attribute name="functionnality" />
		<sequential>
			<property name="@{functionnality}.dir" value="${tmp.dir}/@{functionnality}" />
			<au:antunit>
				<propertyset id="test-values">
					<propertyref prefix="@{functionnality}" />
				</propertyset>
				<fileset dir="." includes="@{functionnality}*.xml" />
				<au:plainlistener logLevel="${log.level}" />
			</au:antunit>
		</sequential>
	</macrodef>

</project>
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="F001-init" basedir="." default="setUp" xmlns:au="antlib:org.apache.ant.antunit" xmlns="antlib:org.apache.tools.ant">

	<taskdef resource="net/sourceforge/ant4hg/antlib.xml" classpath="../lib/ant4hg.jar" />
	<taskdef resource="org/apache/ant/antunit/antlib.xml" uri="antlib:org.apache.ant.antunit" classpath="../lib/ant-antunit.jar" />

	<target name="setUp">
		<echo message=" " />
		<au:logcapturer />

		<!-- init dir -->
		<mkdir dir="${f001.dir}" />
		<au:assertFileExists file="${f001.dir}" />
		<au:assertFileDoesntExist file="${f001.dir}/.hg" />

	</target>

	<!-- create repository -->
	<target name="testInit">
		<echo message=">> F001-init testInit" />

		<hg cmd="init" dir="${f001.dir}" />
		<au:assertFileExists file="${f001.dir}/.hg" />
		<touch file="${f001.dir}/init1.txt" />
		<hg cmd="status" dir="${f001.dir}" />
		<au:assertLogContains text="unknown init1.txt" level="info" />
	</target>

	<target name="tearDown">
		<delete dir="${f001.dir}" />
		<au:assertFileDoesntExist file="${f001.dir}" />
	</target>


</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to