News for hackers. Stuff that matters.
Re:Goodbye, Clean Code by ummonk on Saturday January 11, 2020 @09:24PM (#22024027)
If you try to abstract away tests, you often just end up re-implementing the same abstractions used in the actual code, and you can end up not catching unfounded assumptions that your abstraction is making in both the tests and the code. There is a scope for having test helpers / utils to make tests easier to write, but you should be minimalist with these.
Re:Goodbye, Clean Code by 3pt14159 on Saturday January 11, 2020 @10:36PM (#22024300)
I agree, but some test helpers are reasonable. It's about balance and readability of the tests in question. Otherwise integration tests end up being a hundred lines of code.
Re:Goodbye, Clean Code by ajuc on Sunday January 12, 2020 @06:58PM (#22030668)
The problem with abstractions in testing is - you should test it :)
Re:Goodbye, Clean Code by rbanffy on Sunday January 12, 2020 @01:24AM (#22024815)
Tests should also be treated as a form of documentation. A test should reflect the way you'd use the code in real life as closely as feasible.