I seem to be talking about eclipse alot these days, sorry about this - I'm sure I'll talk about something else soon :)
After a huge test driven hacking day yesterday I found this feature invaluable. It really helped boost my write a test, make it run & fail then make it pass cycle.
Nothing earth shattering really and I'm sure this kind of thing is available in other IDEs as well but I found it so useful I thought I'd mention it.
When you write a new JUnit test, you know thanks to the incremental compilation, task list & warning markers in the code editor when the test has been compiled. So you just keep editing until the errors go away, then you're done.
Then to run the JUnit test select the Run menu -> Run As.. -> JUnit. Then you're taken to a JUnit view. All the test cases in the suite run then you get a nice list of all the failures or hierarchy of all the tests.
Clicking on each test shows the log for that test and any failure exception trace. Clicking anywhere in the log (say at some exception stack trace produced by some log4j code) or in the failure stack trace takes you right to the code.
So you end up in this tight, quick development loop.
- write a new test
- when the errors in the task list are empty, Run As JUnit
- click on the line that failed
- fix the test until there are no more compile errors
- hit the rerun last test button
- every now and then kick off a full Maven build to run all the JUnit tests outside of the IDE in the background as a double-check
Thats it. I found using a combination of Eclipses refactoring tools, the incremental compilation & error task list and the Run As JUnit I was super productive. I don't think I've ever felt quite so productive.
7:32:38 AM
|