Re: Using EasyMock in GWT Test Cases

2008-09-17 Thread ksachdeva

Thanks. Although the error message that it is not able to find the
source is misleading as it makes it seem like that it trying to
generate javascript out of it.

Regards
Kapil

On Sep 14, 7:26 pm, Arthur Kalmenson [EMAIL PROTECTED] wrote:
 It's not possible to use EasyMock in GWTTestCases. EasyMock requires
 Java Reflections (AFAIK), and therefore cannot be run in hosted mode.
 This is why you need to architect your application in such a way that
 most of your business logic lives in classes that don't use GWT
 widgets and are therefore testable outside of GWTTestCase.

 Regards,
 Arthur Kalmenson

 On Sep 13, 6:05 pm, ksachdeva [EMAIL PROTECTED] wrote:



  Hi,

  I am trying to use the EasyMock in my unit tests and I am getting a
  weired behavior. Here are the details of my configuration:

  Windows Vista SP1; GWT 1.5.2; EasyMock 2.4; Eclipse 3.4

  The error I am getting when I run my MyTest-hosted.launch
  configuration from eclipse:

  Compiling Java source files in module 'com.myns.MyModule.JUnit'
     Removing units with errors
        [ERROR] Errors in 'file:/C:/---removed-for-clarity--/test/
  com/myns/client/subpackage/MyModuleTest.java'
           [ERROR] Line 25: No source code is available for type
  org.easymock.EasyMock; did you forget to inherit a required module?

  From error it seems like it is looking for JUnit / EasyMock
  sources 

  My understanding was that in hosted mode there would be no conversion
  to JavaScript so I should be able to use EasyMock to mock some of my
  classes.

  Here is how my methods look in the test case:

   public String getModuleName() {
      return com.myns.MyModule;
    }

    public void testSimple() {
            SomeInterface mock = createMock(SomeInterface.class);
    }

  If I remove the code for mocking from testSimple() then I can see that
  my unit test work !!!

  Please help

  Regards
  Kapil- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Using EasyMock in GWT Test Cases

2008-09-17 Thread Kapil Sachdeva
So going by this theory does it do the conversion of junit libraries since
they are needed. ?. Since mocking is such an essential part of unit testing
could some one suggest how one should include it in GWT. My GWT Classes
incorporate both pure java classes and overlays on existing javascript
libraries.

GWT and its associated toos is really a lot of magic and a beautiful piece
of engineering. I wish they would publish more articles, documents etc on
the internals of GWT so others could learn from experiences of these great
developers.
Regards
Kapil
On Wed, Sep 17, 2008 at 2:19 PM, Ian Petersen [EMAIL PROTECTED] wrote:


 On Wed, Sep 17, 2008 at 12:10 PM, ksachdeva [EMAIL PROTECTED] wrote:
  Thanks. Although the error message that it is not able to find the
  source is misleading as it makes it seem like that it trying to
  generate javascript out of it.

 That's exactly what it's trying to do.  If you had provided sources,
 it _then_ would have complained that the reflection-related classes
 are not available.

 Ian

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Using EasyMock in GWT Test Cases

2008-09-17 Thread Ian Petersen

On Wed, Sep 17, 2008 at 5:50 PM, Kapil Sachdeva [EMAIL PROTECTED] wrote:
 So going by this theory does it do the conversion of junit libraries since
 they are needed. ?

GWT comes with a JUnit implementation that suits the needs spec'd out
by the GWT developers.  I'm not sure what that actually means, but I
do know the conversion was done manually--whatever source was needed
was written by hand.  There's no magic automatic conversion happening
in the background.

 Since mocking is such an essential part of unit testing
 could some one suggest how one should include it in GWT. My GWT Classes
 incorporate both pure java classes and overlays on existing javascript
 libraries.

You probably need to look into writing a generator.  Ray Cromwell has
an excellent primer on generators in his blog at
http://timepedia.blogspot.com/.  I think the relevant entries are
called Generators and Generators part deux, or something like
that.  The articles are quite old by now.  You can also search the
history of this list and the history of the
Google-Web-Toolkit-Contributors list for discussions on generators or
reflection because the answer to just about every reflection question
is use a generator.  Finally, the GWT source includes several
generator implementations--there's at least the RPC generator, the
i18n generator, and probably several others.

Ian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Using EasyMock in GWT Test Cases

2008-09-14 Thread Waleed Zedan
Hi,

Try to include the easy mock jars in the classpath of the gwt compiler.

br.

On Sun, Sep 14, 2008 at 2:05 AM, ksachdeva [EMAIL PROTECTED] wrote:


 Hi,

 I am trying to use the EasyMock in my unit tests and I am getting a
 weired behavior. Here are the details of my configuration:

 Windows Vista SP1; GWT 1.5.2; EasyMock 2.4; Eclipse 3.4

 The error I am getting when I run my MyTest-hosted.launch
 configuration from eclipse:

 Compiling Java source files in module 'com.myns.MyModule.JUnit'
   Removing units with errors
  [ERROR] Errors in 'file:/C:/---removed-for-clarity--/test/
 com/myns/client/subpackage/MyModuleTest.java'
 [ERROR] Line 25: No source code is available for type
 org.easymock.EasyMock; did you forget to inherit a required module?

 From error it seems like it is looking for JUnit / EasyMock
 sources 

 My understanding was that in hosted mode there would be no conversion
 to JavaScript so I should be able to use EasyMock to mock some of my
 classes.

 Here is how my methods look in the test case:

  public String getModuleName() {
return com.myns.MyModule;
  }

  public void testSimple() {
  SomeInterface mock = createMock(SomeInterface.class);
  }

 If I remove the code for mocking from testSimple() then I can see that
 my unit test work !!!

 Please help

 Regards
 Kapil


 



-- 
Waleed Zedan
SCJP 1.4 , CCNA

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Using EasyMock in GWT Test Cases

2008-09-14 Thread Arthur Kalmenson

It's not possible to use EasyMock in GWTTestCases. EasyMock requires
Java Reflections (AFAIK), and therefore cannot be run in hosted mode.
This is why you need to architect your application in such a way that
most of your business logic lives in classes that don't use GWT
widgets and are therefore testable outside of GWTTestCase.

Regards,
Arthur Kalmenson

On Sep 13, 6:05 pm, ksachdeva [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to use the EasyMock in my unit tests and I am getting a
 weired behavior. Here are the details of my configuration:

 Windows Vista SP1; GWT 1.5.2; EasyMock 2.4; Eclipse 3.4

 The error I am getting when I run my MyTest-hosted.launch
 configuration from eclipse:

 Compiling Java source files in module 'com.myns.MyModule.JUnit'
    Removing units with errors
       [ERROR] Errors in 'file:/C:/---removed-for-clarity--/test/
 com/myns/client/subpackage/MyModuleTest.java'
          [ERROR] Line 25: No source code is available for type
 org.easymock.EasyMock; did you forget to inherit a required module?

 From error it seems like it is looking for JUnit / EasyMock
 sources 

 My understanding was that in hosted mode there would be no conversion
 to JavaScript so I should be able to use EasyMock to mock some of my
 classes.

 Here is how my methods look in the test case:

  public String getModuleName() {
     return com.myns.MyModule;
   }

   public void testSimple() {
           SomeInterface mock = createMock(SomeInterface.class);
   }

 If I remove the code for mocking from testSimple() then I can see that
 my unit test work !!!

 Please help

 Regards
 Kapil
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Using EasyMock in GWT Test Cases

2008-09-13 Thread ksachdeva

Hi,

I am trying to use the EasyMock in my unit tests and I am getting a
weired behavior. Here are the details of my configuration:

Windows Vista SP1; GWT 1.5.2; EasyMock 2.4; Eclipse 3.4

The error I am getting when I run my MyTest-hosted.launch
configuration from eclipse:

Compiling Java source files in module 'com.myns.MyModule.JUnit'
   Removing units with errors
  [ERROR] Errors in 'file:/C:/---removed-for-clarity--/test/
com/myns/client/subpackage/MyModuleTest.java'
 [ERROR] Line 25: No source code is available for type
org.easymock.EasyMock; did you forget to inherit a required module?

From error it seems like it is looking for JUnit / EasyMock
sources 

My understanding was that in hosted mode there would be no conversion
to JavaScript so I should be able to use EasyMock to mock some of my
classes.

Here is how my methods look in the test case:

 public String getModuleName() {
return com.myns.MyModule;
  }

  public void testSimple() {
  SomeInterface mock = createMock(SomeInterface.class);
  }

If I remove the code for mocking from testSimple() then I can see that
my unit test work !!!

Please help

Regards
Kapil


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---