Useful if you don't have actual devices and want to get a script up and running, or if you want/need the security of having your event scripts covered by tests.
Code: Select all
require 'domotest'
require 'busted.runner'()
describe('Bathroom motion sensor', function()
describe('detects motion at night', function()
it('turns on the light', function()
commandArray = domotest('script_device_bathroommotion.lua', {
devicechanged = { ['Bathroom Motion'] = 'On' },
timeofday = { ['Nighttime'] = true }
})
assert.are.same({
['Bathroom Lights'] = 'On'
}, commandArray)
end)
end)
end)
Code: Select all
luarocks install domotest
There's a bit more info on the blog post here: http://stevewilford.co.uk/2016/10/domotest-launch/
And even more info, and examples, in the git repo: https://github.com/NxSoftware/domotest
Hope this is of use to someone...