views:

71

answers:

4

A friend suggested instead of having a backend class which verifies the user permission in every public function (results are cached and non static) i should have a more 'streamlined' site. When i dropped the backend i also drop the database code and merged them in the appropriate user permission (base user, logged_in_user, moderator).

The site code looks better now that merging them has decreased LOC (tons of LOC in fact) and i write Method() instead of backend.Method() which increases readability. However now that i have no backend how am i suppose to unit test my code? and what about things like user file upload with different extensions? (txt vs jpg vs FLAC)

+5  A: 

You could always use something like selenium to have a browser drive your website and then assert various conditions.

Not technically unit tests, I guess. But better than no testing at all.

codeape
+3  A: 

You can use WatiN for browser automation testing...

Ramesh Vel
+1  A: 

As codeape said there are alternatives than unit testing, an alternative is Visual Studio's Website Test

Pedro
+2  A: 

Google spoke about this at GTAC 2008. They had started looking at creating stubs and mocks for the backend and then run their selenium tests against the front end. This means that when the frontend is doing calls to the backend it is returning something meaningful.

The video of the talk is here http://www.youtube.com/watch?v=5jjrTBFZWgk

AutomatedTester