Home

Awesome

EspMock

AUnit
Tests

Mocks for various ESP8266 functions and libraries, designed to be used under EpoxyDuino which provides the Arduino programming API on a Linux, MacOS or FreeBSD environment.

The WiFi simulation can manage many virtual devices so it is possible to write unit tests between many Esps.

This project was originally created to run AUnit unit tests for the TinyMqtt library, but it can be useful for any other project that needs mocks for ESP8266 and ESP32 libraries.

Installation

You must install the following projects:

These projects cannot be installed through the Arduino Library Manager because they are not normal Arduino libraries. It is probably most convenient to install them in the same location as other Arduino library directory. In other words, locate the ./libraries/ directory of your sketchbook directory used by the Arduino IDE, and run the following commands:

$ cd {SketchBookDirectory}/libraries
$ git clone https://github.com/bxparks/EpoxyDuino
$ git clone https://github.com/hsaturn/EspMock
$ git clone https://github.com/bxparks/AUnit

Usage

For each Arduino program, we need to create a Makefile as described in EpoxyDuino, but with a few extra parameters:

The result is a Makefile that looks like this:

APP_NAME := {NameOfSketch}
ARDUINO_LIBS := {Lib1} {Lib2} ...
ARDUINO_LIB_DIRS := {EspMockDirectory}/libraries
EPOXY_CORE := EPOXY_CORE_ESP8266
include {EpoxyDuinoDirectory}/EpoxyDuino.mk

See tests/network-tests/Makefile for a concrete example.

License

MIT License

Authors