Spring Unit/Intergration Testing setup?

This blogpost of mine describes the basic steps to achieve your goal.

This blogpost of mine describes the basic steps to achieve your goal. Note that the unit tests shouldn't know that you have a webapp-root - they are usually run without any servlet container started. So place the alternative config files in the test packages and try.

For unit testing you should not be using the Spring application context. You should be testing all your spring beans and controllers individually as they are the individual units within the system. As they are POJOs it is easy to wire everything together programatically in your test case code.

The also solves issues such as the location of the logging properties file as you can programatically specify a different path that does not rely on the webroot property. The testing chapter in the Spring Reference provides a good overview of how to approach unit and integration testing of applications that use Spring. It also provides details of the various support classes that Spring provides to help with writing unit and integration tests.

If you don't have an application context for your unit tests, then you can't use spring injection various beans into your test fixtures. Wouldn't you then be missed an important aspect of testing? Or should you do both?

– HDave May 18 '10 at 15:48 I would say a test where you don't use an application context is a unit test as your are only testing that individual unit so it doesn't matter that the beans are being programatically injected. If you use an application context I would say that is more like an integration test given you are explicitly testing how everything fits together. – Mark May 18 '10 at 21:57.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions