title: Load testing basic authentication with parameters with Gatling - Scala
body: <p>I have a problem when trying to use the basicAuth method with parameter retrived from a csv files.</p>
  
  <p>Here is my code: </p>
  
  <p>class spiSimulation extends Simulation {</p>
  
  <pre><code>val httpProtocol = http
      .baseURL("http://spi.test.com")
      .inferHtmlResources()
  
  val headers_0 = Map(
      "Accept" -&gt; "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "Cache-Control" -&gt; "no-cache",
      "Pragma" -&gt; "no-cache",
      "Proxy-Connection" -&gt; "keep-alive")
  
  val users = csv("users.csv")
  
  val scn = scenario("LosspiSimulation_request")
  .feed(users)
      .exec(
          http("request")
              .get("/SPI/Basic").headers(headers_0)
              .basicAuth("${login}", "${password}")
              .headers(headers_0).check(
              header("Set-Cookie").saveAs("Cookie")))
      .exec(
          http("validate")
              .get("/SPI-back/Validation?cookie=${Cookie}")
              .headers(headers_0))
  
  setUp(scn.inject(rampUsers(10) over (2 seconds))).protocols(httpProtocol)
  </code></pre>
  
  <p>}</p>
  
  <p>When I use only one user and hard code my login and password it works. But with param login and password, I have two errors when running the Gatling script, one is "No attribute named Cookie" is defined and "No attribute named login is defined". </p>
  
  <p>Here is a sample of my csv file: </p>
  
  <pre><code>login, password
  
  test01, password01
  
  test02, password02
  </code></pre>
  
  <p>I would be pleased if you can find a solution.</p>
  
  <p>Thank you very much for your help!  </p>