Skip to content

Unit testing framework for Hubitat scripts

License

Notifications You must be signed in to change notification settings

biocomp/hubitat_ci

Repository files navigation

Hubitat CI

Build Status

This library allows testing of Hubitat scripts locally on your machine (and via Continuous Integration, thus Hubitat CI).

It automatically validates correctness of some script aspects (such as pages/inputs/metadata/preferences/capabilities), and enables user to validate the rest.

It uses GroovyShell to load the scripts, makes objects out of them and lets user test them.

Features

Have basics validated automatically for you

By default, the library will initialize script object, and perform its validation.

These validations can catch errors like these:

Debug your script

With proper IDE (I'm using IntellijIDEA), you can step through your tests and your script, view variables and have rich debugging experience in general.

Image of debug session

Run your tests in the cloud after (or before) every push

Just something obvious, really. If you can run it on your machine, you can also run it in the cloud.

This library, and hubitat_ci_example, for example, have automatic builds set up in Azure Devops (former VSTS). Here's a build script file: azure-pipelines.yml.

Documentation