Results 1 to 3 of 3

Thread: Ho to mock GXT widgets?

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Franktown, CO
    Posts
    439
    Vote Rating
    6
      0  

    Default Ho to mock GXT widgets?

    GWT provides GWTMockUtilities which will disarm/restore calls to GWT.create so GWT can be tested using standard mocking frameworks such as EasyMock. How can I do the same for GXT widgets?

    The problem seems to be the GXT class has static members which call GWT.getModuleBaseURL(), and that method is not disarmed like create is. Is there a way around this? I've tried modifing GWTBridge to contain this method but it seems the original one is always loaded before mine.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    132
      0  

    Default

    I will open a ticket to remove the static initializer in GXT, as it is not really required. Thanks for bringing it up.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      0  

    Default

    Interesting class there David, thanks for pointing it out.

    I've made the necessary modifications to the GXT class, and I've added a few simple unit tests using Mockito to GXT to ensure that a decent sampling of classes are able to be mocked.

    The one main gotcha I found in that testing was the ToolButton, since all of those static images require GWT.create to not return null, else they will cause a NPE. I've build a mock class for when GWT.create is unwired, and it appears to pass these same tests. I've looked for all other invocations of GWT.create to ensure that we aren't using it for any static fields that could cause a NPE in class initialization, but haven't found any.

    This changeset is in SVN and the latest nightly builds, and will be available in the next release.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •