2017-02-15 42 views
-1

我有一個使用Jmeter測試的其他API。消息「確定」的響應消息斷言失敗。其餘:響應消息爲空

以下是響應頭我看到

HTTP/1.1 200 
Set-Cookie: JSESSIONID=BE7C763B232F61E6DCECFSDEDEDB;path=/test-service;HttpOnly 
X-Application-Context: test-service:DEFAULT,dev:8098 
Link: 
X-Content-Type-Options: nosniff 
X-XSS-Protection: 1; mode=block 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate 
Pragma: no-cache 
Expires: 0 
X-Frame-Options: DENY 
Content-Type: application/json;charset=UTF-8 
Transfer-Encoding: chunked 
Date: Wed, 15 Feb 2017 09:14:30 GMT 

採樣結果

Sample Start: 2017-02-15 14:44:26 IST 
Load time: 4422 
Latency: 4418 
Size in bytes: 4368 
Headers size in bytes: 500 
Body size in bytes: 3868 
Sample Count: 1 
Error Count: 1 
Response code: 200 
Response message: 

當我通過郵遞員測試它,我得到正確的結果

enter image description here

誰能告訴我爲什麼這可能會發生?

注: 我的應用程序是一個春季啓動應用程序。

更新: 這不是隻發生在jmeter。我試圖用提前休息客戶 只拿到狀態代碼 enter image description here

回答

1

如果您迴應斷言配置像下面給出的一個,它不應該失敗。如果您正在查找整個文本「HTTP/1.1 200」,請確保在帶有「HTTP/1.1 200」文本的模式匹配規則中檢查「響應頭」單選按鈕和「包含」一起選中

enter image description here

+0

這是響應代碼斷言我正在談論響應消息斷言。 – Ganesh

+1

您的HTTP返回代碼和標題將位於響應標題下。響應消息中只有響應主體。發佈您的配置截圖 – Selva

0

這實際上不是jmeter問題。 HTTP/2未定義攜帶包含在HTTP/1.1狀態行中的版本或原因短語的方式。 https://github.com/spring-projects/spring-boot/issues/6548 這實際上是一個Tomcat 8.5的問題,因爲它開始支持HTTP/2規範。 引用Tomcat相關部分的評論「客戶應該忽略它(RFC 7230),它只是浪費字節。」