We have heard a lot about Benefits of Spring like it offers loose coupling, dependency injection, inversion of control etc
but from testing
point of view, I have couple of question.
Please provide some useful examples as then it would be much more easier to understand explanation. I am new to Spring as such and want to understand precise benefits offered by Spring Framework
from Application Developer point of view ?
It ensures performance and quality of the product. The Java platform supports many testing frameworks. Spring introduces the principle of dependency injection on unit testing and has first-class support for integration testing.
Unit testing with Spring FrameworkIf you follow the standard Spring Framework architecture, the dependency injection and use of Mock Objects can make Unit testing super convenient for you. Testing individual code and modules, i.e., isolation tests, is easy to execute using Mock Objects.
An application geared towards dependency injection is typically more testable because resources are easily replaced with test-oriented resources. Consider a service object that uses a data access object; in production, you'd inject a DAO that talked to a backend data store. But for each test you could create a DAO that returned specific, known data; this allows you to focus on the object being tested.
Spring is one of many dependency injection frameworks for Java, albeit the most popular; any DI framework is going to give you this kind of benefit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With