2017-07-31 132 views
1

我試圖運行加特林測試它登錄並檢查和存儲cookie的值。(斯卡拉)加特林headerRegex拋出隱含值異常

下面的代碼片段,我有:

.pause(minWait, maxWait) 
      .feed(usernames) 
      .exec(
       http("_pLoginForm_Basic") 
        .post("${postUrl}") 
        .headers(headers_0) 
        .formParam("username", "${username}") 
        .formParam("password", "test123") 
        .check(status.is(200), 
         headerRegex("Set-Cookie", "viafoura_session_id") 
          .ofType[(String, String)] 
          .saveAs("vf_sess_id") 
        ) 
      ); 

登錄名和狀態檢查部分工作正常,但headerRegex總是給我執行過程中出現以下錯誤:

07:55:03.140 [main][ERROR][ZincCompiler.scala:141] i.g.c.ZincCompiler$ - /home/crengga/projects/vi-vinl/vinl-gatling/src/test/scala/nl/vi/gatling/simulation/OpenSessionsInitializer.scala:63: could not find implicit value for parameter extractorFactory: io.gatling.http.check.header.HttpHeaderRegexExtractorFactory 

上午我在加特林(scala)課上缺少一些進口產品?

我一直在尋找有關錯誤在互聯網上,但到目前爲止,我能找到的是一般的Scala柱(未加特林具體的),和我的斯卡拉的知識是有限的。

+0

嘿,你可以請嘗試刪除_.ofType [(字符串,字符串)] _從代碼和檢查錯誤是否仍然出現? – Eugene

+0

是錯誤仍然出現 – sirhc

回答

1

錯誤是原來是進口類的錯誤的方式。因爲我依靠的IntelliJ的汽車進口,並沒有導入所有必需的類。

以前是這樣的:

import io.gatling.http.Predef.{currentLocationRegex, headerRegex, http, regex, responseTimeInMillis, status} 

,我把它改成

import io.gatling.http.Predef._