Monday, December 31, 2012

Re: JMockit compatible with GWTTestCase?

There are very few GWT-compatible mocking tools. Actually I know only one, inspired by EasyMock and made by Googlers: https://code.google.com/p/easy-gwt-mock/
An alternative is to "mock GWT" so you can avoid using a GWTTestCase, and thus use the mocking tool you want (including JMockit): https://github.com/gwt-test-utils/gwt-test-utils
But I'm doing things like Jens suggest: abstract GWT-only classes (views) behind interfaces that can easily be mocked, so that a GWTTestCase is not necessary to unittest the business and/or presentation logic.

On Friday, December 28, 2012 9:15:14 PM UTC+1, James Scott wrote:
Hello all-

I'm trying to use JMockit in a GWTTestCase (JUnit 3, for what it's worth) and I'm not having any luck. I have jmockit.jar on my classpath for the test, but when I run it, I get this error message:

[ERROR] Line 50: No source code is available for type mockit.NonStrictExpectations; did you forget to inherit a required module?

Line 50 is where I have my NonStrictExpectations declared in my test case. Right now, it's empty.

I tried TRACE-level logging of the unit test run in Eclipse, and I get similar "no source code available" errors for other classes in the application GWT client code, but those are not under test and not in the same module as the code under test, so I don't think those are interfering.

My classpath includes my Eclipse output dir, GWT jars, jmockit.jar and junit.jar. Is there something else that should be in the classpath?

Thanks,

JLS

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/JvQ_wykdYMEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment