user34537
user34537

Reputation:

How do i unit test a website with no backend class?

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)

Upvotes: 5

Views: 445

Answers (4)

RameshVel
RameshVel

Reputation: 65877

You can use WatiN for browser automation testing...

Upvotes: 3

AutomatedTester
AutomatedTester

Reputation: 22438

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

Upvotes: 2

Pedro
Pedro

Reputation: 11884

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

Upvotes: 1

codeape
codeape

Reputation: 100906

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.

Upvotes: 5

Related Questions