Use <propertyregex> in Ant- contrib..
-- Jonathan Rosenberg Founder & Executive Director, Tabby's Place http://www.tabbysplace.org/ From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Friday, October 22, 2010 11:43 AM To: [email protected] Subject: [Webtest] scriptStep, Javascript and properties, in order to do string manipulations Dear all, Im looking for a way to do simple string manipulations within WebTest. I tried to do it with scriptStep and javascript, but I cant make it work. In a property file, I set the property ProductCode (TACatalog). I would like to extract the first 3 characters from this ProductCode, in order to use it later in a setInputField. Here is my code: <setInputField htmlId="tpc1" value="${ProductCode}"/> <scriptStep description="Récupération du début du code" language="javascript"> var ProductCode = step.getWebtestProperty('ProductCode',step.PROPERTY_TYPE_ANT) step.setWebtestProperty('ProductCodeBegin', ProductCode.substring(0,3)); </scriptStep> <setInputField htmlId="tpc7" value="${ProductCodeBegin}"/> First issue : ScriptStep generates an error as soon as I put substring(0,3). If I change my code to remove substring(0,3) : <setInputField htmlId="tpc1" value="${ProductCode}"/> <scriptStep description="Récupération du début du code" language="javascript"> var ProductCode = step.getWebtestProperty('ProductCode',step.PROPERTY_TYPE_ANT) step.setWebtestProperty('ProductCodeBegin', ProductCode); </scriptStep> <setInputField htmlId="tpc7" value="${ProductCodeBegin}"/> Second issue : in this case, ${ProductCodeBegin} has no value. Many thanks in advance for your help. Delphine

