[Webtest] Custom Step VerifyContentType added to community web site

Paul King webtest@lists.canoo.com
Tue, 10 Aug 2004 22:16:17 +1000


Marc Guillemot wrote:

> Hi Paul,
> 
> it's not noise, these are good contributions.
> 
> I had written such a verifycontenttype task for my purposes too but I 
> didn't want to commit it, because I thought that it was not general 
> enough and would contribute to a uncontrolled growth of tasks with not 
> so many differences.
> 
> My first suggestion would to have a verifyresponseheader, which could be 
> used to check content type as well as other headers sent by the server.

I was going to write it this way too but there was a short-term need and 
the verifyContentType step (simple as it is) was born. If I get time I 
will look at the verifyHeaders approach.

> My alternative solution would be to provide such properties of the last 
> response as dynamic properties. With a new general purpose "verify" 
> task, we could write tests like <verify expected="image/gif" 
> value="#{lastResp.contentType}"/>. or <verify expected="404" 
> value="#{lastResp.responseCode}"/>

This would be good. We could do away with verifyxpath and simply use 
storexpath and then verify against an expected value. Otherwise, we 
should have verifyregex for symmetry, etc.

> Marc.
> 
> 
> Paul King wrote:
> 
>>
>>
>> I have added the following custom step to the community web site:
>>
>> http://webtest-community.canoo.com/wiki/space/VerifyContentType
>>
>>  From the description:
>>
>> This custom step provides the ability to check content type of a page.
>>
>> An example:
>>
>> <target name="testImage" depends="init">
>> <testSpec name="testImage">
>>   &config;
>>   <steps>
>>     <invoke
>>       stepid="Load Image"
>>       url="resources/images/linevertical.gif"/>
>>     <verifyContentType
>>       stepid="Should be a gif"
>>       text="image/gif"/>
>>   </steps>
>> </testSpec>
>> </target>
>>
>> Cheers, Paul.
>> P.S. Sorry for all the noise, but I have to document all custom steps 
>> for a project that my company is working on.
>>
>>
>> _______________________________________________
>> WebTest mailing list
>> WebTest@lists.canoo.com
>> http://lists.canoo.com/mailman/listinfo/webtest
>>
> 
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
> 
>