The [page on testing][1] suggests this:<p>> Where possible, and where it makes sense, you should try to test as much as possible on your host machine, not on the target device.<p>When I have tried this I have encountered multiple problems, first that the Rust test framework requires std, making it convoluted writing test code – but when working around that using conditional compilation, I run into other things like the `esp-hal` depending on crates that won't compile on the host.<p>What is the recommended way to test on the host?<p><pre><code> [1]: https://docs.espressif.com/projects/rust/book/application-development/testing.html</code></pre>
Especially for embedded work (but for regular software too!) I've bought into the "sans-io pattern" for a lot of the software i write anymore<p><a href="https://sans-io.readthedocs.io/how-to-sans-io.html" rel="nofollow">https://sans-io.readthedocs.io/how-to-sans-io.html</a><p>Keeping all of the actual hardware/network/io interface code separate really makes writing unit tests and porting to different computers much simpler
This is a constant issue for me in every facet of embedded development - with the sole exception of devices that can easily be tested in a qemu environment.<p>I would also love to hear that the authors of this book suggest.