Sublime Forum

Testing Plugin's

#1

Has anyone come up with a viable and reliable way to test their plugins? The only solutions that I’ve found seem to be hacks. There’s got to be some way to run unittests from within the sublime environment so that you have access to the sublime package. Or do most plugin devs just not test their code?

0 Likes

#2

While I wouldn’t say it isn’t a hack, Vintageous includes tests:

github.com/guillermooo/Vintageous

I’ve abstracted out the testing helpers into their own package:

github.com/guillermooo/AAAPT

It should work, but Vintageous still uses the older testing helpers, which are included with Vintageous’ code, though I hope to use AAAPT exclusively at some point.

Note that you have to start ST in order to run the tests.

An idea would be to run the tests passing a -command parameter to sublime_text, but I didn’t have too much luck last time I tried.

(Also, AAAPT has a funny name because there should be some guarantee that it will be loaded before other packages call it.)

0 Likes

#3

I should also point out that the tests in Vintageous are written in different styles, but this is the most concise I could make them:

github.com/guillermooo/Vintageo … t__vi_e.py

0 Likes

#4

guillermooo - Thanks for the code! So to run tests you have to publish as a sublime-package and then reopen sublime? Doesn’t sound very TDD friendly. :frowning:

0 Likes

#5

Yeah, I guess the point here is that you can write tests for ST plugins relatively easily.

For me, publishing and restarting ST takes the press of a key, anyway.

0 Likes