@michaelderekjones
Hi Mike ,
The command i’m using is newman run -d
I’m attaching the collection files and data files using :
the mapping is :
collection file : laas_nm_coll_createTemplate uses the datafile : templateList.json
collection file : laas_nm_coll_createNode uses the datafile : templateNodeList.json
The entire collection file and data file is pasted below, as i’m not able to upload .
My requirement is to combine all these 2 API into a single collection file and combine all data file into one data file . Due to a number of reasons my team doesnt want to use these separate collection files or data files.
Another benefit with doing like this is i’m generating a summary report and a junit output xml, using a nodejs . If i run these collection file sperately i’m getting number of summary files and junit files, which is not good .
To combine all data file, i made format which is with filename : TesctCase01 , but i tried to define the variable in createTemplate API collection file as tc1.template.name and different json format string commands , but nothing is working.
Ideally, i want to know how can force and API call using newman, with only required data from a list of data.
Hope its explains now.
BR
Deepu
===================== collection file:laas_nm_coll_createTemplate =======================
{
“info”: {
“name”: “createTemplate”,
“description”: “A sample collection to demonstrate collections as a set of related requests”
},
"item": [{
"name": "createTemplate",
"event": [{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('expect API response be 200', function () {",
" var jsonData = pm.response.json();",
" pm.response.to.be.ok && pm.response.to.have.status(200);",
"})",
"pm.test('Response contains no error object', function () {",
" const curren_response = pm.response.json();",
" pm.expect(curren_response.errors == undefined, \"Response containse graphql errors\").to.be.true",
"});"
]
}
}],
"request": {
"url": "http://orchestrator-gui:8011/graphql",
"method": "POST",
"body": {
"mode": "graphql",
"graphql": {
"query":"mutation {templateCreate (input: {name: \"{{createTemplName}}\"description: \"{{templDesc}}\"}){id}}"
}
}
}
}]
}
=========================== collection file:laas_nm_coll_createNode ======================================
{
“info”: {
“name”: “Sample Postman Collection”,
“description”: “A sample collection to demonstrate collections as a set of related requests”
},
"item": [{
"name": "createTemplateNode",
"event": [{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('expect API response be 200', function () {",
" var jsonData = pm.response.json();",
" console.log(jsonData);",
" pm.response.to.be.ok && pm.response.to.have.status(200);",
"})",
"pm.test('Response contains no error object', function () {",
" const curren_response = pm.response.json();",
" pm.expect(curren_response.errors == undefined, \"Response containse graphql errors\").to.be.true",
"});"
]
}
}],
"request": {
"url": "http://orchestrator-gui:8011/graphql",
"method": "POST",
"body": {
"mode": "graphql",
"graphql": {
"query": "mutation {nodesCreate (input: {templateName: \"{{templateName}}\"nodes: [{name: \"{{nodeName}}\" eqmTypeName: \"{{EquipmentName}}\"}]}) {id}}"
}
}
}
}]
}
=========================== data file:laas_nm_coll_createNode ======================================
[
{“createTemplName”: “TC138 Config 1”,“templDesc”: “TC138 Config 1 from newman”},
{“createTemplName”: “TC138 Config 2”,“templDesc”: “TC138 Config 2 from newman”},
{“createTemplName”: “TC138 Config 3”,“templDesc”: “TC138 Config 3 from newman”}
]
=========================== data file:templateNodeList ======================================
[
{“templateName”: “TC138 Config 1”,“nodeName”: “vDU”,“EquipmentName”: “HPE EDGELINE E920T”},
{“templateName”: “TC138 Config 1”,“nodeName”: “gNB&eNB”,“EquipmentName”: “BASEBAND 6648”},
{“templateName”: “TC138 Config 1”,“nodeName”: “RGW”,“EquipmentName”: “RADIO GATEWAY R608”},
{“templateName”: “TC138 Config 1”,“nodeName”: “LTE_RU1”,“EquipmentName”: “RADIO 2212 B66A”},
{“templateName”: “TC138 Config 1”,“nodeName”: “NR_RU1”,“EquipmentName”: “Radio 4455 B2/B25 B66A”},
{“templateName”: “TC138 Config 1”,“nodeName”: “NR_RU2”,“EquipmentName”: “Radio 4449 B5 B13”},
{“templateName”: “TC138 Config 1”,“nodeName”: “Viavi E500.SVR.FES”,“EquipmentName”: “VIAVI E500 MK4.3 SVR.FES”}
]
============================= combine data file : TesctCase01 =================================
[
{“tc1”:
{“template”: {“name”: “TC138 Config 1”,“desc”: “TC138 Config 1 from newman”},
“nodes”: [
{“name”: “vDU”,“equipmentName”: “HPE EDGELINE E920T”},
{“name”: “gNB&eNB”,“equipmentName”: “BASEBAND 6648”},
{“name”: “RGW”,“equipmentName”: “RADIO GATEWAY R608”},
{“name”: “LTE_RU1”,“equipmentName”: “RADIO 2212 B66A”},
{“name”: “NR_RU1”,“equipmentName”: “Radio 4455 B2/B25 B66A”},
{“name”: “NR_RU2”,“equipmentName”: “Radio 4449 B5 B13”},
{“name”: “Viavi E500.SVR.FES”,“equipmentName”: “VIAVI E500 MK4.3 SVR.FES”}
]
}
}
]