Auto run tests on save

16 views
Skip to first unread message

Indy Nagpal

unread,
May 21, 2008, 5:18:48 PM5/21/08
to mxunit
Hi

I'm giving mxunit a try -- I've been using cfunit till now.

cfunit has this very nice feature where you can configure CFEclipse to
automatically execute CFUnit-Ant builds upon saving a CFML resource
(http://cfunit.sourceforge.net/help-ant.php)

I've looked a the mxunit ant task but that is better suited for
writing output to an html file rather than console.

Basically I'm looking to find if there is a way in which I can run
tests automatically as I save the test file/s?

Thanks.

Indy

Marc Esher

unread,
May 21, 2008, 6:08:15 PM5/21/08
to mxu...@googlegroups.com
Indy, did you get bill's response from the blog comments?

Indy Nagpal

unread,
May 21, 2008, 6:15:13 PM5/21/08
to mxu...@googlegroups.com
No I haven't.

I thought I added my comments to this entry: http://mxunit.org/blog/2008/03/new-mxunit-ant-automation-video.html

But obviously not!

Would you mind posting his response here.

You guys are doing real good work. Seems to be hitting the sweet spot for me!

Thanks.
Indiver Nagpal

Email: in...@shadocms.com
Skype: indy_at_straker
MSN: in...@straker.co.nz
Tel: +64-9-3028298

Web: www.shadocms.com




Indy Nagpal

unread,
May 21, 2008, 6:19:02 PM5/21/08
to mxu...@googlegroups.com
Ah I seem them now... Must be some sort of caching.

Thanks. This is just very helpful.

For the list, I'll post them here to complete the thread.

=============

The MXUnit Ant task can just print info to the console only and not generate any files. Just omit the outputdir attribute in the task definition; e.g., <mxunittask server="localhost" ... >

As for configuring Eclipse to run your Ant build file on save, I would imagine that the same directions provided by cfunit would apply to mxunit, as that is really just calling Ant on an Eclipse save event, I think.

Personally, I do not do that because I do frequent saves and my test directories get pretty big. So, I opt to run my tests when I'm ready to commit to the repo or deploy, and not when saving changes to disk. But that's just me ...

=================

On 22/05/2008, at 10:08 AM, Marc Esher wrote:

Marc Esher

unread,
May 21, 2008, 6:24:50 PM5/21/08
to mxu...@googlegroups.com
I think you're right about the caching. I have to do hard refreshes on
the front page after i post new entries to see them.

sorry about that... i'll add a no-cache on the template if i can and
maybe that'll make these problems go away.

thanks!

marc

ken.sykora

unread,
May 22, 2008, 2:10:06 PM5/22/08
to mxunit
I think that a practice like this could get pretty nasty as your
application grows. I know around here we have thousands of lines of
code and running all the unit tests for them on each save would be
atrocious.

Interesting thought though. You should look into continuous
integration(ala Cruise Control) rather than this, so you have a
dedicated machine that's always running tests for you, and sends you
emails if tests fail. This is kind of the best of both worlds.

Indy Nagpal

unread,
May 22, 2008, 2:50:07 PM5/22/08
to mxu...@googlegroups.com
When I had this kind of feature setup for cfunit tests, you can select which resource to watch. So if your application has a million components to test, you only select to watch the one that you are currently working on. As you change it and save, it automatically runs the tests for that component. That way you are running tests for everything. I found that it worked beautifully with cfunit on a very large app.

However, the fact that I can run individual tests in Eclipse by simply double clicking them seems to have taken away the need for running tests automatically.

It would be really nice, however, to have a shortcut key in Eclipse that can run the last selected test. It would be a bonus if the shortcut would save the file AND run the last selected test... Will take considerably shorten the process... One won't have to take the hand of the keyboard, move it to mouse, select the test/s and click the run button.

Does the mxunit team think that a shortcut is a good idea? 

I tried setting one up in Eclipse but was not able to. 

Indy
Indiver Nagpal

Email: in...@shadocms.com
Skype: indy_at_straker
MSN: in...@straker.co.nz
Tel: +64-9-3028298

Web: www.shadocms.com




billy

unread,
May 22, 2008, 3:11:34 PM5/22/08
to mxunit
Good ideas, Indy. You can use the ENTER or 'r' key to run your
selected test. It won't automatically save your files though, but it
will run the selected tests. Also, click the ? - Help Icon- in the
MXUnit view and navigate to the Keyboard Shortcuts section for a few
more. But, you may be referring to being in the editor and then
hitting a shortcut key to run the tests? This 'may' be outside the
scope of MXUnit and in the realm of Eclipse or CFEclipse ... not sure.

bill[y]
> Email: i...@shadocms.com
> Skype: indy_at_straker
> MSN: i...@straker.co.nz
> Tel: +64-9-3028298
>
> Web:www.shadocms.com

Indy Nagpal

unread,
May 22, 2008, 5:12:56 PM5/22/08
to mxu...@googlegroups.com
Thanks for that Billy. I had looked at the help for keyboard shortcuts. It is great to have the possibility to hit enter to run the selected test. But clicking on the MXUnit view first requires one to use the mouse (unless there is a shortcut for that which I'm missing).

Also, I can't seem to see any keyboard settings for the MXUnit view (in Eclipse > Preferences > General > Keys). I'm not sure how Eclipse key shortcuts work, but if there is a possibility to somehow register MXUnit related shortcuts in there, it would be great.

You guys (the MXunit team) have done a great job in the current Eclipse plugin. I'm loving it. My suggestions are only from the point of view future improvements that would help make it better (and easier) for users.

Thanks again.

Indy

Indy Nagpal

unread,
May 22, 2008, 5:30:37 PM5/22/08
to mxu...@googlegroups.com
I've just been looking at how Eclipse shortcuts.

The key would be that when the MXUnit Eclipse plugin is installed, it somehow registers MXUnit View specific actions with Eclipse. That way they become available in Eclipse > Preferences > General > Keys section.

The users can then assign their own keys.

Is there a Issue Tracker for MXUnit where I can register this?


On 23/05/2008, at 7:11 AM, billy wrote:

Indy Nagpal

unread,
May 22, 2008, 5:50:36 PM5/22/08
to mxu...@googlegroups.com
I got a bee in my bonnet now...

So I started checking on how to register keys when generating your own views and plugins in Eclipse. This is what that might need to be done to register a key for MXUnit view: http://wiki.eclipse.org/Platform_Command_Framework

The section on KeyBindings seems relevant.

I might be preaching to the already converted! But I hope that helps.

Indy

On 23/05/2008, at 7:11 AM, billy wrote:

Marc Esher

unread,
May 24, 2008, 9:02:34 AM5/24/08
to mxu...@googlegroups.com
Thanks Indy. Someday (no promises when), I'll get the plugin
completely converted over to the command framework. Please feel free
to add it as an issue here:
http://code.google.com/p/mxunit/issues/list

best,

marc

Mike Rankin

unread,
May 28, 2008, 12:13:49 PM5/28/08
to mxunit
Indy, you might want to post this over on the cfeclipse group, too.
I've wanted to change that toolbar for years, but you have to do your
own build and I just doesn't bug me enough to go to the trouble. But
if there were an interface...

Cheers,
Mike.
Reply all
Reply to author
Forward
0 new messages