[Webtest] Problemas con java y setproxy

Francisco Javier Martin Gutierrez francisco-javier.martin@thalesgroup.com
Wed, 16 May 2007 18:00:01 +0200


Hello:
You didn't answer the last question but there is one more.=20

I need to test an internet page. I've read how to configure a proxy but =
all
I do fail. I need to configure not only proxyhost or proxyport, but I =
need
also proxyuser and proxypassword.=20

I've tried just:
<setproxy proxyhost=3D"192.168.43.1" proxyport=3D"3128" =
user=3D"sistemas"
password=3D"contrase=F1a" description=3D"Configure proxy through normal =
ant
task"/>
But webtest says that proxyuser is not allowed for setproxy command. =
What is
the properly command to use? Is better use an ant step? Which is the =
best
solution?=20

Thanks.
............................................
Hello all,

Perhaps my question was wrong formulated. Webtest click the link or =
press
the button properly but the obtained response is not the expected =
response.
Webtest says that it can find the target and it does the action.

Two days before I pressed a button for reaching the next page and I =
reached
it. But now the application has changed and the next page obtained is an
error page. I am analyzing server response for further details but the
unique difference is that I haven't configured in header the parameters
REFERER and Request Method is GET instead of HTTP. So it can't be the
problem because REFERER parameter is not set in server (the application =
runs
in Oracle).

There are not expected dialogs so I think that I don't need to configure =
it
(I did it in other situations).

I only need to pass the next steps:

<clickButton	description=3D"Click the submit button: Efectuar cambios de
estado"
	name=3D"efectuarCambiosEstado"  label=3D"Efectuar cambios de estado"
x=3D"45" y=3D"13" />
		<verifyText		description=3D"Texto presente: En caso
afirmativo, indique el motivo de cierre. "
			text=3D"En caso afirmativo, indique el motivo de
cierre." />

But when I click the button the page loaded is not the expected page =
because
server sends an error page and it doesn't happens when I do it with
iexplore. It is an strange success.=20

The webtest response is:=20

[clickButton]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
clickButton "Click the submit button: Efectuar cam bios de estado" =
(111/211)
[clickButton]  INFO =
(com.canoo.webtest.steps.request.AbstractTargetAction) -
-> gotoTarget by clickButton with name: efe ctuarCambiosEstado =
[clickButton]
INFO (com.canoo.webtest.steps.request.ClickButton) - -> findTarget(by
input): name=3DefectuarCambiosEstado value=3DEfectuar cambios de estado
[clickButton]  INFO (com.canoo.webtest.steps.request.ClickButton) - ->
findTarget(by input): name=3DefectuarCambiosEstado value=3DEfectuar =
cambios de
estado [clickButton]  WARN (com.gargoylesoftware.htmlunit.html.HtmlPage) =
-
Expected content type of text/javascript or applicat ion/x-javascript =
for
remotely loaded javascript element =
http://espinete:7783/sauss/js/sauss.js
but got [application/octe t-stream] [clickButton]  INFO
(com.canoo.webtest.engine.WebClientContext) - Content of window changed =
to
http://espinete:7783/saus s/HistoriaSocialValorPrestHS.do (text/html)
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - =
Content of
current window changed, it will become curr ent response [clickButton]  =
INFO
(com.canoo.webtest.engine.WebClientContext) - Current form set to none
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - =
Current
response now: http://espinete:7783/sauss/Histo riaSocialValorPrestHS.do
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - =
Content of
window changed to http://espinete:7783/saus =
s/HistoriaSocialValorPrestHS.do
(text/html) [clickButton]  INFO =
(com.canoo.webtest.engine.WebClientContext)
- Content of current window changed, it will become curr ent response
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - =
Current
form set to none [clickButton]  INFO
(com.canoo.webtest.engine.WebClientContext) - Current response now:
http://espinete:7783/sauss/Histo riaSocialValorPrestHS.do [verifyText]  =
INFO
(com.canoo.webtest.steps.Step) - >>>> Start Step: verifyText "Texto
presente: En caso afirmativo, ind ique el motivo de cierre. " (112/211) =
....
INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: =
R_1515.
 INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
com.canoo.webtest.engine.StepFailedException
 INFO (com.canoo.webtest.steps.Step) - Message was: Step[verifyText =
"Texto
presente: En caso afirmativo, indique el moti vo de cierre. " =
(112/211)]:
Text not found in page. Expected <En caso afirmativo, indique el motivo =
de
cierre.> Adding reference: ant.PropertyHelper  INFO
(com.canoo.webtest.ant.WebtestTask) - Finished executing webtest
"PruebaPc001" (C:\Webtest\SAUSS\PruebaPc001.xml:4
4: )
 INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully
created.

BUILD FAILED
C:\Webtest\SAUSS\PruebaPc001.xml:44: Canoo Webtest: R_1515.
Test failed.
Test step steps (C:\Webtest\SAUSS\PruebaPc001.xml:47: ) null failed with
message "Step[verifyText "Texto presente: En ca so afirmativo, indique =
el
motivo de cierre. " (112/211)]: Text not found in page. Expected <En =
caso
afirmativo, indique el motivo de cierre.>"
        at
com.canoo.webtest.ant.WebtestTask.stopBuildIfNeeded(WebtestTask.java:228)=

        at =
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:175)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecuto=
r.j
ava:40)
        at =
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Total time: 32 seconds


Thanks for your time.=20
-------------------------------------------------------------------------=
-
Hi,

how does your clickLink fail? Does it produce some error or does is it =
just
successful but without getting a new page?

Your js code looks simple and shouldn't be a problem for WebTest =
(neither
2.1 nor 2.5). For 2.1 I could imagine that the default answer to confirm =
was
false (I don't remember exactly when the change has been
done) what could explain that nothing happens. Nevertheless the default
behavior for confirm is now true so this shouldn't be a problem with =
2.5. To
precisely specify what should happen you can give a try to =
<expectDialogs
...>.

Last (but not least), to "see" what happens, I recommend you to turn the =
log
level to debug (see lib/log4j.properties) and look at what is printed to =
the
log when the link is clicked.

Marc.
--__--__--

Message: 3
From: "Francisco Javier Martin Gutierrez"
<francisco-javier.martin@thalesgroup.com>
To: <webtest@lists.canoo.com>
Date: Thu, 10 May 2007 17:34:48 +0200
Organization: THALES
Subject: [Webtest] WebTest clicklink fail
Reply-To: webtest@lists.canoo.com
Reply-To: <francisco-javier.martin@thalesgroup.com>

Hello:

Since I have been testing with webtest it had never failed like now. I =
=3D
begin to believe that webtest do all it can do. But something is going =
wrong
=3D since two days ago.

Webtest (version 2.1 =3D3D R_1515 and version =3D3D 2.5 R_1538) can't =
fail =3D
following a clickButton image or a clikLink. The page works well on =
iexplore
but webtest can't do it. I think it may be that there's some unsupported
javascript on the page. But how can I be sure of this?

The page code is:=3D20
href=3D3D"javascript:eliminar('10101A', 'prueba marcos');"

And the javascript function is:
function eliminar(codValoracion, nomValoracion) {
  document.forms[0].codValoracion.value=3D3DcodValoracion;
  document.forms[0].nomValoracion.value=3D3DnomValoracion;
  document.forms[0].modo.value=3D3D"listado";
  document.forms[0].accion.value=3D3D"eliminar";
  if(confirm("=3DBFEst=3DE1 seguro de que desea eliminar la =
Valoraci=3DF3n  '" =3D
+
codValoracion + " : " + nomValoracion + "' de la lista de favoritas?")){
  	document.forms[0].submit();
  }
     =3D20
}

I can't execute a scriptStep because it doesn't provide the mechanism to
call JavaScript functions in my HTML pages under test as it is told in =
=3D the
manual. If you execute a scriptStep at the next form:

<scriptStep description=3D3D"boton eliminar" language=3D3D"javascript">
				=3D09
	codValoracion=3D3D'10101A';
	nomValoracion=3D3D'prueba marcos';
=3D09
document.forms[0].codValoracion.value=3D3DcodValoracion;
=3D09
document.forms[0].nomValoracion.value=3D3DnomValoracion;
	document.forms[0].modo.value=3D3D"listado";
	document.forms[0].accion.value=3D3D"eliminar";
	if(confirm("=3DBFEst=3DE1 seguro de que desea eliminar la =
Valoraci=3DF3n
'" =3D
+
codValoracion + " : " + nomValoracion + "' de la lista de favoritas?")){
  		document.forms[0].submit();
	 }
</scriptStep>

The error message obtained is:

[scriptStep]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
scriptStep "boton eliminar" (31/32)
[scriptStep] ERROR (org.apache.bsf.BSFManager) - Exception :
[scriptStep] java.security.PrivilegedActionException:
org.apache.bsf.BSFException: JavaScript Error: Internal Error: org
.mozilla.javascript.EcmaError: TypeError: Cannot read property "0.0" =3D =
from
undefined ...
[scriptStep]  INFO (com.canoo.webtest.steps.Step) - Exception thrown =3D =
from
this class: com.canoo.webtest.engine.StepExecu
tionException
[scriptStep]  INFO (com.canoo.webtest.steps.Step) - Message was: Error
invoking script: org.mozilla.javascript.EcmaError
: TypeError: Cannot read property "0.0" from undefined  INFO
(com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: =3D =
R_1515.


What can I do?


End of WebTest Digest


AVISO LEGAL: La informacion contenida en este mensaje y cualquier documen=
to adjunto en el mismo es confidencial, puede estar legalmente protegida =
y esta dirigida solamente al destinatario. La publicacion, uso, distribuc=
ion, impresion o copia no autorizada del contenido de este mensaje, esta =
estrictamente prohibida y puede ser ilegal. Si Vd. ha recibido este mensa=
je por error, le rogamos destruya el mensaje y lo notifique al remitente =
o llame al telefono (+34) 91 556 92 62.

DISCLAIMER: The information contained in this message and any attached do=
cument is confidential, covered by law and intended solely for the recipi=
ent. The distribution, print, publication, unauthorised copy and / or use=
 of the message content is strictly forbidden and could be deemed illegal=
. If you are not the intended recipient of this message, we request that =
you destroy it and notify the sender either in writing or by calling ++34=
 91 556 92 62.