So for a while now I've been trying to make use of testing in a way to boost the quality and productivity in my code writing. So far I just end up spending more time on test writing for not very much benefit. I think its because I still don't really understand what TDD is supposed to be about.
I'm not talking about the tests themselves, I mean conceptually, what is it that I'm really testing and how do I use it in a way that is actually useful. I'm asking because the way I do testing now seems like a burden.
My understanding of TDD is that the output or state given by a set of code is determined by some predefined pass/fail condition. Obvious enough.
In terms of Declarative vs. Imperative code:
Do the test conditions necessarily have to be declarative?
Do I have to write a unit test for each function, or can I just write a test that implies the use of that function?
I'm doing this challenge for practice from a company I applied to work for many years ago: github.com/pillar/checkout-order-total
e.g. Since the point of the task is to calculate the final sum of all scanned items, could I just write one test to validate the final state after each function is run?
Should I still write unit tests for each type of scan?
Is it OK to write Imperative and Declarative tests at the same time, or is Declarative always better?
Also, could you give me any other advice on the best way to approach test writing for this challenge
submitted by /u/dominic_l
[link] [comments]
from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/ZQ6Eo0j