??????в?????????????????????

????? 4. ??????

?????????????????????????????????????????????????????????

???????????

????Spring test framework ???λ?? org.Springframework.test.context ???У???????????漸????

????? 5. Spring ?????????

?????? TestContextManager?????????????? TestContext ???????????????????????????????????

?????? TestContext????????????? Spring applicatoin context ???????????????? applicationContext

?????? TestExecutionListener??????????????????????applicationContext ?????????????????

?????? ContextLoader????????????ü??? Spring ?? bean ???壬????? applicationContext ???????

?????? SmartContextLoader??Spring 3.1 ????????????????????? profile ????

????Spring ??? AOP hook ?????????????????beforeClass??before??after??afterClass ?????????????????????£?

????? 6. Spring ??????????????

?????? ?????????????в??????????? Spring ??????????????? TestContextManager ???

?????? TestContextManager ???? TestContext?????????????????????????TestContext ????? ContextLoader ????? Spring ApplicationContext ???

?????? ???????????????в?????? BeforeClass??Before??After??AfterClass ?????TestContextManager ????????????????????? TestExecutionListener

???????

??????????????????????????????????Spring ????????????????£?

?????? ??????????? Junit4???????? SpringJunit4ClassRunner?????????????? TestNG

?????? ???????е???????????????????????????????????????????????????? Spring applicationContext ????????????????????????? Spring ???????ó?????????????????????

?????? Spring 3.1 ???????? profile ???????????ò???????????????????????? XML ??????????????

?????????????????????????? Spring??????? Junit ???? testNG ??????????е??????е???????????????????? Spring test framework?????????????ó??????????????μ?????