Spring TestContext???????
???????????? ???????[ 2016/7/1 14:09:00 ] ??????????????? ??????? ???ù???
????
????С??
?????????????? Spring ?????н??е?????????????????????????
??????????? Junit4 ????????????? @Test ?????????????????????壬??Щ???????
?????????? @RunWith(SpringJUnit4ClassRunner.class) ????? Spring ???????????
?????????? @ContextConfiguration ?????????? Spring ??????????????????λ??
?????????? @Transactional ??????????????????
??????????? @Autowired ?????? Spring ?? bean ????????
???????????????????
??????????? Spring ?????????
???????????????????α??
?????????? application context ????? bean ???
????-------------?????-------------
??????????????java?????TestContext??????
????1.????spring-test.jar????????????????????baidu?????
????2.???????????extends AbstractTransactionalJUnit4SpringContextTests?????
????3.??μ???????????TestContext??????web project???
????java project?????java?????????????
????@RunWith(SpringJUnit4ClassRunner.class)
????@ContextConfiguration(locations="/applicationContext.xml")
????@TransactionConfiguration(transactionManager="txManager")
????@Transactional
????public class UserServiceTest extends AbstractTransactionalJUnit4SpringContextTests {
????@Rollback(false)
????@Test
????public void test() {
????ApplicationContext ct = new ClassPathXmlApplicationContext("applicationContext.xml");
????UserService us =(UserService)ct.getBean("userService");
????us.saveUserAndLog();
????}
????С??
?????????????? Spring ?????н??е?????????????????????????
??????????? Junit4 ????????????? @Test ?????????????????????壬??Щ???????
?????????? @RunWith(SpringJUnit4ClassRunner.class) ????? Spring ???????????
?????????? @ContextConfiguration ?????????? Spring ??????????????????λ??
?????????? @Transactional ??????????????????
??????????? @Autowired ?????? Spring ?? bean ????????
???????????????????
??????????? Spring ?????????
???????????????????α??
?????????? application context ????? bean ???
????-------------?????-------------
??????????????java?????TestContext??????
????1.????spring-test.jar????????????????????baidu?????
????2.???????????extends AbstractTransactionalJUnit4SpringContextTests?????
????3.??μ???????????TestContext??????web project???
????java project?????java?????????????
????@RunWith(SpringJUnit4ClassRunner.class)
????@ContextConfiguration(locations="/applicationContext.xml")
????@TransactionConfiguration(transactionManager="txManager")
????@Transactional
????public class UserServiceTest extends AbstractTransactionalJUnit4SpringContextTests {
????@Rollback(false)
????@Test
????public void test() {
????ApplicationContext ct = new ClassPathXmlApplicationContext("applicationContext.xml");
????UserService us =(UserService)ct.getBean("userService");
????us.saveUserAndLog();
????}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??γ????????????????????????????????????漰??Щ???????????????????????????????????????????????????????????????е???????????????????????????????????????Щ??????????????????????Ч?????????????????????????????????????α?????????????????????????????????????????????????????????????????????????????????????????????????????????????????γ?????????????????????????????ζ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????