Prompted by this Twitter thread https://twitter.com/Foone/status/1229641258370355200
Basically someone posted a single line of code on Stack Overflow a few years ago. A developer on the Docker project, and a developer at Razor (the gaming device people) used that same line of code. Code which just happens to assume it returns a GUID, but the guid they both got was the same one. Read the thread to find out why, and why it caused them both pain. And then come back and read on, trust me, it’s not a deep technical reason. But the resulting bug is fatal to an end user.
So, as a tester, how can we detect this specific kind of fault? Unit Testing is unlikely to scale well as a solution, but keen to hear if anyone can come up with a good unit test pattern that might catch it? Could we write an integration test or even a component test for this specific problem (not the copy-paste problem, but the GUID problem or at minimum the “duplicate app launch” problem it’s trying to solve.) Is, it realistically possible to statically detect the copy-paste problem in a codebase (aka Black Duck) style?
Whenever I come back to a problem after a long break, I hear fresh ideas, since this is not the first time somebody copy-pasted StackOverflow code and injected a nasty bug. Keen to see if there are fresh heuristics to follow as a tester.