Merge CTK & RI postman collection#130
Conversation
|
What exactly changed? As far as I can see it contains exactly the same tests as before. The file has simply been formatted. |
| "body": { | ||
| "mode": "raw", | ||
| "raw": "[\n {\n \"metadata\": {\n \"eventID\": \"41533e39-df30-45c8-8035-127c92f93f8f\",\n \"eventCreatedDateTime\": \"2003-05-01T00:00:00Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2003-05-03T00:00:00Z\",\n \"eventClassifierCode\": \"EST\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_02\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"ABC123123123\"\n }\n ],\n \"transportEventTypeCode\": \"DEPA\",\n \"delayReasonCode\": \"ANA\",\n \"changeRemark\": \"Authorities not available\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_02-B\",\n \"carrierServiceCode\": \"TNT1\",\n \"universalServiceReference\": \"SR00033F\",\n \"carrierExportVoyageNumber\": \"TNT1E\",\n \"carrierImportVoyageNumber\": \"TNT1E\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"VESSEL\",\n \"location\": {\n \"UNLocationCode\": \"USNYC\",\n \"locationName\": \"Eiffel Tower\",\n \"latitude\": \"48.8585500\",\n \"longitude\": \"2.294492036\"\n },\n \"facilityTypeCode\": \"POTE\",\n \"vessel\": {\n \"vesselIMONumber\": \"9321483\",\n \"name\": \"Emma Maersk\",\n \"flag\": \"DK\",\n \"operatorCarrierCode\": \"MSK\",\n \"operatorCarrierCodeListProvider\": \"SMDG\"\n }\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"3065fd6c-f63e-4bcd-b028-937a640db5ba\",\n \"eventCreatedDateTime\": \"2003-05-03T00:00:00Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2003-05-03T00:00:00Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_02\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"ABC123123123\"\n }\n ],\n \"transportEventTypeCode\": \"DEPA\",\n \"delayReasonCode\": \"ANA\",\n \"changeRemark\": \"Authorities not available\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_02-B\",\n \"carrierServiceCode\": \"TNT1\",\n \"universalServiceReference\": \"SR00033F\",\n \"carrierExportVoyageNumber\": \"TNT1E\",\n \"carrierImportVoyageNumber\": \"TNT1E\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"VESSEL\",\n \"location\": {\n \"UNLocationCode\": \"USNYC\",\n \"locationName\": \"Eiffel Tower\",\n \"latitude\": \"48.8585500\",\n \"longitude\": \"2.294492036\"\n },\n \"facilityTypeCode\": \"POTE\",\n \"vessel\": {\n \"vesselIMONumber\": \"9321483\",\n \"name\": \"Emma Maersk\",\n \"flag\": \"DK\",\n \"operatorCarrierCode\": \"MSK\",\n \"operatorCarrierCodeListProvider\": \"SMDG\"\n }\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"0210bf51-3d8b-4c7e-8ef9-d143b401ad2f\",\n \"eventCreatedDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventType\": \"SHIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_4\"\n }\n ],\n \"shipmentEventTypeCode\": \"RECE\",\n \"documentTypeCode\": \"SHI\",\n \"documentReference\": \"SI_REF_4\"\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"97eb7c09-571e-438f-8f65-ac6a29ba04e5\",\n \"eventCreatedDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventType\": \"SHIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"cbrr-b83765166707812c8ff4\"\n }\n ],\n \"shipmentEventTypeCode\": \"RECE\",\n \"documentTypeCode\": \"CBR\",\n \"documentReference\": \"cbrr-b83765166707812c8ff4\"\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"d7dde15f-5ddc-42ce-8103-9fa1c4da0bde\",\n \"eventCreatedDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventType\": \"SHIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"BKG\",\n \"value\": \"cbr-b83765166707812c8ff4\"\n }\n ],\n \"shipmentEventTypeCode\": \"RECE\",\n \"documentTypeCode\": \"BKG\",\n \"documentReference\": \"cbr-b83765166707812c8ff4\"\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"8b654176-fe41-41fd-a457-a632d6811246\",\n \"eventCreatedDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventType\": \"SHIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-01-08T13:22:53Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"SHI\",\n \"value\": \"c144c6dff46b9fa67e65\"\n }\n ],\n \"shipmentEventTypeCode\": \"RECE\",\n \"documentTypeCode\": \"SHI\",\n \"documentReference\": \"c144c6dff46b9fa67e65\"\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"576731c5-1aca-4e05-a279-bae1350b7961\",\n \"eventCreatedDateTime\": \"2021-01-08T17:22:53Z\",\n \"eventType\": \"SHIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-01-08T17:22:53Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_4\"\n }\n ],\n \"shipmentEventTypeCode\": \"PENU\",\n \"documentTypeCode\": \"SHI\",\n \"documentReference\": \"SI_REF_4\",\n \"reason\": \"Carrier Booking Reference present in both shipping instruction as well as cargo items.\"\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"037bb03d-1310-4011-bc9b-3956b1e166bd\",\n \"eventCreatedDateTime\": \"2021-01-08T18:22:53Z\",\n \"eventType\": \"SHIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-01-08T18:22:53Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_4\"\n }\n ],\n \"shipmentEventTypeCode\": \"DRFT\",\n \"documentTypeCode\": \"SHI\",\n \"documentReference\": \"SI_REF_4\"\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"84db923d-2a19-4eb0-beb5-446c1ec17d34\",\n \"eventCreatedDateTime\": \"2021-01-09T13:12:56Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2019-11-11T23:11:00Z\",\n \"eventClassifierCode\": \"ACT\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_02\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"ABC123123123\"\n }\n ],\n \"transportEventTypeCode\": \"ARRI\",\n \"delayReasonCode\": \"WEA\",\n \"changeRemark\": \"Bad weather\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_02-A\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"VESSEL\",\n \"location\": {\n \"UNLocationCode\": \"USNYC\",\n \"locationName\": \"Eiffel Tower\",\n \"latitude\": \"48.8585500\",\n \"longitude\": \"2.294492036\"\n },\n \"facilityTypeCode\": \"POTE\",\n \"vessel\": {\n \"vesselIMONumber\": \"1234567\",\n \"name\": \"King of the Seas\",\n \"flag\": \"DE\",\n \"callSign\": \"NCVV\",\n \"operatorCarrierCode\": \"MSK\",\n \"operatorCarrierCodeListProvider\": \"SMDG\"\n }\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"2c645424-a125-4431-9dc4-5aff488173b7\",\n \"eventCreatedDateTime\": \"2021-01-09T13:12:56Z\",\n \"eventType\": \"EQUIPMENT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2019-11-11T23:11:00Z\",\n \"eventClassifierCode\": \"EST\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_02\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"ABC123123123\"\n }\n ],\n \"equipmentEventTypeCode\": \"LOAD\",\n \"equipmentReference\": \"APZU4812090\",\n \"emptyIndicatorCode\": \"EMPTY\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_02-A\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"VESSEL\",\n \"location\": {\n \"UNLocationCode\": \"USNYC\",\n \"locationName\": \"Eiffel Tower\",\n \"latitude\": \"48.8585500\",\n \"longitude\": \"2.294492036\"\n },\n \"facilityTypeCode\": \"POTE\",\n \"vessel\": {\n \"vesselIMONumber\": \"1234567\",\n \"name\": \"King of the Seas\",\n \"flag\": \"DE\",\n \"callSign\": \"NCVV\",\n \"operatorCarrierCode\": \"MSK\",\n \"operatorCarrierCodeListProvider\": \"SMDG\"\n }\n },\n \"isoequipmentCode\": \"22G2\",\n \"isTransshipmentMove\": false\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"2968b966-ee81-46ba-af87-0c5031c641f4\",\n \"eventCreatedDateTime\": \"2021-11-28T13:12:56Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-11-30T23:11:00Z\",\n \"eventClassifierCode\": \"PLN\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"a3a34f10-acc5-4e23-b52e-146f63458c90\"\n },\n {\n \"type\": \"CBR\",\n \"value\": \"ef223019-ff16-4870-be69-9dbaaaae9b11\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"C501576CD94F\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"DCR987876762\"\n }\n ],\n \"transportEventTypeCode\": \"ARRI\",\n \"delayReasonCode\": \"WEA\",\n \"changeRemark\": \"Bad weather\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_04-A\",\n \"carrierExportVoyageNumber\": \"2107E\",\n \"carrierImportVoyageNumber\": \"2106W\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"VESSEL\",\n \"location\": {\n \"UNLocationCode\": \"DEHAM\",\n \"locationName\": \"Hamburg\",\n \"address\": {\n \"name\": \"Lukas\",\n \"street\": \"Rohrdamm\",\n \"streetNumber\": \"81\",\n \"floor\": \"5\",\n \"postCode\": \"32108\",\n \"city\": \"Bad Salzuflen Grastrup-hölsen\",\n \"stateRegion\": \"Nordrhein-Westfalen\",\n \"country\": \"Germany\"\n },\n \"facilityCode\": \"DPWJA\",\n \"facilityCodeListProvider\": \"SMDG\",\n \"latitude\": \"53.551° N\",\n \"longitude\": \"9.9937° E\"\n },\n \"facilityTypeCode\": \"POTE\",\n \"vessel\": {\n \"vesselIMONumber\": \"9321483\",\n \"name\": \"Emma Maersk\",\n \"flag\": \"DK\",\n \"operatorCarrierCode\": \"MSK\",\n \"operatorCarrierCodeListProvider\": \"SMDG\"\n }\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"2968b966-ee81-46ba-af87-0c5031c641f3\",\n \"eventCreatedDateTime\": \"2021-11-28T13:12:56Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-11-30T23:11:00Z\",\n \"eventClassifierCode\": \"PLN\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_01\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"AR1239719871\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"BR1239719871\"\n },\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_2\"\n },\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_7\"\n },\n {\n \"type\": \"TRD\",\n \"value\": \"9b02401c-b2fb-5009\"\n }\n ],\n \"references\": [\n {\n \"type\": \"CR\",\n \"value\": \"AB-123743CR\"\n },\n {\n \"type\": \"PO\",\n \"value\": \"PO0027\"\n }\n ],\n \"transportEventTypeCode\": \"DEPA\",\n \"delayReasonCode\": \"WEA\",\n \"changeRemark\": \"Bad weather\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_01-C\",\n \"carrierExportVoyageNumber\": \"2419E\",\n \"carrierImportVoyageNumber\": \"2418W\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"RAIL\",\n \"location\": {\n \"UNLocationCode\": \"USMIA\",\n \"locationName\": \"Genneb\"\n },\n \"facilityTypeCode\": \"COFS\"\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"2968b966-ee81-46ba-af87-0c5031c641f2\",\n \"eventCreatedDateTime\": \"2021-11-28T13:12:56Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-11-30T23:11:00Z\",\n \"eventClassifierCode\": \"PLN\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_01\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"AR1239719871\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"BR1239719871\"\n },\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_2\"\n },\n {\n \"type\": \"SHI\",\n \"value\": \"SI_REF_7\"\n },\n {\n \"type\": \"TRD\",\n \"value\": \"9b02401c-b2fb-5009\"\n }\n ],\n \"references\": [\n {\n \"type\": \"CR\",\n \"value\": \"AB-123743CR\"\n },\n {\n \"type\": \"PO\",\n \"value\": \"PO0027\"\n }\n ],\n \"transportEventTypeCode\": \"ARRI\",\n \"delayReasonCode\": \"WEA\",\n \"changeRemark\": \"Bad weather\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_01-D\",\n \"carrierExportVoyageNumber\": \"3419E\",\n \"carrierImportVoyageNumber\": \"3418W\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"RAIL\",\n \"location\": {\n \"UNLocationCode\": \"USMIA\",\n \"locationName\": \"Nijmegen\"\n },\n \"facilityTypeCode\": \"INTE\"\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"2968b966-ee81-46ba-af87-0c5031c64142\",\n \"eventCreatedDateTime\": \"2021-11-28T13:12:56Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-11-30T23:11:00Z\",\n \"eventClassifierCode\": \"PLN\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"CARRIER_BOOKING_REQUEST_REFERENCE_02\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"ABC123123123\"\n }\n ],\n \"transportEventTypeCode\": \"DEPA\",\n \"delayReasonCode\": \"WEA\",\n \"changeRemark\": \"Bad weather\",\n \"transportCall\": {\n \"transportCallReference\": \"TC-REF-08_02-A\",\n \"transportCallSequenceNumber\": 1,\n \"modeOfTransport\": \"VESSEL\",\n \"location\": {\n \"UNLocationCode\": \"USNYC\",\n \"locationName\": \"Eiffel Tower\",\n \"latitude\": \"48.8585500\",\n \"longitude\": \"2.294492036\"\n },\n \"facilityTypeCode\": \"POTE\",\n \"vessel\": {\n \"vesselIMONumber\": \"1234567\",\n \"name\": \"King of the Seas\",\n \"flag\": \"DE\",\n \"callSign\": \"NCVV\",\n \"operatorCarrierCode\": \"MSK\",\n \"operatorCarrierCodeListProvider\": \"SMDG\"\n }\n }\n }\n },\n {\n \"metadata\": {\n \"eventID\": \"9d5d0824-b228-4ea8-b2cb-4ebd8da76e15\",\n \"eventCreatedDateTime\": \"2021-11-29T13:12:56Z\",\n \"eventType\": \"TRANSPORT\"\n },\n \"payload\": {\n \"eventDateTime\": \"2021-12-02T23:11:00Z\",\n \"eventClassifierCode\": \"PLN\",\n \"relatedDocumentReferences\": [\n {\n \"type\": \"CBR\",\n \"value\": \"a3a34f10-acc5-4e23-b52e-146f63458c90\"\n },\n {\n \"type\": \"CBR\",\n \"value\": \"ef223019-ff16-4870-be69-9dbaaaae9b11\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"C501576CD94F\"\n },\n {\n \"type\": \"BKG\",\n \"value\": \"DCR987876762\"\n |
There was a problem hiding this comment.
From this line 3217, many variables are added for the CTK. Those are used mainly for the pre-test script and a few additional tests for the CTK.
There was a problem hiding this comment.
It is hard to review such a huge JSON file. Can u pls load it in Postman for review? You will see many pre-tests script and additional test such as
Reference implementation request body mandatory field check
PASS
Send a HEAD request to the given callback URL https://f12d95eb-6e7b-4516-ac10-7c3c9efe2887.mock.pstmn.io/456eacf9-8cda-412b-b801-4a41be7a6d000
PASS
Send a POST request to the given callback URL https://f12d95eb-6e7b-4516-ac10-7c3c9efe2887.mock.pstmn.io/456eacf9-8cda-412b-b801-4a41be7a6d000
PASS
Check response schema
PASS
Check request body schema
There was a problem hiding this comment.
I copy the code for the pre-test script here:
// Additional test for conformance
const testMode = pm.collectionVariables.get("TEST_MODE");
const conformanceTest = pm.collectionVariables.get("CONFORMANCE_TEST_MODE");
var requestBody = pm.collectionVariables.get("CONFORMANCE_EVENT_SUBSCRIPTION_POST_REQUEST_BODY");
if(testMode.includes(conformanceTest) ){
pm.test("conformance request body mandatory field check", function () {
try {
var parsedBody = JSON.parse(requestBody);
if (!parsedBody.secret) {
throw new Error("Required field secret is missing");
}
if(!parsedBody.callbackUrl){
throw new Error("Required field callbackUrl is missing.");
}
} catch (error) {
pm.test("Request Body Assertion", function () {
pm.expect.fail("Failed to parse request body or missing required fields: " + error.message);
});
}
});
pm.request.body = requestBody;
pm.request.headers.add({key: "Content-Type", value: "application/json"});
}else{
pm.test("Reference implementation request body mandatory field check", function () {
const requiredFields = ['callbackUrl', 'secret'];
requestBody = JSON.parse(pm.request.body.raw);
requiredFields.forEach(field => {
if (!requestBody.hasOwnProperty(field)) {
throw new Error(Missing ${field} field in the request body);
}
});
});
}
There was a problem hiding this comment.
Also extra test for the CTK:
//Postman mock server for subsription callback
const reqBody = JSON.parse(request.data);
pm.test("Send a HEAD request to the given callback URL "+reqBody.callbackUrl, function () {
// Define the request options
const requestOptions = {
method: 'HEAD',
url: reqBody.callbackUrl,
header: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
json: true
};
// Send the request
pm.sendRequest(requestOptions, function (error, response) {
// Handle the response
if (error) {
console.log(error);
throw new Error("HEAD request error for the callbackUrl "+error);
} else {
pm.expect(response).to.have.property('code', 204);
}
});
});
pm.test("Send a POST request to the given callback URL "+reqBody.callbackUrl, function () {
// Define the request options
const requestOptions = {
method: 'POST',
url: reqBody.callbackUrl,
header: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
json: true
};
// Send the request
pm.sendRequest(requestOptions, function (error, response) {
// Handle the response
if (error) {
console.log(error);
throw new Error("POST request error for the callbackUrl "+error);
} else {
pm.expect(response).to.have.property('code', 204);
}
});
});
// Additional test for conformance
const response_schema = pm.collectionVariables.get("EVENT_SUBSCRIPTION_RESPONSE_SCHEMA");
const request_schema = pm.collectionVariables.get("EVENT_SUBSCRIPTION_REQUEST_SCHEMA");
const testMode = pm.collectionVariables.get("TEST_MODE");
const ignoreSchemaTest = pm.collectionVariables.get("IGNORE_SCHEMA_TEST_MODE");
const conformanceTest = pm.collectionVariables.get("CONFORMANCE_TEST_MODE");
const and = pm.collectionVariables.get("AND");
if( !testMode.includes(ignoreSchemaTest) ){
pm.test("Check response schema", function(){
var result = tv4.validateResult(pm.response.json(), response_schema);
if(!result.valid){
console.log(Schema validation failed: ${JSON.stringify(validationResult.errors)});
console.log(Response: ${JSON.stringify(response)});
throw new Error("Response schema validation failed");
}
pm.expect(result.valid).to.be.true;
});
pm.test("Check request body schema", function(){
var requestData;
if(testMode === conformanceTest){
requestData = pm.collectionVariables.get("CONFORMANCE_EVENT_SUBSCRIPTION_POST_REQUEST_BODY");
}else{
requestData = JSON.parse(pm.request.body.raw);
}
const validationResult = tv4.validateResult(requestData, request_schema);
if (!validationResult.valid) {
console.log(`Schema validation failed: ${JSON.stringify(validationResult.errors)}`);
console.log(`Response: ${JSON.stringify(response)}`);
throw new Error("Schema validation failed "+validationResult.errors);
}
pm.expect(validationResult.valid).to.be.true;
});
}
There was a problem hiding this comment.
Note I didn't add any new Postman requests for this PR. Just additional pre-test script and postman test.
There was a problem hiding this comment.
I see. I did import it into postman but only saw the same requests, I did not look at the tests for each request as I assumed the CTK would have it's own set of requests.
There was a problem hiding this comment.
CTK has a few new requests. I didn't add them to this PR. My plan is to gradually build it. Our plan is not to break the current Postman collection. Just add a few additional variables to switch Newman execution. Such as:
TEST_MODE
CONFORMANCE_TEST_MODE
CONFORMANCE_EVENT_SUBSCRIPTION_POST_REQUEST_BODY
No description provided.