title: Good strategy for Spring Framework end-to-end testing
body: <p>So this is a rather "big" question, but what I'm trying to accomplish is the following:</p>
  
  <p>I have a Spring application, MVC, JDBC (MySQL) and JSP running on tomcat.</p>
  
  <p>My objective is to test the entire "stack" using a proper method.</p>
  
  <p>What I have so far is Junit using Selenium to simulate an actual user interacting with the application (requires a dummy account for that), and performing different validations such as, see if element is present in the page, see if the database has a specific value or if a value matches the database.</p>
  
  <p>1st concern is that this is actually using the database so it's hard to test certain scenarios. I would really like to be able to mock the database. Have it emulate specific account configs, data states etc</p>
  
  <p>2nd concern is that given the fact that I use what is in the database, and data is continuously changing, it is hard to predict behavior, and therefore properly asserting</p>
  
  <p>I looked at Spring Test but it allows for testing outside a servlet container, so no JSP and no Javascript testing possible.</p>
  
  <p>I saw DBUtils documentation but not sure if it will help me in this case</p>
  
  <p>So, to my fellow developers, I would like to ask for tips to:</p>
  
  <ul>
  <li>Run selenium tests on top of a mocked database</li>
  <li>Allow different configs per test</li>
  <li>Keep compatibility with Maven/Gradle</li>
  </ul>