|
882 | 882 | "",
|
883 | 883 | "pm.test(\"Response body is correct\", function() {",
|
884 | 884 | " pm.expect(jsonData).to.eql(expectedResponse);",
|
885 |
| - "});", |
886 |
| - "", |
887 |
| - "// // If the response body doesn't match the expected response for whatever reason the above test doesn't really help diagnose where the actual and expected responses differ. Therefore, if they do differ, run a set of tests that will show where the differences are", |
888 |
| - "// if(JSON.stringify(jsonData) != JSON.stringify(expectedResponse)) {", |
889 |
| - "// for (var i = 0; i < jsonData.length; i++) {", |
890 |
| - "// pm.test(\"Post \" + (i+1) + \" is correct\", function() {", |
891 |
| - "// pm.expect(jsonData[i]).to.eql(expectedResponse[i]);", |
892 |
| - "// });", |
893 |
| - "", |
894 |
| - "// if (JSON.stringify(jsonData[i]) != JSON.stringify(expectedResponse[i])) {", |
895 |
| - "// pm.test(\"Post \" + (i+1) + \" - User ID is correct\", function() {", |
896 |
| - "// pm.expect(jsonData[i].userId).to.eql(expectedResponse[i].userId);", |
897 |
| - "// });", |
898 |
| - "", |
899 |
| - "// pm.test(\"Post \" + (i+1) + \" - ID is correct\", function() {", |
900 |
| - "// pm.expect(jsonData[i].id).to.eql(expectedResponse[i].id);", |
901 |
| - "// });", |
902 |
| - "", |
903 |
| - "// pm.test(\"Post \" + (i+1) + \" - Title is correct\", function() {", |
904 |
| - "// pm.expect(jsonData[i].title).to.eql(expectedResponse[i].title);", |
905 |
| - "// });", |
906 |
| - "", |
907 |
| - "// pm.test(\"Post \" + (i+1) + \" - Body is correct\", function() {", |
908 |
| - "// pm.expect(jsonData[i].body).to.eql(expectedResponse[i].body);", |
909 |
| - "// });", |
910 |
| - "// }", |
911 |
| - "// };", |
912 |
| - "// };", |
913 |
| - "", |
914 |
| - "// pm.environment.unset(\"expectedResponse\");" |
| 885 | + "});" |
915 | 886 | ]
|
916 | 887 | }
|
917 | 888 | }
|
|
971 | 942 | "script": {
|
972 | 943 | "type": "text/javascript",
|
973 | 944 | "exec": [
|
974 |
| - "var expectedResponse = {};", |
975 |
| - "", |
976 |
| - "pm.environment.set(\"expectedResponse\", expectedResponse);" |
| 945 | + "" |
977 | 946 | ]
|
978 | 947 | }
|
979 | 948 | },
|
|
983 | 952 | "type": "text/javascript",
|
984 | 953 | "exec": [
|
985 | 954 | "var jsonData = pm.response.json();",
|
986 |
| - "var expectedResponse = pm.environment.get(\"expectedResponse\");", |
987 | 955 | "",
|
988 | 956 | "pm.test(\"Response body is correct\", function() {",
|
989 |
| - " pm.expect(jsonData).to.eql(expectedResponse);", |
| 957 | + " pm.expect(jsonData).to.eql({});", |
990 | 958 | "});"
|
991 | 959 | ]
|
992 | 960 | }
|
|
0 commit comments