7 messages in com.canoo.lists.webtestRE: [Webtest] FollowFrame
FromSent OnAttachments
Torben Tretau16 Oct 2002 05:49 
Dierk Koenig16 Oct 2002 06:40 
Torben Tretau16 Oct 2002 06:50 
Torben Tretau18 Oct 2002 06:22.zip
Dierk Koenig20 Oct 2002 06:22 
Torben Tretau21 Oct 2002 01:27.zip
Dierk Koenig21 Oct 2002 09:50 
Subject:RE: [Webtest] FollowFrame
From:Dierk Koenig (dier@canoo.com)
Date:10/20/2002 06:22:41 AM
List:com.canoo.lists.webtest

Hi Torben,

Thanx for the contribution.

However, it doesn't compile cleanly.

In FollowFrame gotoSubframe(context, getName()); is not found. I guess, you changed the superclass "Target" but oversee to enclose it in the zip.

To enable you testing your changes locally I posted the cvs contents and your additions to ftp://ftp.canoo.com/pub/CanooFunctionalTesting.zip (it will be automatically removed after some days)

This also includes the server.properties you asked for.

You will also find the way we use to create the documentation: xml files for the content, txt files for the examples. The html gets build along with the ant build.

cheers Mittie

-----Original Message----- From: webt@lists.canoo.com [mailto:webt@lists.canoo.com]On Behalf Of Torben Tretau Sent: Freitag, 18. Oktober 2002 15:23 To: webt@gate.canoo.com Subject: RE: [Webtest] FollowFrame

Now I have finished and attached an archive with tests, doc, etc. ..

Have fun, Torben

The following message was sent by "Dierk Koenig" <dier@canoo.com> on Wed, 16 Oct 2002 15:40:46 +0200.

looks perfekt!

Unit tests ideas (error messages) for: - there is no lastResponse - lastResponse does not contain a frameset - lastResponse contains multiple framesets - what if there is a <noframes> section?

Functional Tests by extending the selftest servlet with frames.

Check that the reporting is done correctly.

Congratulations Mittie

-----Original Message----- From: webt@lists.canoo.com [mailto:webt@lists.canoo.com]On Behalf Of Torben Tretau Sent: Mittwoch, 16. Oktober 2002 14:50 To: webt@gate.canoo.com Subject: [Webtest] FollowFrame

Hi List,

getting new into WebTest I quickly hacked a FollowFrame element as mentioned sometimes earlier from Dierk in a discussion here.. As I am new and surely I could misunderstood some things and made wrong, I post my first hack here.. Perhaps someone who is more into it can give me feedback on it and give me hints on what i could have done wrong..

------------------------- snip ------------------------------------------------- my add-on to the Target-class: (->creator: is it totally wrong placed here?) ... public WebResponse gotoSubframe(TestContext context, String framename) throws IOException, MalformedURLException, SAXException { WebResponse resp = null; try { installHtmlErrorHandlerIfNeeded(context); logText(context, "-> gotoSubframe(by name): " + framename); prepareConversation(context); resp = context.getLastResponse().getSubframeContents(framename); } catch (AuthorizationRequiredException are) { throw new TestStepFailedError("Authorization required for page: " + framename, this); } catch (HttpNotFoundException hnfe) { throw new TestStepFailedError(getStepId(context) + ": Page not found: " + framename, this); } finally { removeHtmlErrorHandlerIfNeeded(context); }

context.resetNextParameters(); context.setLastResponseForStep(resp, (Target) this);

return resp; } ... -----------------snap--------------------------------------------- --------------- my FollowFrame-class: package com.canoo.webtest.steps;

import com.canoo.webtest.engine.TestContext; import com.canoo.webtest.engine.TestStepSetupError; import com.canoo.webtest.engine.TestStepFailedError; import com.meterware.httpunit.WebLink; import com.meterware.httpunit.WebResponse; import org.xml.sax.SAXException;

import java.util.*;

public class FollowFrame extends Target { private String fName;

/** * Constructor used for instance creation as nested element by ant */ public FollowFrame() { super(); }

protected void doExecute(TestContext context) throws Exception { super.doExecute(context);

String[] subFrames = context.getLastResponse().getFrameNames(); boolean foundFrame = false; for (int i=0;i < subFrames.length; i++) { if(subFrames[i].equals(getName())) { foundFrame = true; } } if(!foundFrame) throw new TestStepFailedError(getStepId(context) + " Frame not found with name: " + getName(), this);

verifyParameters(); gotoSubframe(context, getName()); }

private void verifyParameters() { if (fName == null) { throw new TestStepSetupError("Required parameter name not set!", this); }

}

protected String getName() { return fName; }

public void setName (String newName) { fName = newName; }

public HashMap getParameterDictionary() { HashMap map = super.getParameterDictionary(); if (getName() != null) { map.put("name", getName()); } return map; }

protected void expandProperties() { super.expandProperties(); fName = expandDynamicProperties(fName); } }

----------------------------snap---------------------------------- -----------------

now a <followframe name="blub"/> works for me..

Looking forward for all feedback.. Bye, Torben