title: Spring and testing with TestContextFramework
body: <p>I wanted to write few unit tests for my application that uses Spring MVC. I read the manual page at the Spring home page:<code>http://static.springsource.org/spring/docs/current/spring-framework-reference/html/testing.html</code> and it seems that this Spring testing framework could be really useful. </p>
  
  <p>But here are the questions:</p>
  
  <p>1.If I understand it right, to use any of the annotations for testing like <code>@ContextConfiguration</code> I need to use <code>@RunWith(SpringJUnit4ClassRunner.class)</code>? But is it possible to use two runners (probably not), I just wondered if one can use Spring runner and mockito one, because I am using mockito to mock normal objects.</p>
  
  <p>2.I have a question about loading xml context files with <code>@ContextConfiguration</code>. I have my .xml files in <code>src/main/webapp/WEB-INF/spring</code>, how can I load them using <code>ContextConfiguration</code>? I tried </p>
  
  <pre><code>@ContextConfiguration(locations="/webapp/WEB-INF/spring/root-context.xml")
  @ContextConfiguration(locations="webapp/WEB-INF/spring/root-context.xml")
  @ContextConfiguration(locations="/WEB-INF/spring/root-context.xml")
  @ContextConfiguration(locations="WEB-INF/spring/root-context.xml")
  @ContextConfiguration(locations="/src/main/webapp/WEB-INF/spring/root-context.xml")
  @ContextConfiguration(locations="src/main/webapp/WEB-INF/spring/root-context.xml")
  </code></pre>
  
  <p>but I always get <code>class path resource [some_path] cannot be opened because it does not exist</code>.I am wondering then what path should I use?</p>
  
  <p>EDIT:
    the second problem was that WEB-INF is not in the classpath, here is the topic that helped me <a href="https://stackoverflow.com/questions/10385452/location-of-spring-context-xml">Location of spring-context.xml</a></p>