How can I unit test Arduino code?

后端 未结 20 741
情深已故
情深已故 2020-12-07 06:53

I\'d like to be able to unit test my Arduino code. Ideally, I would be able to run any tests without having to upload the code to the Arduino. What tools or libraries can he

20条回答
  •  执笔经年
    2020-12-07 07:24

    Keep hardware-specific code separate or abstracted away from the rest so you can test and debug that bigger "rest" on any platform for which you have good tools and with which you're familiar most.

    Basically, try to build as much of the final code from as many known-to-work building blocks as possible. The remaining hardware-specific work will then be much easier and faster. You may finish it by using existing emulators and/or emulating devices on your own. And then, of course, you'll need to test the real thing somehow. Depending on circumstances, that may or may not be very well automatable (i.e. who or what will press buttons and provide other inputs? who or what will observe and interpret various indicators and outputs?).

提交回复
热议问题