[Webtest] stupid webtest question #426. Can I store a constan t

Bill Milbratz webtest@lists.canoo.com
Tue, 30 Sep 2003 10:50:29 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------=_NextPartTM-000-1090c132-849e-4964-a4de-d078d2b37f20
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C3876A.92BF0060"

------_=_NextPart_001_01C3876A.92BF0060
Content-Type: text/plain;
	charset="iso-8859-1"

>This should be an easy fix, but while you are waiting, perhaps there are
some workarounds.
upgrading to 365 solved the problem..
 
>One thing I don't understand is  why or if you need to do a concatenation?
Can you just do xpath="//title"?  That will avoid this bug. 
Actually I originally intended to reuse a module several times in different
use cases, but using the dynamic properties to "pass parameters" in.
Example...
 
In this specific portion of our application, we have 4 different
configuration options and 4 different messages which should appear based
depending on the configuration option. I was exploring ways to reuse the
modules. 
 
Example:


      <storexpath
      stepid="Set Required Info Code"
      xpath="concat('${reset.password.option.code.login}','')"
      property="reset.password.config.value" />
      &SetResetPasswordConfig;
 
      <storexpath
      stepid="Set Notfound Info Text"
      xpath="concat('${reset.password.notfound.login}','')"
      property="reset.password.notfound" />
            
      &ResetPasswordBadData;

 
Dierk suggested the concat as a valid xpath expression which would solve the
problem. And voila it works! 
 
bil milbratz
 
 
 
 
 
 
-----Original Message-----
From: Christopher Painter-Wakefield [mailto:paint007@mc.duke.edu]
Sent: Tuesday, September 30, 2003 10:24 AM
To: webtest@gate.canoo.com
Subject: RE: [Webtest] stupid webtest question #426. Can I store a constant




This should be an easy fix, but while you are waiting, perhaps there are
some workarounds.  One thing I don't understand is  why or if you need to do
a concatenation?  Can you just do xpath="//title"?  That will avoid this
bug. 

-Christopher 




	webtest-request@gate.canoo.com 
Sent by: webtest-admin@gate.canoo.com 


09/30/2003 10:34 AM 
Please respond to webtest 


        
        To:        webtest@gate.canoo.com 
        cc:         
        Subject:        WebTest digest, Vol 1 #382 - 4 msgs



>In our current project we have the very same issue.
>You need to find an xpath expression that evaluates to your 'constant', eg.
xpath="concat(''MYCONSTANT,'')"

This sounded good, but such a concat  (and all combinations I tried) gave me
the following errors. Any suggestions?
e.g. these xpath's:
xpath="concat(''MYCONSTANT','')"

xpath="concat(//title,'MYCONSTANT')"

Yielded these such errors:


[testSpec] org.dom4j.XPathException: Exception occurred evaluting XPath:
The result of the
XPath expression is not a Node. It was: a of type: java.lang.String. You
might want to use a
different method such as selectObject() to evaluate this XPath expression
[testSpec]     at
org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:163)
[testSpec]     at
org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:188)
[testSpec]     at
com.canoo.webtest.steps.StoreXPath.getXPath(StoreXPath.java:83)
[testSpec]     at
com.canoo.webtest.steps.StoreXPath.doExecute(StoreXPath.java:58)
[testSpec]     at com.canoo.webtest.steps.Step.execute(Step.java:56)
[testSpec]     at
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)
[testSpec]     at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask

thanks,

bill m 



------_=_NextPart_001_01C3876A.92BF0060
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=079512515-30092003><FONT face=Arial size=2>&gt;This should be 
an easy fix, but while you are waiting, perhaps there are some 
workarounds.</FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2>upgrading to 365 solved the problem..</FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial size=2>&gt;One thing I 
don't understand is &nbsp;why or if you need to do a concatenation? &nbsp;Can 
you just do xpath="//title"? &nbsp;That will avoid this bug.</FONT> 
</SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial size=2>Actually I 
originally intended to&nbsp;reuse a module several times 
in&nbsp;different&nbsp;use cases, but using the dynamic properties to "pass 
parameters" in. Example...</FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><SPAN class=079512515-30092003><FONT 
face=Arial size=2><FONT face="Arial Unicode MS" color=#0000ff>In&nbsp;this 
specific portion of our application, we have 4 different configuration options 
and 4 different messages which should appear based depending on the 
configuration option. I was exploring ways to reuse the modules. 
</FONT></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><SPAN class=079512515-30092003><FONT 
face=Arial size=2><FONT face="Arial Unicode MS" 
color=#0000ff></FONT></FONT></SPAN></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><SPAN class=079512515-30092003><FONT 
face=Arial size=2><FONT face="Arial Unicode MS" 
color=#0000ff>Example:</FONT></DIV>
<DIV><FONT face="Arial Unicode MS" 
color=#0000ff></FONT><BR></DIV></FONT></SPAN></SPAN>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;storexpath<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stepid="Set Required Info 
Code"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
xpath="concat('${reset.password.option.code.login}','')"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
property="reset.password.config.value" /&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&amp;SetResetPasswordConfig;</FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;storexpath<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stepid="Set Notfound Info 
Text"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
xpath="concat('${reset.password.notfound.login}','')"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
property="reset.password.notfound" 
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&amp;ResetPasswordBadData;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial size=2><FONT 
face="Arial Unicode MS" color=#0000ff></FONT>&nbsp;</DIV></FONT></SPAN>
<DIV><SPAN class=079512515-30092003><FONT face=Arial size=2>Dierk suggested the 
concat as a valid xpath expression which would solve the problem. And voila it 
works! </FONT></SPAN><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial size=2>bil 
milbratz</FONT></SPAN></DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=079512515-30092003></SPAN><FONT face=Tahoma 
size=2>-----Original Message-----<BR><B>From:</B> Christopher Painter-Wakefield 
[mailto:paint007@mc.duke.edu]<BR><B>Sent:</B> Tuesday, September 30, 2003 10:24 
AM<BR><B>To:</B> webtest@gate.canoo.com<BR><B>Subject:</B> RE: [Webtest] stupid 
webtest question #426. Can I store a constant<BR><BR></DIV></FONT>
<BLOCKQUOTE><BR><FONT face=sans-serif size=2>This should be an easy fix, but 
  while you are waiting, perhaps there are some workarounds. &nbsp;One thing I 
  don't understand is &nbsp;why or if you need to do a concatenation? &nbsp;Can 
  you just do xpath="//title"? &nbsp;That will avoid this bug.</FONT> 
  <BR><BR><FONT face=sans-serif size=2>-Christopher</FONT> <BR><BR><BR><BR>
  <TABLE width="100%">
    <TBODY>
    <TR vAlign=top>
      <TD>
      <TD><FONT face=sans-serif 
        size=1><B>webtest-request@gate.canoo.com</B></FONT> <BR><FONT 
        face=sans-serif size=1>Sent by: webtest-admin@gate.canoo.com</FONT> 
        <P><FONT face=sans-serif size=1>09/30/2003 10:34 AM</FONT> <BR><FONT 
        face=sans-serif size=1>Please respond to webtest</FONT> <BR></P>
      <TD><FONT face=Arial size=1>&nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT 
        face=sans-serif size=1>&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; 
        &nbsp; &nbsp;webtest@gate.canoo.com</FONT> <BR><FONT face=sans-serif 
        size=1>&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; 
        &nbsp;</FONT> <BR><FONT face=sans-serif size=1>&nbsp; &nbsp; &nbsp; 
        &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;WebTest digest, Vol 1 #382 - 
        4 msgs</FONT></TR></TBODY></TABLE><BR><BR><BR><FONT face="Courier New" 
  size=2>&gt;In our current project we have the very same issue.<BR>&gt;You need 
  to find an xpath expression that evaluates to your 'constant', 
  eg.<BR>xpath="concat(''MYCONSTANT,'')"<BR><BR>This sounded good, but such a 
  concat &nbsp;(and all combinations I tried) gave me<BR>the following errors. 
  Any suggestions?<BR>e.g. these 
  xpath's:<BR>xpath="concat(''MYCONSTANT','')"<BR><BR>xpath="concat(//title,'MYCONSTANT')"<BR><BR>Yielded 
  these such errors:<BR><BR><BR>[testSpec] org.dom4j.XPathException: Exception 
  occurred evaluting XPath:<BR>The result of the<BR>XPath expression is not a 
  Node. It was: a of type: java.lang.String. You<BR>might want to use 
  a<BR>different method such as selectObject() to evaluate this XPath 
  expression<BR>[testSpec] &nbsp; &nbsp; 
  at<BR>org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:163)<BR>[testSpec] 
  &nbsp; &nbsp; 
  at<BR>org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:188)<BR>[testSpec] 
  &nbsp; &nbsp; 
  at<BR>com.canoo.webtest.steps.StoreXPath.getXPath(StoreXPath.java:83)<BR>[testSpec] 
  &nbsp; &nbsp; 
  at<BR>com.canoo.webtest.steps.StoreXPath.doExecute(StoreXPath.java:58)<BR>[testSpec] 
  &nbsp; &nbsp; at 
  com.canoo.webtest.steps.Step.execute(Step.java:56)<BR>[testSpec] &nbsp; &nbsp; 
  at<BR>com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)<BR>[testSpec] 
  &nbsp; &nbsp; 
  at<BR>com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask<BR><BR>thanks,<BR><BR>bill 
  m</FONT> <BR></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C3876A.92BF0060--

------=_NextPartTM-000-1090c132-849e-4964-a4de-d078d2b37f20--