Testing Google App Engine Application's doPost() from Development Mode

647 Views Asked by At

I am working on a Google App Engine Application, and I have implemented a servlet that I want to test. Specifically, I want to call the doPost() method of the servlet, and check the results. Is there any way that I can do this without having to re-deploy every time?

Currently I have to deploy to check it, which is very inconvenient. If this is my (not actual) deployed URL:

HttpPost postMethod=new HttpPost("http://my_app.appspot.com/my_app/my_app_place");

However, if I put the development mode URL in the HttpPost(...) I get a "Permission Denied" Error. Has anyone managed to do this before?

2

There are 2 best solutions below

0
On

If you ar just testing the Servlet (and not the UI), it should be sufficient to use HttpUnit's ServletUnit.

0
On

If you can't POST to your servlet locally via Java, would using a command-line tool such as cURL suffice?

curl -X POST [see cURL's man page for the arguments you need] http://localhost:8080/my_app/my_app_place

cURL's man page can be found here.