Reputation: 13501
Is it possible to use MockMvc
test code to hit a real instance of a web application?
I really like the MockMvc
syntax and after going to the efforts of writing a load of code to test controllers, it seems like a duplication of effort to rewrite what would effectively be the same tests using a different API just so I can make an actual HTTP request.
I've got some situations where my MockMvc
tests pass, but then the tested behaviour fails when deployed to a web container. This is normally a configuration or environmental issue, and it'd be nice to be able to repeat the same tests to flush those out.
Upvotes: 1
Views: 870
Reputation: 1811
MockMvc is about testing the Controller Layer and it works like a charm .
I think you need Selenium tests to test against a real, deployed application.
Using webdriver (With phantomjs) guarantees that you have the same ease of use as you get with Spring MVC.
But you will have to rewrite your tests to work with webdriver+phantomjs.
Upvotes: 1