I created the following UI module:

class LoginFormModule extends DslContext{
  public void defineUiModule() {
    String VireoTestConfig = "vireo101";

    ui.Form(uid: "DspaceLoginForm", clocator: [tag: "form", method:"post",
            action: "${VireoTestConfig}/password-login",
            class: "ds-interactive-div primary", id:
"aspect_eperson_PasswordLogin_div_login"]){
      InputBox(uid: "Input", clocator: [:])
    }
  }

}

and the following test case

class LoginForm_UT extends GroovyTestCase {
  public void testUim(){
    LoginFormModule lfm = new LoginFormModule();
    lfm.defineUiModule();
    lfm.dump("DspaceLoginForm")
    lfm.disableCssSelector();
    lfm.dump("DspaceLoginForm")
  }
}

The following results show the variable got replaced correctly.

Dump locator information for DspaceLoginForm
-------------------------------------------------------
DspaceLoginForm: jquery=#aspect_eperson_PasswordLogin_div_login
DspaceLoginForm.Input: jquery=#aspect_eperson_PasswordLogin_div_login input
-------------------------------------------------------

Dump locator information for DspaceLoginForm
-------------------------------------------------------
DspaceLoginForm: //descendant-or-self::fo...@method="post" and
@action="vireo101/password-login" and @class="ds-interactive-div primary"
and @id="aspect_eperson_PasswordLogin_div_login"]
DspaceLoginForm.Input: //descendant-or-self::fo...@method="post" and
@action="vireo101/password-login" and @class="ds-interactive-div primary"
and @id="aspect_eperson_PasswordLogin_div_login"]/descendant-or-self::input
-------------------------------------------------------


Thanks,

Jian

On Wed, Aug 4, 2010 at 2:04 PM, Jade <[email protected]> wrote:

> Yes, the defineUi() method needs extra double quotes but the
> defineModule() method doesn't. Thanks for looking into it.
>
> Jade
>
> On Aug 4, 12:43 pm, Jian Fang <[email protected]> wrote:
> > It needs extra double quotes? I will take a look tonight.
> >
> > Thanks,
> >
> > Jian
> >
> > On Wed, Aug 4, 2010 at 1:39 PM, Jade <[email protected]> wrote:
> > > Hi Jian,
> >
> > > Thanks again for your quick reply.
> >
> > > I added this call:
> >
> > > and it is doing the substitution in the action. I think the parse
> > > error is caused by missing double quotes around the action value. When
> > > I added them back like this:
> >
> > > action: '"' + "${VireoTestConfig.getWebApp()}/password-login" + '"'
> >
> > > then the error disappeared.
> >
> > > Here's the JSON:
> >
> > > [{"obj":{"uid":"DspaceLoginForm","locator":{"tag":"form","attributes":
> > > {"id":"aspect_eperson_PasswordLogin_div_login","action":vireo101/
> > > password-login,"class":"ds-interactive-div
> > > primary","method":"post"}},"uiType":"Form","metaData":
> > > {"id":"DspaceLoginForm","type":"UiObject"}},"key":"DspaceLoginForm"},
> > > {"obj":{"uid":"LoginPassword","locator":{"tag":"input","attributes":
> >
> > >
> {"id":"aspect_eperson_PasswordLogin_field_login_password","name":"login_password","class":"ds-
> > > password-field","type":"password"}},"uiType":"InputBox","metaData":
> >
> > >
> {"id":"LoginPassword","type":"UiObject"}},"key":"DspaceLoginForm.LoginPassword"},
> > > {"obj":{"uid":"LoginEmail","locator":{"tag":"input","attributes":
> >
> > >
> {"id":"aspect_eperson_PasswordLogin_field_login_email","name":"login_email","class":"ds-
> > > text-field","type":"text"}},"uiType":"InputBox","metaData":
> > >
> {"id":"LoginEmail","type":"UiObject"}},"key":"DspaceLoginForm.LoginEmail"},
> > > {"obj":{"uid":"Submit","locator":{"tag":"input","attributes":
> >
> > >
> {"id":"aspect_eperson_PasswordLogin_field_submit","name":"submit","class":"ds-
> > > button-field","type":"submit"}},"uiType":"SubmitButton","metaData":
> > > {"id":"Submit","type":"UiObject"}},"key":"DspaceLoginForm.Submit"}]
> > > Dump locator information for DspaceLoginForm
> >
> > > Jade
> >
> > > On Aug 4, 12:09 pm, Jian Fang <[email protected]> wrote:
> > > > Hi,
> >
> > > > I am not sure if GString (${}) will work in UI module definition.
> Could
> > > you
> > > > call
> >
> > > > public String toString(String uid);
> >
> > > > to dump out the JSON string representation of the UI module to see if
> the
> > > > GString got replaced?
> >
> > > > If not, $ may be treated as a partial matching symbol by Tellurium.
> >
> > > >
> http://code.google.com/p/aost/wiki/UserGuide070AppendixB#How_to_do_At...
> >
> > > > Thanks,
> >
> > > > Jian
> >
> > > > On Wed, Aug 4, 2010 at 12:08 PM, Jade <[email protected]> wrote:
> > > > > Hi,
> >
> > > > > I'm using both data driven tests and Junit tests. I've created a
> > > > > config file to read in certain values such as the baseURL, the
> > > > > testUrl, the webApp, etc. for our application into a class,
> > > > > VireoTestConfig.
> >
> > > > > When I refer to this class in the action="" part of the Form of a
> > > > > TelluriumDataDrivenModule, the code runs fine. Here's an example:
> >
> > > > > public void defineModule() {
> >
> > > > >                ui.Form(uid: "DspaceLoginForm", clocator: [tag:
> "form",
> > > > > method:
> > > > > "post", action: "${VireoTestConfig.getWebApp()}/password-login",
> > > > > class: "ds-interactive-div primary", id:
> > > > > "aspect_eperson_PasswordLogin_div_login"]){
> >
> > > > > However, when I try to do the same in a Module that extends the
> > > > > DslContext, I get a JSON parse error when validating the form or or
> > > > > using the module.
> >
> > > > > ui.Form(uid: "DspaceLoginForm", clocator: [tag: "form", method:
> > > > > "post", action: "${VireoTestConfig.getWebApp()}/password-login",
> > > > > class: "ds-interactive-div primary", id:
> > > > > "aspect_eperson_PasswordLogin_div_login"]){
> >
> > > > > but when it's changed back to ui.Form(uid: "DspaceLoginForm",
> > > > > clocator: [tag: "form", method: "post", action: "vireo101/password-
> > > > > login", class: "ds-interactive-div primary", id:
> > > > > "aspect_eperson_PasswordLogin_div_login"]){
> >
> > > > > it gives me a JSON parse error. It seems like it's not correctly
> > > > > substituting the variable before trying to parse the JSON?
> >
> > > > > Here's the stack trace:
> >
> > > > > com.thoughtworks.selenium.SeleniumException: ERROR: Command
> execution
> > > > > failure. Please search the Tellurium User Group at
> > > > >http://groups.google.com/group/tellurium-usersforerror details from
> > > > > the log window.  The error message is: JSON.parse
> > > > >        at
> >
> > >
> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:
> > > > > 97)
> > > > >        at
> >
> > >
> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:
> > > > > 91)
> > > > >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > > >        at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > > 39)
> > > > >        at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > > > 25)
> > > > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > > > >        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
> > > > >
> $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:
> > > > > 229)
> > > > >        at
> >
> > >
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:
> > > > > 52)
> > > > >        at
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > > > 129)
> > > > >        at
> >
> > >
> org.telluriumsource.component.connector.CustomSelenium.getBundleResponse(CustomSelenium.groovy:
> > > > > 257)
> > > > >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > > >        at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > > 39)
> > > > >        at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > > > 25)
> > > > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > > > >        at
> > > > >
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > > > 88)
> > > > >        at
> groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> > > > >        at
> > > > >
> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> > > > > 149)
> > > > >        at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> > > Source)
> > > > >        at
> >
> > >
> org.telluriumsource.component.dispatch.Dispatcher.methodMissing(Dispatcher.groovy:
> > > > > 56)
> > > > >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > > >        at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > > 39)
> > > > >        at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > > > 25)
> > > > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > > > >        at
> > > > >
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > > > 88)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > > > 813)
> > > > >        at
> > > > >
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > > > 1107)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> > > > >        at
> >
> > >
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> > > > > 39)
> > > > >        at
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > > > 129)
> > > > >        at
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.passBundledCommand(BundleProcessor.groovy:
> > > > > 322)
> > > > >        at org.telluriumsource.component.bundle.BundleProcessor
> > > > > $passBundledCommand.callCurrent(Unknown Source)
> > > > >        at
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.process(BundleProcessor.groovy:
> > > > > 414)
> > > > >        at org.telluriumsource.component.bundle.BundleProcessor
> > > > > $process.callCurrent(Unknown Source)
> > > > >        at
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.methodMissing(BundleProcessor.groovy:
> > > > > 427)
> > > > >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > > >        at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > > 39)
> > > > >        at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > > > 25)
> > > > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > > > >        at
> > > > >
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > > > 88)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > > > 813)
> > > > >        at
> > > > >
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > > > 1107)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> > > > >        at
> > > > >
> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> > > > > 149)
> > > > >        at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> > > Source)
> > > > >        at
> >
> > >
> org.telluriumsource.component.custom.Extension.methodMissing(Extension.groovy:
> > > > > 20)
> > > > >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > > >        at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > > 39)
> > > > >        at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > > > 25)
> > > > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > > > >        at
> > > > >
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > > > 88)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > > > 813)
> > > > >        at
> > > > >
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > > > 1107)
> > > > >        at
> > > groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> > > > >        at
> >
> > ...
> >
> > read more ยป
>
> --
> You received this message because you are subscribed to the Google Groups
> "tellurium-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<tellurium-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/tellurium-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en.

Reply via email to