Home Download Buy Blog Forum Support

Testing Plugin's

Testing Plugin's

Postby stdavis on Mon Oct 21, 2013 2:49 pm

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?
stdavis
 
Posts: 7
Joined: Tue May 01, 2012 1:09 pm

Re: Testing Plugin's

Postby guillermooo on Mon Oct 21, 2013 3:39 pm

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

https://github.com/guillermooo/Vintageous

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

https://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.)
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Testing Plugin's

Postby guillermooo on Mon Oct 21, 2013 3:50 pm

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:

https://github.com/guillermooo/Vintageo ... t__vi_e.py
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Testing Plugin's

Postby stdavis on Thu Oct 24, 2013 2:01 pm

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. :(
stdavis
 
Posts: 7
Joined: Tue May 01, 2012 1:09 pm

Re: Testing Plugin's

Postby guillermooo on Thu Oct 24, 2013 6:45 pm

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.
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 7 guests