GWTTestCase meddling/not meddling

29 views
Skip to first unread message

Tim K

unread,
Jul 27, 2011, 8:53:21 AM7/27/11
to Google Web Toolkit
This tip comes from "Communicate with a Server"

"Although GWT translates Java into JavaScript for client-side code,
GWT does not meddle with your ability to run Java bytecode on your
server whatsoever. Server-side code doesn't need to be translatable,
so you're free to use any Java library you find useful."

Simply put, I want GWT to meddle with some of my code, but not all of
it.

Is there a way to have a unit test with both server and client code?
This code fails with an error message.
--------------------------------------------------------------------------------------------
import com.example.myproject.server.GreetingServiceImpl;

public class ProjectTest extends GWTTestCase {

public String getModuleName() {
return "com.example.myproject.Project";
}
GreetingServiceImpl greet = new GreetingServiceImpl();

@Test
public void test01(){
}

}
--------------------------------------------------------------------------------------------
No source code is available for type
com.example.myproject.server.GreetingServiceImpl; did you forget to
inherit a required module?
--------------------------------------------------------------------------------------------

I understand why this fails. How can we get this to work?

Thanks,
Tim

Thomas Broyer

unread,
Jul 27, 2011, 9:40:48 AM7/27/11
to google-we...@googlegroups.com
Make two distinct classes to test either client-side or server-side code?

A bit more seriously, what are you trying to achieve here mixing both client-side and server-side code in a single testcase?

david....@gmail.com

unread,
Jul 28, 2011, 3:44:32 AM7/28/11
to Google Web Toolkit
It feels like you wish to test your client side code that calls real
server side code, isn't it ?
If you would like to test your client side code that really calls the
server side code, it will be the case if you start a GWTTestCase.

You could not have a server test with a client side test despite you
are using an MVP approach.
client side code use some GWT.create that are not understood from
javac and server side code contains code not understood by
GWTTestCase...
Reply all
Reply to author
Forward
0 new messages