John Overbaugh wrote:
> One of the challenges we are facing at Medicity is implementing unit
> tests which validate the logic in various layers. Right now, for
> instance, a lot of logic is in stored procedures and our code just
> bubbles that data up. We're working on refactoring that logic into the
> business logic layer, where it'll be more easily unit tested. Another
> problem we face, however, is unit testing the work done in the
> presentation layer. We have implemented various versions of
> .NET/ASP/ASPX and Ajax, so our presentation layer is chock-full of
> session management, some data manipulation/event handling, view state
> management and other Ajax functionality. I've been digging around and I
> have found a lot of stuff on the Web proving a lot of companies are
> grappling with this issue, but no really solid suggestions.
Will ASP allow you to cook a web page without sending it over the wire?
If you Mock The Server, you can then test - even TDD - by writing assertions
that parse the HTML back and extract the inserted data.
You are not testing that the page renders correctly. (That's okay, because you
are not writing the web browser itself.) You are affirming that when you
refactor the page will continue to render the same way it did before.
> I haven't looked at our code yet, but apparently there was some
> investigation into integrating Webaii as a headless test running in
> Cruise Control. Right now, I'd be happy to just have tests running on
> developer machines prior to check-in!
>
> Does anyone have a good solution they can talk about? What are some
> directions I can take to develop either a headless or a low-impact unit
> test framework, which can validate the presentation layer when it's a
> very dynamic layer?
Some web stacks don't let you Mock The Server, because they don't want you to
replace >cough< IIS with some other server. These corporate games should never
hold projects hostile...
--
Phlip