Skip to content

maxgerhardt/pio-unit-test-mock-ioabstraction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PlatformIO IoAbstraction + ArduinoFake demonstration project

See https://community.platformio.org/t/getting-started-with-unit-testing/18946 for reference.

The unit tests in test/test_desktop feature examples for unit tests that mock the IoAbstraction library, the Wire library and the Arduino core in general.

A small business logic class is tested that reacts on a switch, using the IoAbstraction library. It is shown how that class can be unit-tested using mocking techniques.

How to test PlatformIO based project

  1. Install PlatformIO Core
  2. Download examples source code
  3. Extract ZIP archive
  4. Run these commands:
# Change directory to example
> cd platformio-examples/unit-testing/calculator

# Test project
> platformio test

# Test specific environment
> platformio test -e uno

# Process test on native desktop machine
> platformio test -e native

About

PlatformIO example using ArduinoFake and IoAbstraction for unit testing on the desktop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published