Posted by Ilja Preuss:
The problem is speed - those tests tend to be quite slow. Especially if you do test driven development, where you want to run the tests every couple of minutes, it makes a big difference wether the suite takes a couple of seconds or a couple of minutes.
Posted by Ilja Preuss:
There is no roadmap, and I don't think you will see much changes on core JUnit at all in the future. It's meant to be small and lightweight, it is doing what it should do, it's robust - what changes does it need?
I believe the common way of doing this is to put the setup stuff into an abstract super class TestCase which all the concrete TestCases inherit. The AOP approach could be a bit cleaner, though.
Ok, then what would your aspect do when encountering a unit test? Replace real database connections with mocked up database connections? Otherwise a good idea, but the behavior of the mocked up database connection object is not something you can specify with a global aspect -- it's something that varies per test.
I am not sure that this would do much good. If the developers are dull, they will simply test less or find a workaround for the limitation. If they are not, they will feel patronized.
Yeah, I've heard about such a trend... If 70% writes system tests, approximately 20% writes poor unit tests, and 10% writes good unit tests.