[Webtest] Sleep Task?
Matt Raible
webtest@lists.canoo.com
Wed, 8 Oct 2003 12:51:51 -0600
--Apple-Mail-4--714917804
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
I found that after adding js.jar to my classpath, I didn't need the
sleep task. However, since I modified it for the latest build, I
figured I'd submit it to this list in hopes of getting it added to the
source tree. If there is a more formal process of submitting patches,
please let me know.
Thanks,
Matt
--Apple-Mail-4--714917804
Content-Disposition: attachment;
filename=Sleep.java
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
x-unix-mode=0644;
name="Sleep.java"
package com.canoo.webtest.steps;
import com.canoo.webtest.engine.Context;
import com.canoo.webtest.engine.StepExecutionException;
import java.util.*;
/**
* Sleeps for a period of time in seconds.
*
* Sleep Class
* @author Richard Hill
* @version 1.0
*/
public class Sleep extends Step {
private String seconds;
public void doExecute(Context context) throws Exception {
expandProperties();
verifyParameters();
doSleep();
}
private void doSleep() {
long sleepTime = (long) new Integer(seconds).intValue();
try {
Thread.sleep(sleepTime * 1000);
} catch (InterruptedException ie) {
}
}
protected void verifyParameters() {
try {
new Integer(seconds);
} catch (NumberFormatException nfe) {
throw new StepExecutionException("seconds must be an integer...check your value!");
}
}
public void expandProperties() {
seconds = expandDynamicProperties(seconds);
}
public String getSeconds() {
return seconds;
}
public Map getParameterDictionary() {
Map map = new HashMap();
map.put("seconds", seconds);
return map;
}
public void setSeconds(String seconds) {
this.seconds = seconds;
}
}
--Apple-Mail-4--714917804
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
On Thursday, September 25, 2003, at 04:12 PM, Richard Hill wrote:
> Matt,
> I'm running an older version of canoo and attached is the sleep step
> that I
> use.
>
> Remember to add the step to the TestStepSequence.java
>
> public void addSleep(Sleep step) {
> step.setStepType("sleep");
> addStep(step);
> }
>
> Step usage:
>
> <sleep
> stepid="Waiting for something to complete"
> seconds="5"/>
>
> - Richard
>
> -----Original Message-----
> From: Matt Raible [mailto:matt@raibledesigns.com]
> Sent: Thursday, September 25, 2003 12:41 PM
> To: webtest@gate.canoo.com
> Subject: [Webtest] Sleep Task?
>
>
> Any chance that the sleep task has been added:
>
> http://lists.canoo.com/pipermail/webtest/2003q2/000766.html
>
> I could really use something like this in my current project (or a
> workaround). The reason is b/c we have a splash page that says
> "searching"
> and keeps re-submitting itself with JavaScript - I need to pause and
> wait
> for
> this page to go to the next page - and then verify it's title.
>
> Thanks,
>
> Matt
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
> <Sleep.java>
--Apple-Mail-4--714917804--