Spring TestContext framework

Spring empowers developers with a rich Spring TestContext framework, which provides a strong support for unit as well as integration testing. It supports both API-based and annotation-based test case creation. The framework strongly supports JUnit and TestNG as the testing frameworks. TestContext encapsulates the spring context in which the test cases will be executed. It can also be used to load ApplicationContext if requested. TestContextManager is the main component that manages TestContext. Event publication is done by TestContextManager, and TestExecutionListener provides the action to be taken for a published event.

The class-level @RunWith annotation instructs JUnit to invoke the class it references to run the test cases in rather than using the built-in runner. The Spring-provided SpringJUnit4ClassRunner facilitates JUnit to use the functionalities provided by the Spring Test framework using TestContextManager. The org.springframework.test.context package provides annotation-driven support of the testing. The following annotations are used to initialize the context.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.143.4