[ http://webtest-community.canoo.com/jira/browse/WT-161?page=all ]
Marc Guillemot closed WT-161:
-----------------------------
Fix Version: future versions
Resolution: Fixed
Assign To: Marc Guillemot
Fixed since work started on WT-232 for over 6 months.
> <property> values not initialized within <webtest> task
> -------------------------------------------------------
>
> Key: WT-161
> URL: http://webtest-community.canoo.com/jira/browse/WT-161
> Project: WebTest
> Type: Bug
> Versions: 2.0
> Environment: winxp pro, ant 1.6.5, found in webtest build 1209
> Reporter: John Kercher
> Assignee: Marc Guillemot
> Fix For: future versions
>
> From my post (28 Feb 2006) to the mailing list (subject "support of
> <property> via <antWrapper>"):
> Recently I suggested adding support for nested <property> tags within
> <steps> so that modules could declare default properties that could be
> overridden by the caller. Marc pointed me to the <antWrapper>. I
> grabbed the latest build (1209) and gave it try. I modified my
> createuser module to preset some properties that test authors might not
> be concerned about in all cases:
> <echo>module:createUser.xml</echo>
> <fail unless="createuser.name">
> The required property 'createuser.name' was not specified; this property
> must specify a unique name for the user to be created.
> </fail>
> <property name="createuser.pwd" value="pwd"/>
> <property name="createuser.pwd.confirm" value="pwd"/>
> <property name="createuser.isUser" value="True"/>
> <property name="createuser.isAdmin" value="False"/>
> <property name="createuser.isEnabled" value="True"/>
> <property name="createuser.email"
> value="[EMAIL PROTECTED]"/>
> <property name="createuser.notes" value="This user created by
> WebTest."/>
> <echo>checking default: pwd=${createuser.pwd}</echo>
> <invoke description="get create user page"
> url="/CreateUser!input.action"/>
> <setinputfield description="set user name" name="user.name"
> value="${createuser.name}"/>
> <setinputfield description="set user password" name="password"
> value="${createuser.pwd}"/>
> <setinputfield description="confirm password" name="confirmPassword"
> value="${createuser.pwd.confirm}"/>
> (...etc...)
> <clickElement description="submit new user" xpath="//[EMAIL PROTECTED] =
> 'createUser']"/>
> The <echo> and <fail> tasks work as expected (without specifying
> <antWrapper>, which is cool), but the default <property> setters do not.
> The line that echos default properties outputs "checking default:
> pwd=${createuser.pwd}", as if the property had never been set. I also
> tried putting these in an external properties file and including it in
> the module, but the results were the same.
> Is this expected/known behavior? I can remove these defaults to an
> external file and include them before the <webtest> task, but it seems
> like being able to include them in the module would improve the module's
> usability (as far as test writers are concerned).
> From Mark G.'s reply in the mailing list:
> This is not expected and wasn't known.
> I think that the reason is that we evaluate the properties to early (in fact
> when the task is added to the container) instead of evaluating them just
> before
> execution. I guess that following minimal test would show the problem too:
> <webtest>
> <steps>
> <property name="myProp" value="foo"/>
> <echo message="myProp: ${myProp}"/>
> </steps>
> </webtest>
> I recommand you to open a bug issue for this problem. This won't be fixed
> before
> the symbolic 2.0 (next week) but some changes I already had in mind will
> address
> this problem too.
> Marc.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest