TL;DR: I am looking for a testing setup or suggestions for testing my plugins.
with many APIs still being quite unstable and new releases bringing breaking changes (don't get me wrong, this is not a complaint, what the Sketch team does to bring the product and even more the plugin environment forward is awesome, and breaking changes are unavoidable in this process), I would like to shift my attempts on building plugins to be more TDD.
Now I don't really know how to get started on this. Does anyone write tests or has any experience testing their plugin code in any way? I didn't find anything digging through several plugins on github
What I would like to test e.g.:
- interactions with the Sketch interface (opening windows, panels, etc)
- running specific plugin commands/handlers
- manipulating Sketch layers, symbols, etc. and then test the plugin in these different scenarios
Basically I just want to be able to run
yarn test after a Sketch update (or after I did changes to my plugin) to make sure everything still works as expected.
For all that I would either need a Mock of the whole Sketch environment (which I don’t think exists or even makes much sense to exist), or a way to programmatically run Sketch in the background and initiate an environment, in which I can interact and test the results.
Any kind help or suggestion would be highly appreciated
PS: I just want to test my cocoascript code ... I do have ObjC frameworks, but I load these into the cocoa environment anyway, so I could test them there (in case that makes anything easier for some reason )