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_Attribute_Partial_Matching_in_Tellurium

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-users for error 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 groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>        at
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> 39)
>        at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
>        at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
>        at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
>        at
>
> org.telluriumsource.dsl.BaseDslContext.getUiModuleValidationResult(BaseDslContext.groovy:
> 1417)
>        at org.telluriumsource.dsl.BaseDslContext
> $getUiModuleValidationResult.callCurrent(Unknown Source)
>        at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:
> 44)
>        at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
> 143)
>        at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
> 151)
>        at
> org.telluriumsource.dsl.BaseDslContext.validate(BaseDslContext.groovy:
> 1404)
>        at test.utils.VireoJunitTestCase.login(VireoJunitTestCase.java:55)
>        at test.utils.VireoJunitTestCase.setUp(VireoJunitTestCase.java:30)
>        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.junit.runners.model.FrameworkMethod
> $1.runReflectiveCall(FrameworkMethod.java:44)
>        at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
> 15)
>        at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
> 41)
>        at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
> 27)
>        at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
> 31)
>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>        at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:
> 46)
>        at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
> 38)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
> 467)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
> 683)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
> 390)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
> 197)
>
> An easy way to duplicate this error is to create a class with an
> attribute and then try to refer to that attribute in the action
> portion of both the defineUi() and defineModule() and you'll see the
> error with defineUI().
>
> package test
>
> class TestError {
>
>        static String getValue() {
>                return "vireo101"
>        }
> }
>
> package module
>
> import org.telluriumsource.dsl.DslContext
> import org.tdl.datadriventests.VireoTestConfig
> import test.TestError
>
>
> /**
>  * This UI module file is created for logging into Dspace.
>  */
>
> public class DspaceLogonAdminModule extends DslContext {
>
>        String webApp = VireoTestConfig.getWebApp() // "${webApp}/password-
> login" causes JSON parse error
>
>        String test = TestError.getValue()
>
>        public void defineUi() {
>
>                ui.Form(uid: "DspaceLoginForm", clocator: [tag: "form",
> method:
> "post", action: "${TestError.getValue()}/password-login", class: "ds-
> interactive-div primary", id:
> "aspect_eperson_PasswordLogin_div_login"]){
>                        InputBox(uid: "LoginEmail", clocator: [tag: "input",
> type: "text",
> name: "login_email", class: "ds-text-field", id:
> "aspect_eperson_PasswordLogin_field_login_email"])
>                        InputBox(uid: "LoginPassword", clocator: [tag:
> "input", type:
> "password", name: "login_password", class: "ds-password-field", id:
> "aspect_eperson_PasswordLogin_field_login_password"])
>                        SubmitButton(uid: "Submit", clocator: [tag: "input",
> type:
> "submit", name: "submit", class: "ds-button-field", id:
> "aspect_eperson_PasswordLogin_field_submit"])
>                }
>        }
> }
>
> Jade
>
> P.S. Here's the similar code working fine in the defineModule()
> method:
>
> package org.tdl.datadriventests.module.student
>
>
>
> import org.tdl.datadriventests.StudentPageTitle;
> import org.tdl.datadriventests.VireoTestConfig
>
> import org.telluriumsource.test.ddt.TelluriumDataDrivenModule
>
> /**
>  * This UI module file represents page four of the Vireo Student
> Submission -- Upload your Files
>  */
>
> public class UploadFilesModule extends TelluriumDataDrivenModule {
>
>        public void defineModule() {
>
>                ui.Form(uid: "UploadFiles", clocator: [tag: "form", method:
> "post",
> action: "${VireoTestConfig.getWebApp()}/vireo", class: "ds-interactive-
> div vireo-form", id:
> "aspect_vireo_submit_DocumentFiles_div_documentFiles"]){
>
>                        InputBox(uid: "ThesisFile", clocator: [tag: "input",
> type: "file",
> name: "thesisFile", class: "ds-file-field required", id:
> "aspect_vireo_submit_DocumentFiles_field_thesisFile"])
>                        SubmitButton(uid: "ThesisUpload", clocator: [tag:
> "input", type:
> "submit", value: "Upload", name: "thesisUpload", class: "ds-button-
> field", id: "aspect_vireo_submit_DocumentFiles_field_thesisUpload"])
>
>                        // Supplementary Files
>                        InputBox(uid: "SupplementaryFile", clocator: [tag:
> "input", type:
> "file", name: "supFile", class: "ds-file-field", id:
> "aspect_vireo_submit_DocumentFiles_field_supFile"])
>                        SubmitButton(uid: "SupplementaryUpload", clocator:
> [tag: "input",
> type: "submit", value: "Upload", name: "supplementaryUpload", class:
> "ds-button-field", id:
> "aspect_vireo_submit_DocumentFiles_field_supplementaryUpload"])
>
>                        SubmitButton(uid: "Submit", clocator: [tag: "input",
> type:
> "submit", value: "Save and Continue >>", name: "saveAndContinue",
> class: "ds-button-field", id:
> "aspect_vireo_submit_DocumentFiles_field_saveAndContinue"])
>                }
>
>                // Names for data elements in the data file.
>                // Note: nullable is true by default.
>                // See class Field for more info.
>                fs.FieldSet(name: "UploadFilesData") {
>                        Test(value: "uploadFiles")
>                        Field(name: "thesis", nullable: "false")
>                        Field(name: "supplementalFile")
>                        Field(name: "isValidData", type: boolean,
> description: "true if
> this data is valid")
>                }
>
>                /**
>                 * Test the License Agreement page of the student submission
> in
> Vireo.
>                 */
>                defineTest("uploadFiles") {
>
>
>  assertEquals(StudentPageTitle.UPLOAD_FILES.get_title(), getTitle())
>
>                        String thesis = bind("UploadFilesData.thesis")
>                        String supplementalFile =
> bind("UploadFilesData.supplementalFile")
>                        boolean isValid =
> bind("UploadFilesData.isValidData")
>
>                        doInputUploadFiles(thesis, supplementalFile);
>
>                        waitForPageToLoad(VireoTestConfig.getMaxWait());
>
>                        if (isValid) {
>
>  assertEquals(StudentPageTitle.CONFIRM_AND_SUBMIT.get_title(),
> getTitle())
>                        } else {
>
>  assertEquals(StudentPageTitle.UPLOAD_FILES.get_title(),
> getTitle())
>                        }
>                }
>        }
>
> --
> 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