[Webtest] Re: Trying to make some custom steps that only warn rather than fail the build

Lynn Walton webtest@lists.canoo.com
Sun, 24 Aug 2003 01:21:09 -0500

I have a particular use of canoo where I want to use it to test all the 
internal (site relative or document relative) links in app where almost 
all the the pages require being logged in.  I have a script that reads a 
particular directory on the file system to determine all the links that 
need checked and it dynamically writes out a canoo test that looks 
something like this (psuedo code):

  <config> ....</config>
   invoke the login page
   set the fields with the login info
   submit it
   verify the successful login page
   then now that we have the necessary cookie/session info  continue in 
this same testSpec with checking all the internal links as follows:
    for each link I do:
   <invoke  stepid=" get /blah/blah.html " url="/blah/blah.html"  />
   <not stepid=" /blah/blah.html contained Internal Server Error ">
      <verifytext stepid="500 Error" text="500 Internal Server Error"/>
     just to make sure I have no 404's or 500 Internal Server Errors.

This works .. but what I really want to do and attempted unsuccessfully 
to do is make a couple custom steps so that I could have the  build not  
fail with a bad one (unless it's the first login page invoke), but 
rather just output a warning and continue checking the next links.

I changed the  invoke step on all the links besides the first login one, 
to an <invokeNoFail> custom step that just warns instead of throwing 
StepFailedException.  That works.

Then I tried changing the <not> step to a custom one and though I tried 
several things ..  I ended up usually with the "Task must be of type 
Step" warning.

Has anyone else done something like this and/or could anyone give me any 
pointers on roughly what I'd need to do to get this idea working?

BTW, I know this isn't a typical usage of canoo (and I use canoo in a 
more typical fashion for other things) but I have reasons why doing this 
kind of a test is useful for this particular application.