Re:Parse, Don't Validate (2019)
by exdsq on Saturday June 26, 2021 @02:50PM
(#27644709)
How do you know your code works when you write it if you don't test it?
[ Parent
| on HN ]
Sorry, should have said “aren’t JUST to make sure your code works when you write it”
I was specifically responding to the commenter I replied to, who said they didn’t need tests because their code just worked the first time after he wrote it.
Re:Parse, Don't Validate (2019)
by globular-toast on Saturday June 26, 2021 @06:09PM
(#27646387)
You don't. But you only need to test it once (manually), then commit it.
You write automated tests so that you can keep running the tests later such that the behaviour is maintained through refactor and non-breaking changes.
you run it. look at the results or output. like the stdout, or a file it changed, or in a REPL or debugger. depends on situation
Re:Parse, Don't Validate (2019)
by chrisandchris on Saturday June 26, 2021 @04:21PM
(#27645480)
Yeah I‘m not sure that‘s how software engineering should work.
Tests should prove a desired behaviour. Sometimes it‘s not possible to fully run code until late in some staging, just because there are a lot of dependencies and conplexity. That‘s what tests are for (on various lebels of abstraction).
I think it depends on the task. Some code we write is so simple and only used a few times that you don’t need tests.