3 ms·
Did my first big project with >200 Unit-Test, like we learned at university, haha. Well, then requirements changed, and most of them started failing. In the en
by k__ 10y ago
Did my first big project with >200 Unit-Test, like we learned at university, haha.
Well, then requirements changed, and most of them started failing. In the end I spent most of my time fixing the now wrong tests.
On the other hand, stability goes down if I don't do any testing.
At the moment I do automated UI testing. I'm a front-end dev so this seems to catch many things, especially thanks to test-videos and screen-shoots.
I'll try TypeScript in my next production project, simply because I don't know how to write the right amount of good unit-tests. But I know that TypeScript doesn't prevent all bugs, so I guess I'll have a blind spot between the type-checker and the UI tests, but hopefully it won't be too big :\
- texuf 10y agoIn my ideal world, when requirements change, you first change the tests to reflect the new requirements. Then you change code till all the tests pass. Then you're done. Things don't always work in this manner, but it feels great when they do. UI tests are probably the hardest to write this way.
- ajmurmann 10y agoI think the cost of unit tests when changing code also varies with the quality of the design. If your code manages to some degree to follow the open/closed principle you should be able to just throw out some of your classes. On the other hand that also implies that maybe in those cases the unit tests could have been tossed earlier. However, there always will be things that won't be extended but actually need to be changed and you won't know in advance which is which. I do however like the idea of unit tests as a scaffold that guide you to build the right thing and then you toss them. Usually I have only very few construction sides in my code base that I am confident enough to burn the scaffold down. It would be an interesting idea to TDD a project and always delete all unit tests after you are done with them and only keep cheaper acceptance tests around. Maybe you would actually ho faster