Add testing to a WebThing (programmed in JavaScript)

(Christian Paul) #1

I’ve released some smaller WebThings.

After I had initially started with the Node.js express server, I switched to the NPM package webthing after reading this great article.

There are many more ideas for new Things I wish to program. However, the process needs to become scalable. My biggest time sink is testing. That is why I wish to automate it.

I am looking for both unit tests of my functions that gather the values for properties, as well as some black-box tests which ensure that the Thing can be instantiated and does not fail right away (e.g. read and change some property values). For this I am most likely going to use Jest.

Are there already examples or even a framework for testing a (self-written) WebThing?
I think this would make an awesome blog article and improve the quality of existing and new WebThings.

(James Hobin) #2

The code we use to test all of our webthing libraries is here: The webthing-node repo should contain automated tests built on this if I remember correctly. Hope it helps!

(Christian Paul) #3

I started my own, experimental JavaScript library for testing Web Things via HTTP.