Hi,

this is a typical Ant "problem": properties can't pop up.

In your case I would favor an other approach that will allow you to run "Create campaign" many times (may be needed during conception or while looking for a problem) with a single run of usecases/CheckAdvertisements.xml#create. To do that you can for instance let usecases/CheckAdvertisements.xml#create write the id it retrieves in some file using <echo file=".." message="theId=#{theJustRetrievedId}"/> and perform a <property file="..."/> in (or before) "Create campaign". A good location for the file may be the folder where your write your WebTest results (or a subfolder of it). Then you just have to ensure that the sequence of the tests in your test suite is correct to have the id available before "create campaign" is called. You can even use <fail unless="..."> to make this later fail if no id is available.

Marc.

Sven Haiges wrote:
Hi all,

after I read through the sample pages tipps & trick, I refactored all functional tests I do on an "advertisement" object into four targets for create read update and delete. CRUD.

I now do have the need to create an advertisement (and store the id of that advertisement) before I go on with creating a "Campaign".

That's what I do:

    <target name="create">
        <ant antfile="usecases/CheckAdvertisements.xml" target="create" />
        <echo message="The ad id used for this campaign is ${adId}"/>
<webtest name="Create campaign">
            &config;
<steps> &login; &logout;
            </steps>
        </webtest>
    </target>

As you can see, I am calling the ad's create target to create an ad. Thsi target will also save the ad id to an ant property, but I cannot access this property as it is not returned to teh calling ant target in another build file.

I could of course put all targets into one large build file, then I could easily access all properties I ever created. But having one file for each domain also makes sense from a logical point of view. I also would not like to use an identifier different from id, (like name of ad, etc.) as id is simply the only one that is unique. All others could appear multiple times... and may cause strange problems.

Any thoughts on that?

Cheers\
Sven

--
Sven Haiges
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

Skype: hansamann
Personal Homepage, Wiki & Blog: http://www.svenhaiges.de

Subscribe to the Grails Podcast:
http://hansamann.podspot.de/rss

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to