MXUnit Eclipse Plugin Test History Feature

Thursday, September 4, 2008

I'm happy to announce the latest feature to the MXUnit Eclipse plugin: Test History. Every time you run a test (or directory of tests), it adds that test to your history. When you want to revisit a test, you can open up the history menu, find your test, and reload it. Here's a screen shot to demonstrate: There are a few differences between the JUnit and MXUnit implementations of this functionality, born out of my own frustration with the JUnit plugin. I decided that if I were going to add test history, then I was going to make it work how I always wished the JUnit plugin would behave.
  1. No duplicate entries. "" will only ever appear once in the list, and will only reflect the last run. If you run that test 20 times, you won't get 20 entries in the list
  2. When running a directory of tests, you see the full path to the directory in the list
  3. It's easy to distinguish between single TestCase runs and Directory runs. Simply, directory runs start with a slash.
  4. A more reasonable start value for remembered test runs. JUnit defaults to 10 items in the history. Dunno why. MXUnit defaults to 30. Considering that duplicates never appear, this seems like a reasonable default. In addition, changing the default is simple and obvious.
There's one thing to note, and I'm still not sure how I feel about this because I haven't worked with it enough to form an opinion yet: Tests retain their relative position in the test history no matter how many times they are run. Let me explain: You run Test1.cfc at 7:12:00 AM. This test gets position 1. You run Test2.cfc at 7:12:15 AM. This test gets position 1. Test1 is bumped to position 2 (i.e. it is lower in the list of tests in the menu). You run /mytests/ at 7:13:30 AM. This test gets position 1. Test2 is bumped to position 2, and Test1 is bumped to position 3. So far, this is how you'd expect it to work. Here's where it changes: You then select Test1.cfc from the test history and re-run that test. Now, since this last run makes it "newer", in a sense, you might expect it to show up at the top of the list. However, I am currently opting to keep that test in its original position. This might seem weird, but I'll ask you to reserve judgment until you've had a chance to work with it a bit. As always, feedback is welcome. Happy testing!


Bob Silverberg said...

I really like this new feature, and didn't notice the weirdness with the sequence of tests. I actually updated the plugin via the update site a few days ago, noticed the history option, and started using it immediately.

Thanks again for a most excellent plugin!

Marc Esher said...

Bob, cool, glad it's working for you! One thing: the version from the update site a few days ago does not have the functionality for changing the preference for max history entries. To get that, you'll need to update, Everything else is the same though.

Jim Priest said...

Very slick! We are slowly getting into MXUnit here so hopefully I'll get to tinker with this soon!