Hallo Bernd,

programming in my email programm...

import com.canoo.webtest.steps.request.InvokePage
import com.canoo.webtest.steps.*
import com.gargoylesoftware.htmlunit.WebRequestSettings;

class Bookmark extends Step
{
  String as

  void doExecute() {
    project.properties.get("bookmarks", [:])[as] =
context.currentResponse.webResponse.requestUrl
  }
}

class MyInvoke extends InvokePage
{
  String bookmark

  protected Page findTarget() {
    if (bookmark)
    {
       def url = project.properties["bookmarks"][bookmark]
       WebRequestSettings settings = new WebRequestSettings(url);
       return getResponse(settings);
    }
    else
      super.doExecute()
  }

  protected void verifyParameters() {
    // simple version, no verification
  }
}

and for instance subclassing WebTestCase, add the definitions of your tasks:

project.addTaskDefinition("bookmark", Bookmark)
// change the original invoke task
project.addTaskDefinition("invoke", MyInvoke)


As written above, I've typed this code directly in the email (therefore
no idea if it compiles or not) and the code should surely be made safer.
Nevertheless this should give you a good idea.

Cheers,
Marc.
-- 
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com

Bernd Schiffer wrote:
> 
> Marc Guillemot wrote:
>> this would just be a facility for invoke, isn't it?
>>
>> Do you know that you can easily define new steps, or customized steps
>> for your own project?
>>
> 
> Theoretically: yes :-) Can you point me to something to play with?
> 
> Cheers, 
>    Bernd

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

Reply via email to