|
Project Information
|
OverviewIf you want locally test some TaskQueue and task was guicified you can use this project for this. StatusThere early beta release, bugreports are welcomed. Limitations in current release:
UsageYou should add some GAE testing jars in your project:
(read this: Local Unit Testing) Look at LocalServiceTestHelper config example. Typical usage looks like this: public void SomeTest() {
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
LocalTaskQueue ltq = LocalTaskQueueTestConfig.getLocalTaskQueue();
...
Injector inj;
inj = Guice.createInjector(new AppConstsModule(), new MyServletModule());
AppConsts consts;
consts = injector.getInstance(AppConsts.class);
SomeTaskServlet someTaskServletInstance = inj.getInstance(SomeTaskServlet.class);
SomeCronServlet someCronServletInstance = inj.getInstance(SomeCronServlet.class);
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
request.setMethod("GET");
request.setParameter("paramName", "paramValue");
ServletRunner.runMockServlet(someCronServletInstance, request, response);
int ti;
//this run all tasks in queue "SomeQueueName"
ti = TaskRunner.runTasksInQueue("SomeQueueName", someTaskServletInstance);
...
}INSTALLRun this: svn checkout http://gaelocaltest.googlecode.com/svn/trunk/ gaelocaltest-read-only Then just run ant and use /dist/lib/gaelocaltest.jar in your project. In build.xml exist property "version" - this is version of GAE SDK which has been downloaded and used in building process. You can change it if you need other version. |