Research Log of Web Science Students

Computer Science is not simply programming

How do you unit test Oauth Controllers?

leave a comment »

I like Spring MVC because you can unit test your controllers. No need to start and stop your application server from time to time and see what happens — if the controller actually gets this set of data you want and puts them in the model.

I was particularly fascinated with using mock requests and response objects that you can pass to the controllers so you can invoke say their handleRequestInternal method, get the ModelAndView and see if the model contains the info you need:.

But testing Oauth controllers is another thing. For instance if I want to get the authorization url because I want to Oauth to GData, I would have to deploy the web-app because Google will only accept authorization requests from my domain (the url of my web app), not my development environment whose domain is localhost:8080.

So right now the only way I am testing if my code works is deploying the code and printing out the data that I need to have printed. Pretty old school if you ask me.


Written by Jose Asuncion

September 23, 2009 at 5:53 pm

Posted in Hardwire

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: