Re:Kite is saying farewell, and is open-sourcing all of its ...
by dboreham on Sunday November 20, 2022 @05:31PM
(#33686180)
I wonder if this says something about the nature of test code?
[ Parent
| on HN ]
Re:Kite is saying farewell, and is open-sourcing all of its ...
by djbusby on Sunday November 20, 2022 @05:35PM
(#33686219)
Sure, it's been loads of boilerplate since forever.
Re:Kite is saying farewell, and is open-sourcing all of its ...
by throwawaysleep on Sunday November 20, 2022 @06:14PM
(#33686570)
Tests often have tons and tons of boilerplate
Re:Kite is saying farewell, and is open-sourcing all of its ...
by jacurtis on Sunday November 20, 2022 @07:18PM
(#33687101)
Test are always mostly boilerplate and rarely include anything crafty.
95% of tests are: instantiating a class, running a method, and then asserting that the result. Tests do not or should not be crafty creative code snippets. They are boring functional code blocks by design and most are very similar, only changing out inputs and assertions between tests.
Re:Kite is saying farewell, and is open-sourcing all of its ...
by paledot on Sunday November 20, 2022 @07:43PM
(#33687287)
I'd go so far as to say if your test is doing something crafty, you're doing tests wrong. Maybe in a mock or fixture, but that's a write-once sort of affair.
I also don't apply DRY (don't repeat yourself) to tests. Tests should be independently readable beginning to end, no context needed. After all, the true value of a unit test is to take a block of code too complicated to easily fit in your mind, and break it down into a series of examples simple enough to fit.