You only need to _mock_ the object, that is emulate behavior on a small scale.
It depends on what we are testing.
It can actually be worse than useless to rely on the "perfect world" of unit testing. I have had a nasty shock, when switching from mocked behavior to real-world behavior. I write about that here: https://medium.com/chrismarshallny/concrete-galoshes-a5798a5...
Also, I don't think there's as much value in unit tests than other more holistic types of testing, i.e. functional/integration tests.
TBH I read your linked article and still don't quite know what a test harness (in that context) is and in what way it's better and differs exactly in the concrete. Guess I'll have to read up on it elsewhere.
Something along these lines:
"A test harness is a [usually] simple standalone application that uses the CuT, and presents a user interface. Since it is for testing, it may expose internal metrics and allow the user to access parts of the code that are usually hidden."
Perhaps some sort of formal spec for the hardware communication API would help, and would also help on the ASIC side, but I can't see how such a thing would be built and popularised. It's a very small balkanised world of driver writing.
I write device control software. It’s very difficult to have true automated testing of things like drivers. You can write unit tests for subsystems, like packet parsers, but integration testing generally requires good ol’ “monkey testing.”
“Just write a mock!” Is what I hear all the time.
Mocking a device is a massive project; potentially larger than designing the device, itself. Remember that the mock needs to be of unimpeachable quality, and also needs to do things like simulate adverse signal environments.
DX for that kind of thing can be awful.
As far as basic DX goes...
Most developer tools are wrappers for command-line OS tools, and it shows.
They can also be quite buggy, and we accept this bugginess. I use Xcode, which is quite “crashy.” I am constantly fixing issues by deleting the build folder.
Back to testing...
I prefer test harnesses over unit tests. I write about that here: https://medium.com/chrismarshallny/testing-harness-vs-unit-4...