Spring MVC Controller???????
???????????? ???????[ 2014/11/19 16:36:44 ] ??????????????? ??????? ???y?
????????????????????????????????????????
????????????????????????web context ???????л?????????module ????DAO??Service??????????applicationContext?????????src/main/resource?????
?????????????????????service?????????????????????Controller????????????????service??DAO??????Service??DAO??applicationContext??????
????Controller ???????
????????????а??????????????????????????????????????????????ContextConfiguration????á?
????@RunWith(SpringJUnit4ClassRunner.class)
????@WebAppConfiguration //?????src/main/webapp
????@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml")
????????????@ContextConfiguration???????servlet-context.xml?????????л?????????????applicationContext??????????????????????????Service??null???
????????
????@ContextConfiguration({
????"file:src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml"??
????“classpath*: springxml/**.xml”
????})
??????????????????????????????Controller?????????????????????????????????ο?showcase?е??????
package pairwinter.spring.mvc.controller.test;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.samples.mvc.AbstractContextControllerTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration({
"file:src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml"??
“classpath*: springxml/**.xml”
})
public class ControllerTests{
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
@Before
public void setup() throws Exception {
this.mockMvc = webAppContextSetup(this.wac).build();
}
@Test
public void controllerExceptionHandler() throws Exception {
this.mockMvc.perform(get("/test"))
.andExpect(status().isOk());
}
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
iOS???????mocha??chai??sinon??istanbul???????????????????????????????????????д?????Java????????7??????Android?????????Robolectric3.0????(?)???Kiwi?????????????????????????????????Python?????????????????????????????????????Controller????????д?????????10???????????????????Angular????????????Component??Directive??Pipe ???ServiceAndroid????????????????????????????????--Mockito??????iOS UnitTest???????Vue?????????????????
???·???
??????????????????
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 ??????