ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knuplesch, Jürgen <Juergen.Knuple...@icongmbh.de>
Subject AW: Accessing Properties from Sub-Projects
Date Wed, 10 Oct 2007 12:31:14 GMT
I used antcallback from antcontrib in my Buildfile:

        <antcallback target="junittests" inheritall="false" return="dope.test.failed">
          <param name="cvs.project" value="@{dope.modul}" />
          <param name="dope.buildtime" value="${dope.buildtime}" />
        </antcallback>

So I got back if one of my tests failed.

antFetch is the same für calling external Buildfiles.

Use http://sourceforge.net/project/showfiles.php?group_id=36177 to get antcontrib.



-- 
Jürgen Knuplesch                    www.icongmbh.de
icon Systemhaus GmbH                Tel. +49 711 806098-275
Sophienstraße 40                    
D-70178 Stuttgart                   Fax. +49 711 806098-299

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Steve Loughran [mailto:stevel@apache.org] 
Gesendet: Mittwoch, 3. Oktober 2007 10:27
An: Ant Users List
Betreff: Re: Accessing Properties from Sub-Projects

Christoph Krammer wrote:
> 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.

  the ant-contrib extensions on sourceforge have a task to get results back

> 
> 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.

No, it isnt

1. you should have a common build file that is pulled in to the main file with <import>;
it can do the result output

2. you can create a test.failed file for every project
(build/results/tests.${ant.project.name}.failed) if -and only  if- the tests for that project
failed.

3. then, the toplevel file uses <available> to look for any file matching that pattern,
which implies that the test failed.

-steve




-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

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


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


Mime
View raw message