How can I unit test Arduino code?

后端 未结 20 739
情深已故
情深已故 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:26

    This program allows automated running of several Arduino unit tests. The testing process is started on the PC but the tests run on the actual Arduino hardware. One set of unit tests is typically used to test one Arduino library. (this

    Arduino Forum: http://arduino.cc/forum/index.php?topic=140027.0

    GitHub project page: http://jeroendoggen.github.com/Arduino-TestSuite

    Page in the Python Package Index: http://pypi.python.org/pypi/arduino_testsuite

    The unit tests are written with the "Arduino Unit Testing Library": http://code.google.com/p/arduinounit

    The following steps are performed for each set of unit tests:

    • Read the config file to find out which tests to run
    • The script compiles and uploads an Arduino sketch that contains the unit testing code.
    • The unit tests are run on the Arduino board.
    • The results of the test are printed over the serial port and analyzed by the Python script.
    • The script starts the next test, repeating the above steps for all test that are requested in the configuration file.
    • The script prints a summary showing an overview of all the failed/passed tests in the complete testsuite.

提交回复
热议问题