Category Archives: Test Driven Development

How to run a JUnit test multiple times

I had a Spring-enabled JUnit test that I needed to run multiple times. I thought there used to be a JUnit annotation, but I couldn’t find it. I found and used the Spring @Repeat annotation. I used to set breakpoints … Continue reading

Posted in JUnit, Spring, Test Driven Development, Unit Tests | Tagged , , , , , | Leave a comment

Cucumber Spring Integration

I have a normal Spring-enabled project arranged as a Maven project. There were already JUnit tests in the project, along with the requisite Spring configuration. I needed to add Cucumber tests to the project. I started by adding a cucumber … Continue reading

Posted in Cucumber, Integration Tests, Java, JUnit, Spring, TDD, Test Driven Development, Unit Tests | Tagged , , , , , , , , , | Leave a comment

Expected exceptions in Junit

I had seen annotating a test class with @Test(expected = Exception.class) to test for exceptions before. In this case, we needed to test for Exception and the message was made the difference. This can be accomplished by @Rule

Posted in Integration Tests, Java, JUnit, Test Driven Development | Tagged , , , , , , , , , , | Leave a comment