[Webtest] Adding User Agent to
Mike Los
webtest@lists.canoo.com
Mon, 6 May 2002 13:33:01 -0400
This is a multi-part message in MIME format.
------_=_NextPart_001_01C1F524.12518260
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
Please consider adding the ability to specify a user agent attribute =
(e.g., userAgent) as part of the config element.
This would allow the test to include a specific user agent string; e.g., =
<config userAgent=3D"Mozilla/4.0" ...>
I believe the principal coding changes are isolated to =
engine/TestConfig.java and steps/Setup.java
I just started working with webtest so I don't know yet where a self =
test might be included or how to affect any related docs.
I've included diffs against build 222 at the end of this message.
Thanks for considering this,
Michael Los
RCS file: =
/repositories/cvs/public/webtest/src/com/canoo/webtest/steps/Setup.java,v=
retrieving revision 1.6
diff -r1.6 Setup.java
24a25,27
> WebConversation wc =3D new WebConversation();
> =
wc.setUserAgent(context.getTestSpecification().getConfig().getUserAgent()=
);
>
26c29
< context.setWebConversation(new WebConversation());
---
> context.setWebConversation(wc);
$ cvs diff TestConfig.java
Index: TestConfig.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: =
/repositories/cvs/public/webtest/src/com/canoo/webtest/engine/TestConfig.=
java,v
retrieving revision 1.21
diff -r1.21 TestConfig.java
26a27,28
> private String fUserAgent =3D null;
>
375a378,387
> public void setUserAgent(String userAgent)
> {
> fUserAgent =3D userAgent;
> }
>
> public String getUserAgent()
> {
> return fUserAgent;
> }
>
384a397
> map.put("userAgent", getUserAgent());
------_=_NextPart_001_01C1F524.12518260
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.5762.3">
<TITLE>Adding User Agent to </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Arial">Hi,</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Please consider adding the ability to =
specify a user agent attribute (e.g., userAgent) as part of the config =
element.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">This would allow the test to include a =
specific user agent string; e.g., <config =
userAgent=3D"Mozilla/4.0" ...></FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I believe the principal coding changes =
are isolated to engine/TestConfig.java and steps/Setup.java</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I just started working with webtest so =
I don't know yet where a self test might be included or how to affect =
any related docs.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I've included diffs against build 222 =
at the end of this message.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks for considering this,</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Michael Los</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">RCS file: =
/repositories/cvs/public/webtest/src/com/canoo/webtest/steps/Setup.java,v=
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">retrieving revision 1.6</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">diff -r1.6 Setup.java</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">24a25,27</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">> =
WebConversation wc =3D new =
WebConversation();</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">> =
=
wc.setUserAgent(context.getTestSpecification().getConfig().getUserAgent()=
);</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">26c29</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">< =
context.setWebConversation(new =
WebConversation());</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">---</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">> =
context.setWebConversation(wc);</FONT>
</P>
<BR>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">$ cvs diff TestConfig.java</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Index: TestConfig.java</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT>=
<BR><FONT SIZE=3D2 FACE=3D"Arial">RCS file: =
/repositories/cvs/public/webtest/src/com/canoo/webtest/engine/TestConfig.=
java,v</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">retrieving revision 1.21</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">diff -r1.21 TestConfig.java</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">26a27,28</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> private =
String fUserAgent =3D null;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">375a378,387</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> public =
void setUserAgent(String userAgent)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">> =
fUserAgent =3D userAgent;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> }</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> public =
String getUserAgent()</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">> =
return fUserAgent;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> }</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">384a397</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">> =
map.put("userAgent", getUserAgent());</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C1F524.12518260--