0
我有一個JSON文件,它看起來像下面使用裏面的Json饋線,在加特林
{
"OrderRef": "Rand12345"
"siteContactName": "ABC",
"siteContactNumber": "12345678",
"contactMobileNumber": "12345678",
"estimatedDeliveryDate": "2016-03-08",
"orderLines": [
{
"productCode": "846581",
"productName": "ABC",
"quantity": 112,
"price": 5.01,
"vatAmount": 112.22
},
{
"productCode": "938169",
"productName": "DEF",
"quantity": 6,
"price": 45.03,
"vatAmount": 54.04
}
]
"orderNett": 831.30,
"orderVatAmount": 166.26,
"orderTotal": 997.56
}
我要送這個JSON作爲一個機構,一個POST請求,在這裏我必須參數化OrderRef,產品代碼和其各自的產品名稱。
所以我創建了2個文件,即orderref.csv和product.csv,其中orderref.csv有一個order ID列表,product.csv有一個產品代碼列表及其各自的名稱。當我嘗試這樣做,
class Order extends Simulation {
val orderref = csv("orderref.csv").random
val product = csv("product.csv").random
val scn = scenario("OrderCreation")
.feed(orderref)
.feed(product)
.exec(http("OrderCreation")
.post("/abc/orders")
.body("""
{
"OrderRef": "${orderref}"
"siteContactName": "ABC",
"siteContactNumber": "12345678",
"contactMobileNumber": "12345678",
"estimatedDeliveryDate": "2016-03-08",
"orderLines": [
{
// ProductCode and ProductName are the headers of the columns in my product.csv
"productCode": "${ProductCode}",
"productName": "${ProductName}",
"quantity": 112,
"price": 5.01,
"vatAmount": 112.22
},
{
"productCode": "${ProductCode}",
"productName": "${ProductName}",
"quantity": 6,
"price": 45.03,
"vatAmount": 54.04
}
]
"orderNett": 831.30,
"orderVatAmount": 166.26,
"orderTotal": 997.56
}""").asJson)
setUp(scn.inject(atOnceUsers(1)))
}
我得到
not found: value ProductCode
not found: value ProductName
但orderref被接受。任何建議請。
謝謝
謝謝:)解決了我的問題 –
要把工作交給chiromancy –
@GoldMeen我有類似的程序,但它給了我下面的錯誤'igcZincCompiler $ -/Users/Sunil/gatling-charts- highcharts-bundle-2.2.5/user-files/simulations/VertexPerformance.scala:28:type mismatch; found:String(「' – Sunil