1

我正在测试我的网络应用程序

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyApp.class)
//@WebAppConfiguration
@WebIntegrationTest
public class MyTest {

   private MockMvc mockMvc;

   @Autowired
   private WebApplicationContext webApplicationContext;

}

@Before
public void setup() throws Exception {
   this.mockMvc = webAppContextSetup(webApplicationContext)
       .apply(springSecurity())
       .build();
}

@Test
public void someTest() throws Exception {
 result = mockMvc.perform(get("/user/"));

      result
         .andExpect(status().isOk())
         .andExpect(content().contentType(contentType))
    ...
}

是否可以观察使用 Filler 进行测试的方式?或者它没有网络发送?是否可以强制MockMvc使用网络?

目前我在 Fiddler 中什么也看不到。

的设置

  System.getProperties().put("http.proxyHost", "127.0.0.1");
  System.getProperties().put("http.proxyPort", "8888");

没有帮助。

4

0 回答 0