3 ms·
We do the same at work. No unit tests, only integration and regression tests. See metamorphic tests (comparing outputs for mutated inputs). One thing I've been
by hikarudo 7y ago
We do the same at work. No unit tests, only integration and regression tests. See metamorphic tests (comparing outputs for mutated inputs).
One thing I've been trying out recently is adding asserts to code (design by contract): encode function preconditions, postconditions, invariants.
Now there are many more ways to "crash" the system while testing. The gist of it is: if you know that there is a bug if a particular condition happens, add an assert encoding this. Now all code that exercises the code with the assert automatically become tests.
I've found preconditions to be more useful than the other properties.
- tempguy9999 7y agoNo offence but I'm amazed you weren't using assertions (and assertions as pre/post conditions, invars) from the start. They work so well. And true, you get many new ways to blow up the code; all to good. (Edit: pre.post/assertions/invars etc are what I've used in my own code. There's little push in most places I've worked for any testing, never mind anything systematic like this).
- hikarudo 7y agoYou're absolutely right. Assertions are so easy to use and there's no barrier to start using them. You can start small, one assertion at a time, no large refactorings required.
- tempguy9999 7y agoThanks for taking it constructively! For anyone reading this, I originally was taught assertions etc. at university but really got to use them after reading this ppt presentation by Tony Hoare (PDF here. Only took 1/2 hour to find, thanks for getting crappier, google). Really recommended! http://www.cs.cornell.edu/courses/cs2110/2014sp/assignments/a0/assertearlyassertoften.pdf http://www.cs.cornell.edu/courses/cs2110/2014sp/assignments/... Honestly, it's short, please everyone give this 10 minutes of your time. It was one of the main things that started my move from rando programmer to something closer to engineering practice. I just wish companies I worked for gave a damn for it.