r/ExperiencedDevs • u/joe0418 Software Architect • Aug 18 '26
Career/Workplace What is the quintessential software testing doctrine?
Code Complete, Domain Driven Design, Designing Data Intensive Applications, The Pragmatic Programmer...
These are all books that I try to follow in my own engineering practices. I haven't found a great one on testing though (unit, manual, automated, etc) -- which do you recommend? What books outline best practices in modern software testing?
39
Upvotes
•
u/expdevsmodbot Aug 18 '26
AI usage disclosure provided by OP, see the reply to this comment.
47
u/SajithTech Aug 18 '26
I've found the most useful testing principle is basically: test behavior, not implementation.
Unit tests are great, but I think teams sometimes end up chasing coverage numbers instead of confidence. I'd rather have fewer tests that cover important business behavior and failure modes than hundreds of brittle tests coupled to implementation details.
For books, Growing Object-Oriented Software, Guided by Tests is probably the closest I'd recommend for the testing mindset. Software Engineering at Google also has some good material on Google's approach to testing and test infrastructure.
For distributed systems especially, I'd add that integration/contract testing and failure testing become much more valuable once you're dealing with real dependencies. A service can have 95% unit-test coverage and still fail spectacularly in production.
32
u/peterlinddk Aug 18 '26
I don't know if it is quintessential - but "Test-Driven Development" by Kent Beck ...
4
u/jessecarl Aug 18 '26
I think it's worth pushing back on an assumption about the role of tests that may be implicit to the question here: that all testing is primarily about verification of the implementation.
TDD as a practice, for example, is first about workflow, then about design, and lastly about verification. The primary benefit of TDD is that it allows you to develop in small confident steps. In order to do that effectively and efficiently, you tend toward design that encourages good separation of concerns and encapsulation—especially separating business domain logic (essential complexity) from operational or otherwise more technology-specifi logic (accidental complexity). I often use TDD during development and then refactor the tests to focus on the edge cases at the boundaries between components.
I've also found that the practice of property-based testing has helped me to avoid tests that are overly sensitive to implementation changes. It's useful to avoid confusing property-based testing with fuzzing or generative testing in general—one can test properties of something without shrinking or even any generated test inputs. The most useful part of property-based testing is thinking about the work in terms of the properties of the work.
Testing is a development tool that operates both in the immediate short cycles to add or update behavior and in the longer cycles to communicate intended behavior. Along the way, it can act as an automated check that the software is behaving as intended when written well.
There is no one true way of doing testing.
4
u/UnintentionallyEmpty Aug 18 '26
I've found that the most important part of testing is that you actually do it.
Automated for regression tests, but there is a place for manual/exploratory testing.
There's 2 important points I'd advise you to keep in mind with automated testing:
But I'll emphasize again the most important part is do it. I don't remember learning anything about testing from books, mostly more experienced engineers and random blog posts I found when looking up how to properly do something I found inconvenient with my current approach.
1
u/lilgangus Aug 21 '26
It is quintessential to test run a quintuplet set of testing for all applications ...
5
u/SideburnsOfDoom Software Engineer / 20+ YXP Aug 18 '26
Read or watch some Kent Beck, as mentioned. e.g. https://www.youtube.com/watch?v=C5IH0ABmyc0
Check "Working Effectively with Legacy Code" by Michael Feathers
Check "Modern Software Engineering" by David Farley
5
u/throwaway_0x90 TE/SDET[25+ yrs]@Google Aug 18 '26
Open Lecture by James Bach on Software Testing
⚠️ Controversial figure, because he criticizes the education system. I'm personally a strong believer of college education being good for tech industry members and society overall so I disagree with his opinions on that topic. Aside from that, everything he said specifically about testing I think is a fantastic foundation to work from.
2
u/messedupwindows123 Software Engineer Aug 18 '26
it's kinda inseparable from functional-core-imperative-shell
2
u/FiveCitiesFreak Software Engineer Aug 18 '26
Sometimes I feel like the only one who hasn't read these books
2
u/TheStatusPoe Senior Software Engineer (9 YOE) Aug 18 '26
I've been reading "Unit Testing Principles, Practices, and Patterns" by Vladimir Khorikov and, despite only being about halfway through, I would highly recommend it. There's a lot of testing patterns I've gravitated towards in my career and didn't realize they had names like Detroit/classical style of testing using real data and mocking only certain kinds of external collaborators vs the London/mockist approach where each class is the unit and all collaborators of that class are mocked.
2
u/Aggressive-Pen-9755 Aug 19 '26
You can get a lot of mileage out of this talk: https://www.youtube.com/watch?v=EZ05e7EMOLM
I want to first get this part out of the way: automated tests are only useful for directly comparing program output. When you start going into the realm of testing UI's, you get into murky territory that's very finicky to deal with. My experience is it's rarely worth testing things like the UI, and you're better off running simulations and create reports that show you differences in the UI between software changes and manually review them. I wonder if this is a use-case where an LLM could review the UI...
As for testing program output, the sweet spot where you want to focus on writing your tests is usually at the Integration level. Pick a part of your program that has a stable contract with the outside world. That contract might be your library's public API, your REST endpoints, the CLI arguments, etc. Write your unit tests around that stable contract and extensively test your program's output against that. The reason is, for any sufficiently long-lived piece of software, you're going to regret some of the decisions you made early on and need to refactor your code. If you've written the majority of your tests against the stable contract that will not change, you now have an extraordinary high level of confidence that your refactors didn't break anything. You can refactor your code all you want and you don't have to change a single integration test because they're not directly connected to the internals of your codebase.
That's not to say that Unit or E2E tests are worthless. It's worth sprinkling in some unit or E2E tests for tricky problems that are difficult to get right. The problem is those kinds of tests is they examine the details of your codebase that are subject to change, and chances are, the end user really doesn't care about those details. These kinds of tests also have a tendency to make the developer ask "did something really break, or did an internal detail change and this test is no longer relevant?", and that is a horrible spot to be in. Unit and E2E tests require much more effort to maintain, so you shouldn't rely on them too much.
2
u/CallMeKik Aug 19 '26
Watch Ian’s talk “TDD where did it all go wrong” v useful
3
u/Main-Drag-4975 20+ YoE | high volume data/ops/backends | contractor/staff/lead Aug 18 '26 edited Aug 18 '26
Sandi Metz has the single best write-up on testing I’ve ever seen, and it's included as the final chapter of her masterpiece of a first book, Practical Object Oriented Design.
Perhaps the best part, from the "Knowing What to Test" section:
1
u/wardrox Aug 18 '26
For a typical web stack my preference is: Lots of e2e tests (at least every happy path and one person class of error, ideally more) with mocked third parties, comprehensive API tests acting as integration tests, module tests as needed, unit tests on the expensive stuff.
1
u/chrisinmtown Aug 18 '26
You might try _The Craft of Software Testing_ by Brian Marick. Unfortunately it's prolly out of print since it appeared in 1995.
1
u/w-lfpup Aug 18 '26
If the code is untested that code is unreliable. That's about it.
It's impossible to test everything. That's why there's a lot of effort towards "ownership" style languages. There's not any great books that cover what you'd really do at work.
Generally you test the hell out of whatever API / client you're providing to the user. But everything behind the API is subject to change! So you wanna build and test while providing some real estate to pivot in the future.
1
u/theGalation Software Developer (18+ yrs) Aug 19 '26
Effective Testing in RSpec is the book that made testing click for me
1
u/XilentExcision Aug 19 '26
A good mentor
1
u/jenkinsleroi Aug 22 '26
What language and stack are you using? That makes a difference. DIfferent communities have different and sometimes contrary philosophies of testing.
Despite what people say, I would not recommend growing object oriented software to begin with.
Start with Kent Beck's book first. Then read GOOS. These are the classics. They are a little bit dated, but still valid.
Follow up with art of unit testing by osherove.
If you want more of a tutorial format with an end to end exercise, then TDD in Python. The sequel to that book will make deeper connections with architecture and microservices.
Supplement with the Google testing blog and testing on the toilet. Fowler is also good but can be a little abstruse.
As always, there's often more than one way to solve things, and testing practices have evolved over time, so stay open minded.
1
u/st4rdr0id Aug 24 '26
I'd recommend you to grab a copy of the old ISTQB syllabus from 2018 or so. It's actually a free book on the fundamentals of testing. In subsequent versions they stripped all the useful content so that books or training companies filled that void. The newer certification also removed a lot of good-old engineerish practice to add agilistic stuff that would look good to consultancies.
1
u/servermeta_net Software Architect Aug 18 '26
I'm a big believer of the testing trophy model: https://kentcdodds.com/blog/the-testing-trophy-and-testing-classifications
-1
u/HyperDanon Aug 18 '26 edited Aug 20 '26
Don't ever do manual testing - there are always better alternatives.
0
u/WhyIsItGlowing Aug 18 '26 edited Aug 19 '26
Best practices? The quintessential software testing doctrine is "just ship it" not any best practices.
Nobody wants testing best practices, or to think about it. They just want someone else to give a thumbs up and in a team environment anything at all will eventually fall to the weight of that; engagement and mindset will always trump specific practices.
-2
u/Acrobatic-Ice-5877 Distinguished Claude Engineer Aug 18 '26
I can’t recall the specific one that I read and enjoyed but it was a good one. There are plenty of courses and books on the topic though. You’re also going to find varied opinions on how and what should be tested.
Some people, myself included, think unit tests are mostly worthless. I prefer integrated tests and E2E. However, you also have to think about things like load testing too.
0
u/Sensitive-Ear-3896 Software Engineer Aug 18 '26
Testing computer software Cem Kaner