Hi Setya,

Even UiModule B & C comes from the same page which is defined in
UiModule A, you
use different variable for UiModule B&C, you should be fine because
the UI object registeries
parsed from different UI modules are stored in different objects,
i.e., each UiModule has its
own parser "ui" and the object registry.

I did test using different UI modules in the same class, seems my test
case works fine.
Here is my simple test code reusing the UI modules defined in trunk/
core (now, should be
moved to the example project).

<code>
package example.test.java;

import org.tellurium.test.java.TelluriumJavaTestCase;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import example.google.GoogleSearchModule;
import example.google.GoogleBooksList;

public class MultipleUIModuleTestCase extends TelluriumJavaTestCase {

    @Test
    public void testMultipleModules(){
        GoogleSearchModule gsm = new GoogleSearchModule();
        GoogleBooksList gbl = new GoogleBooksList();
        gsm.defineUi();
        gbl.defineUi();
        openUrl("http://www.google.com";);
        gsm.doGoogleSearch("tellurium . ( Groovy ) Test");
        connectUrl("http://www.google.com";);
        gsm.doImFeelingLucky("tellurium automated Testing");
        connectUrl("http://books.google.com/";);
        String category = gbl.getCategory();
        assertEquals("Fiction", category);

        int size = gbl.getBookListSize();
        assertEquals(8, size);
    }
}
</code>

Thanks,

Jian

On Sep 27, 10:58 pm, Setya <[email protected]> wrote:
> Hi Jian,
>
> Actually we have a parent UiModule, let's call it UiModule A which
> extends DslContext, on the other hand we also define UiModule B & C
> which extend UiModule A.
>
> The reason why we're doing this is :
>
> 1. UiModule B & C comes from the same page which is defined in UiModule A.
> 2. As I reported in previous post I can not run multiple UiModules in
> single test case (Have you solved this ?).
>
> Is it an absolute requirement to extend only DslContext class ?
>
> Thanks & Regards,
>
> Setya
>
> > What do you mean both Groovy UI modules extend the same class? They
> > should all extend the DslContext class, right? In my code sample, the
> > two UI modules, of course, also extend the same DslContext class, but
> > the test suite works fine. Wired.
>
> > Thanks,
>
> > Jian
>
> > On Sun, Sep 27, 2009 at 2:36 AM, Setya <[email protected]
> > <mailto:[email protected]>> wrote:
>
> >     Hi Jian,
>
> >     After looking deeper, the problem comes from the fact that both groovy
> >     UiModule in 1st & 2nd test case extend the same class.
>
> >     Is this known limitation ?
>
> >     Regards,
>
> >     Setya
>
> >     > Here is a good article on JUnit.
>
> >     >http://www.devx.com/Java/Article/31983/0/page/3
>
> >     > On Sat, Sep 26, 2009 at 9:10 PM, Jian Fang
> >     <[email protected] <mailto:[email protected]>
> >     > <mailto:[email protected]
> >     <mailto:[email protected]>>> wrote:
>
> >     >     Also tried @RunWith and @Suite as follows,
>
> >     >     -------------------------------------------------
> >     >     package example.test.java;
>
> >     >     import org.junit.runner.RunWith;
> >     >     import org.junit.runners.Suite;
>
> >     >     @RunWith(Suite.class)
> >     >     @Suite.SuiteClasses({
> >     >             GoogleSearchTestCase.class,
> >     >             GoogleBooksListJavaTestCase.class
> >     >             })
> >     >     public class TelluriumTestSuite {
>
> >     >     }
> >     >     ---------------------------------------
>
> >     >     The test suite works fine for me.
>
> >     >     Please check if your error is really related to the test
> >     suite itself.
>
> >     >     Thanks,
>
> >     >     Jian
>
> >     >     On Sat, Sep 26, 2009 at 2:41 PM, Jian Fang
> >     >     <[email protected] <mailto:[email protected]>
> >     <mailto:[email protected]
> >     <mailto:[email protected]>>> wrote:
>
> >     >         The root cause is this line,
>
> >     >         org.tellurium.exception.
> >     >         UiObjectNotFoundException: Cannot find UI Object
> >     >         communityPageRoot.return
>
> >     >         Could you put a breakpoint in the following line
>
> >     
> > com.telkom.sdp.module.community.CommunityPage.returnFromCommunityPage(CommunityPage.groovy:59
>
> >     >         and try to debug and see why the parser "ui" cannot find the
> >     >         object "communityPageRoot.return"?
>
> >     >         Thanks,
>
> >     >         Jian
>
> >     >         On Sat, Sep 26, 2009 at 5:05 AM, Setya <[email protected]
> >     <mailto:[email protected]>
> >     >         <mailto:[email protected] <mailto:[email protected]>>> wrote:
>
> >     >             Hi,
>
> >     >             We finally find that we can use @RunWith & @SuiteClasses
> >     >             annotations for
> >     >             this purpose. But when we run the tests together,
> >     the 2nd
> >     >             test case
> >     >             always throws the following exception:
>
> >     >             java.lang.IllegalArgumentException: object is not an
> >     >             instance of
> >     >             declaring class
> >     >                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:86)
> >     >                at
>
> >     groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
> >     >                at
>
> >     groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1061)
> >     >                at
>
> >     
> > org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:127)
> >     >                at
>
> >     
> > org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:147)
> >     >                at
>
> >     
> > com.telkom.sdp.module.community.RemoveCommunityPage.defineUi(RemoveCommunityPage.groovy:18)
> >     >                at
>
> >     
> > com.telkom.sdp.test.community.TestRemoveCommunityPage.displayCommunityPage(TestRemoveCommunityPage.java:29)
> >     >                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:220)
> >     >                at org.junit.runners.Suite.runChild(Suite.java:115)
> >     >                at org.junit.runners.Suite.runChild(Suite.java:23)
> >     >                at
>
> >     org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
> >     >                at
>
> >     org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
> >     >                at
>
> >     org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
> >     >                at
>
> >     
> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> >     >                at
>
> >     
> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> >     >                at
>
> >     org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> >     >                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)
>
> >     >             org.tellurium.exception.UiObjectNotFoundException:
> >     Cannot
> >     >             find UI Object
> >     >             communityPageRoot.return
> >     >                at
>
> >     sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >     >             Method)
> >     >                at
>
> >     
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> >     >                at
>
> >     
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> >     >                at
>
> >     java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> >     >                at
>
> >     
> > org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:70)
> >     >                at
>
> >     
> > org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:64)
> >     >                at
>
> >     
> > org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:78)
> >     >                at
>
> >     
> > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:55)
> >     >                at
>
> >     
> > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:191)
> >     >                at
>
> >     
> > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:199)
>
> ...
>
> 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]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to