m-mcgowan / spark-unit-test Goto Github PK
View Code? Open in Web Editor NEWRunning tests on the spark core.
License: MIT License
Running tests on the spark core.
License: MIT License
To allow tests to be flashed locally in an automated environment, an "enter DFU" command is required. This will reset the core and restart it in DFU mode automatically when this Spark function is called:
cmd("enterDFU")
To allow external devices to monitor the progress of the tests (e.g. a ci server), the test progress and test results should be posted to the cloud.
skipped
, passed
, failed
and count
variables that reports these values.state
variable, with values
At present, test output is available only via the Serial port.
The LED in the spark could be used to give an indication of the test result so far:
The LED should flash while tests are being executed, and then shift to a solid color when all tests have been executed.
Hi,
I am developing on Windows 10, in Particle Dev. I have added unit-test.h to my project folder, included the header in my .ino file, and tried compling the project. However, I am running into a lot of errors, including system.bootloader() not recognized. Am I missing a step?
Thank you
The spark unit test library supports selecting which tests are to be run and which are skipped.
This functionality can be made dynamic by exposing this as functions in the cloud. This will allow the build server to select which tests should be run.
This builds on the cmd
function from #3 and adds these arguments:
The include/exclude feature is described in the arduino-unit documentation.
At present the test report is human-readable text. Some additional markup would make this easier to parse on a machine.
Consider using json or some other structured markup.
A function can be used to specify which output format is used. This is then used to set a flag in the Test class so that output is adjusted accordingly.
Hello :)
It would be awesome to have a repository with very basic things, like Hello World, pressing buttons and etc to get a grip of how Unit Tests works for Spark.
If you can create a simple example, I could help writing more.
As a quick fix to get the tests working, I combined everything into a single header.
It's now time to undo that by starting with the original repo and then reapplying my changes.
Local executors can get the test report via the Serial interface.
Remote test executors don't have this option. At present there is no easy way to pass a large amount of data via the cloud. Here are the options:
Spark.publish()
: maximum event size is 64 bytes and maximum of 1 per second, 4 in a burst.I'll implement using a variable and a function to advance the start point. Interaction like this:
Although a little hacky, this allows relatively small streams (<1MB) to be pushed through the cloud relatively quickly.
At present, there's boilerplate code required to test up a test application:
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available()) {
char c = Serial.read();
if (c=='t') {
static bool run = false;
if (!run) {
Serial.println("Running tests");
run = true;
}
}
}
if (run) {
Test::run();
}
}
It would be more convenient to code these as macros so that users can get typical test setup and loop behaviour without copying and pasting code.
e.g.
UNIT_TEST_APP();
This would delegate to unit_test_setup()
and unit_test_loop()
. Advanced test cases are free skip the UNIT_TEST_APP
macro and instead call these functions directly from setup
and loop
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.