title: Integration Tests in grails: getting null in query string parameter
body: <p>I'm doing integration tests  for controllers in grails.I need to pass query string in test case and I'm passing it as <code>controller.request.queryString</code> for the same.</p>
  
  <p>My tests is getting failed. It's giving me <code>null value</code> for the query String parameter.</p>
  
  <p>Controller - UserExController</p>
  
  <p>Foll is the action on which i'm doing integration testing.In this I'm reading query string parameter 'uid' and getting the userInstance using GORM method</p>
  
  <pre><code>def getUser() {
      //reading the query string parameter 'uid'
      def userId = request.getParameter("uid")  
      User user = User.findByUsername(userId)
      render view:'edit', model:[userInstance:user]
  }
  </code></pre>
  
  <p>This is the test for the above written action .In this I'm passing the query string parameter and calling the action</p>
  
  <pre><code>class UserInstanceTests extends GroovyTestCase {
  
      @Test
      void testPerfSummaryApi() {
          def userExController=new UserExController()
          userExController.request.queryString='uid=rp123'
          userExController.getUser()
          def model = userExController.modelAndView.model.userInstance
          assertNotNull model
      }
  }
  </code></pre>
  
  <p>I'm getting <code>groovy.lang.MissingMethod.Exception</code> in the foll call:</p>
  
  <pre><code>User.findByUsername(userId) //userId is comming null
  </code></pre>