Posts

Showing posts with the label junit

On to some exciting stuff

I went to a Agile Sydney meetup recently - "Automated web tests as a team communication tool" - by John Smart of Wakaleo Consulting . It was great stuff, and the presentation is now online . There is a nice story here in that the project feature set is documented via easily readable and executable tests, and the reporting shows which features are implemented and which aren't. More information on the the Thucydides tool he references can be found at: https://github.com/thucydides-webtests/thucydides/wiki While reading that presentation online, I found more gold here in some of his other presentations: JUnit Kung Fu: Getting More Out of Your Unit Tests Introduction to Domain Driven Design They are a great read and are great pointers in the right direction to improve your software development. (If you haven't seen them before, check out Wakaleo's training courses . I haven't been on them, but based on the course content, they look to be the most relevant ...

JUnit parameterized test with Spring autowiring AND transactions

I've been writing JUnit Parameterized tests (a nice intro here - also see Theories ) to do some data driven API testing. Now, when introducing Spring into the mix there are a couple of extra things to do . I came unstuck though because I was trying to do Transactional tests - since I'm now using @RunWith(Parameterized.class) and setting up my Spring TestContextManager manually the @Transaction annotations caused an exception: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given I couldn't find any built in solution, so I've gone with manual transaction management in my test, using doInTransaction: @RunWith(Parameterized.class) @ContextConfiguration(locations = "classpath*:/testContext.xml") public class MyTest { @Autowired PlatformTransactionManager transactionManager; private TestContextManager testContextManager; public MyTest (... parameters for test) { // store parameters in instance v...