ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Krammer" ...@altaica.de>
Subject Accessing Properties from Sub-Projects
Date Tue, 02 Oct 2007 18:54:58 GMT
Hello everybody,

I use Ant together with a Test framework for Web applications (Canoo
WebTest). The main structure of the Ant files is the following:

main build.xml:

<project name="example" default="wt.deployToTest">

	<property name="webtest.home" value="C:\eclipse\webtest-2.5"/>	
	<import file="${webtest.home}/webtest.xml" />
	
	<property name="wt.testInWork" value="tests/jsfTest.xml"/>

	<target name="wt.deployToTest" depends="wt.full">
		<property file="tests/error.tmp" />
		<echo message="Test failure is: ${test.failure}" />
	</target>
</project>

Excerpt from the webtest.xml:

...
<target name="wt.testInWork">
	<ant dir="${wt.testInWork.dir}" antfile="${wt.testInWork.file}"

		inheritRefs="true"/>
</target>
...

Excerpt from tests/jsfTest.xml:

<project name="demo" default="test">

	<target name="test">

		<webtest name="Check if result contains name">
			...
		</webtest>
		
		<echo>
			test.failure: ${test.failure}
		</echo>
	</target>
</project>


If the test fails, the ${test.failure} property is set within the project in
the jsfTest.xml file. But the problem is that I need the value of this
property in the main build.xml file, since I want to decide further actions
on basis of this value after all tests have been run.

I know one simple solution: To export the test.failure property to a file
and read it in the build.xml. But this solution has one major drawback: The
final test suite will consist of lots of webtest projects in different xml
files (one per developer). The problem is to ensure that the test.failure
value is exported in all files, in each single test's xml. If any one
developer omits the export, a failure of his tests will not be taken into
account for further decisions (like deployment to a productive system).
Obviously, this is not perfect.

Is there any simpler solution to this problem where no entry is needed in
the test's xml files?

Thanks for any help.

Regards,
 Christoph


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message