3 ms·
Does anybody actually do Test Driven Development for the web? Looking through the stack of features and bugs I've run through in the last couple days, I can't
by jasonkester 16y ago
Does anybody actually do Test Driven Development for the web? Looking through the stack of features and bugs I've run through in the last couple days, I can't find even one of them for which you could write a unit test.
- "Timeline ticks don't line up with grid when changing scale"
- "Resizing shapes is jerky in FireFox"
- "Need a button you can hit to pull up a simple Help screen"
- "Add an opacity slider for shapes"
Unit testing rendering correctness during mouse actions? Unit testing for UI features? Unit testing for CSS? Hacka please.
If you're doing little comp-sci type things on the server then sure you can do TDD. It makes sense in the context of building a string library or wrapping somebody else's API. In the web startup world though, how often are you actually doing that stuff?
- kevingadd 16y agoTDD doesn't necessarily mean unit tests. We write tons of functional integration tests to make sure that stuff like you describe works, using Selenium, YUITest, and the like. It's extremely valuable, since the alternative for us is manually testing every single feature on the site anytime something changes.
- jasonkester 16y agoHow much time would you say you spend writing those tests? Maintaining them? Just capturing a complex UI interaction that you can verify at a glance in person is next to impossible with the tools you mention. Unless they've made some serious progress in the last few months. For the issues I listed above, how many of them do you actually consider to be testable, using TDD's "write your tests first" definition of the word.
- philbo 16y agoI think it's pretty widely accepted that TDD is not a good fit for UI development. What is important is ensuring that there is a clean separation between the UI and any operational code, such that the operational code can be unit tested in isolation. Then frameworks such as Selenium can be used to focus on testing the functionality of the UI. But, as you indicate, automated testing of UI look-and-feel is not trivial.
- marknutter 16y agoYou're talking about a lot of UI stuff here, which is certainly testable, albeit taking some cleverness, but it's not an excuse for not doing backend logic testing.
- jimbokun 16y ago"If you're doing little comp-sci type things on the server then sure you can do TDD." Are you implying that your web site does not have any "little comp-sci type things on the server" aspects? "Add an opacity slider for shapes" This seems like the kind of thing that probably does have a little comp-sci part to it. Do you have an abstraction for shapes? Maybe a unit test for the API underlying the slider, that validates that all selected shapes now have the opacity value passed from the slider? Maybe that doesn't fit the design of your code, but I strongly suspect there is some unit testable part of that task. The point being, unit testable things should have unit tests, and most tasks might have some unit testable part.