News for hackers. Stuff that matters.

Ask HN: Could you recommend a good book about writing automated software tests?

I very much appreciate the value of writing automated tests for the software, but I don't have much experience beyond elementary unit tests of functions with well-defined inputs and outputs. Real-world software has complex object relationships, multiple side effects, and user interactions. Could someone recommend me a good book or online resources about patterns and strategies for writing more complex automated tests that take into account the complexity of real-world software?
( 4 comments | 4 points | on HN )
Re:Ask HN: Could you recommend a good book about writing aut... by readyplayernull on Wednesday April 26, 2023 @12:26PM (#35716269)
It depends on the kind of software you are testing and the tools available. There are different testing frameworks for web, mobile, native, databases and also performance measuring tools. I don't think there is a book that covers all those topics. Even dynamic web automation is quiet complex and requires a lot of work to track the controls and events in the DOM, might even require defining best practices for the devs to set labels and signals. BTW, I'm an Automation Engineer looking for job :)
Re:Ask HN: Could you recommend a good book about writing aut... by aastronaut on Wednesday April 26, 2023 @01:07PM (#35716918)
To add to this, for me personally the difficult part in automated test isn't the definition of expected output, but the retrieval of actual output in an automated way. Test frameworks can and will only focus on a limited set of interaction (Playwright for DOM, detox for mobile etc.).

I think Brendan Gregg's books[0][1] are quite inspiring for an understanding of a system with its inner workings, and provide information about various tools one can use to dissect a system and get some actual output in an automated way.

[0]: https://www.brendangregg.com/systems-performance-2nd-edition...

[1]: https://www.brendangregg.com/bpf-performance-tools-book.html

Re:Ask HN: Could you recommend a good book about writing aut... by PaulHoule on Wednesday April 26, 2023 @12:01PM (#35715897)
Re:Ask HN: Could you recommend a good book about writing aut... by hayst4ck on Thursday April 27, 2023 @12:55AM (#35723486)
The first paradigm to understand is that everything that makes code bad is also what makes it hard to test. If code is hard to test, that means the code is bad.

This was in my opinion the best and quickest source on good testing practice, which often meant change the code being tested:

https://misko.hevery.com/code-reviewers-guide/

Sadly, it looks like he has neglected his site, but the content can still be seen through google cache.

This page still seems to work and contains a much meatier amount of content: http://misko.hevery.com/attachments/Guide-Writing%20Testable...