-
Httpステータスコードの確認
tests["レスポンスコードが200であること"] = responseCode.code === 200;
-
レスポンスデータをJSONにパースする
var jsonData = JSON.parse(responseBody);
-
コンソールログ出力
console.log("ログコメント");
-
Postman環境変数に格納する
postman.setEnvironmentVariable("user_id", jsonData.userid);
-
レスポンスを丸ごと比較
pm.test("レスポンス確認", function () { pm.expect(jsonData).to.eql( { "code": "ERROR", "message": "パラメータが不正です。", "message_detail": "user_idが未設定です。" } ); });
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme