Mycroft Community Forum

Testing against variable keywords

Greetings. I’m a pretty new skill-writer making a skill to support the Hubitat Zigbee/ZWave hub. See github/burnsfisher/hubitat-integration-skill.

I make no great claims about it, but it seems to work. But I’d like to add some tests. I was able to add a test for “device not found” and that worked fine. Now I’d like to add one for “turn on” or “turn off”. The problem is that the devices are loaded into the skill from the hubitat at run time. I can (and did) test turning on a device that I know exists, but that only works on my own system.

Any pointers on making tests that depend on variable names like “bookcase lights” or “west wall outlet”? I suppose I could add a fake device that the test would use; in fact that could more easily test errors and other conditions. But the more code written specially for the test, the less valid the test is IMO.

Comments?

Well, no advice from the community, so what I did was add some “fake” devices that are always there regardless of what is in the actual Hubitat. The fake devices have different characteristics like ability to be turned on or not, ability to set their level or not, etc so I can test for success or failure with different types of devices. These tests should work without an actual hubitat present.

I’d still like any comments.

BTW, I found out about the common IOT framework after I had written a lot of this. I’ll see about using it at some point.