I'm trying to develop some effective integration tests for my GAE/j application. I'm familiar with https://developers.google.com/appengine/docs/java/tools/localunittesting -- these tools are great for small unit tests. I'm now interested in developing integration tests that test actual web requests. For example, I'd like to test that web.xml is mapping servlets and filters to the expected URLs and test that my JSPs generate what I expect.
My aim was to bring up a local development server inside the JVM, which I could fire requests against. I'm open to other integration strategies, though; as I say above, I just want to effectively test JSP generation and other request-level features.
I've managed to use DevAppServerFactory to start a development server in the same JVM. However, it appears that the DevAppServer this generates uses a separate classloader from the main JVM. This makes testing a lot more challenging--I can't use any of the local unittesting Local*TestConfig classes to control behavior of this server. Similarly, I can't "roll my own" hooks for modifying behavior via e.g. statics, since the statics I can mutate in the test harness aren't the same statics the DevAppServer is looking at. This makes it challenging to skip features not central to the current test (e.g. requiring login), to inject failures, to inject mocks, etc. This really limits how completely and efficiently I can test my code.
I've found a real dearth of documentation on the web for integration testing with App Engine. I'm sure someone has done this before...are there any tips or resources out there you can share?
Basically, you need to do two things:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With