Below is part of ths test.json file; when executing to display key-value data, the order of the values is not the same as in the json file, why is that?
{
"testdata": [
{
"testName": "LoginTest",
"data": [
{
"runmode": "y",
"browser": "chrome",
"username":"abc@gmail.com",
"password":"pass1234"
},
{
"runmode": "n",
"browser": "mozilla",
"username":"abc@gmail.com",
"password":"pass1234"
},
{
"runmode": "y",
"browser": "edge",
"username":"abc@gmail.com",
"password":"pass1234"
}
]
-------------------------------------------------------------------------------------
Display on execution:
{"testdata":[{"data":[{"runmode":"y","password":"pass1234","browser":"chrome","username":"abc@gmail.com"},{"runmode":"n","password":"pass1234","browser":"mozilla","username":"abc@gmail.com"},{"runmode":"y","password":"pass1234","browser":"edge","username":"abc@gmail.com"}],"testName":"LoginTest"},{"data":[{"runmode":"y","maxcost":"50000","browser":"chrome","productname":"iphone1 10","mincost":"10000"},{"runmode":"y","maxcost":"100000","browser":"mozilla","productname":"IBM ThinkPad","mincost":"50000"},{"runmode":"n","maxcost":"5000","browser":"edge","productname":"Iball Headphones","mincost":"1000"}],"testName":"PurchaseProductTest"},{"data":[{"runmode":"y","browser":"chrome","productname":"iphone 10","operation":"remove"},{"runmode":"y","maxcost":"100000","browser":"mozilla","productname":"IBM ThinkPad","mincost":"50000"}],"testName":"ProductOperationTest"}]}
[{"data":[{"runmode":"y","password":"pass1234","browser":"chrome","username":"abc@gmail.com"},{"runmode":"n","password":"pass1234","browser":"mozilla","username":"abc@gmail.com"},{"runmode":"y","password":"pass1234","browser":"edge","username":"abc@gmail.com"}],"testName":"LoginTest"},{"data":[{"runmode":"y","maxcost":"50000","browser":"chrome","productname":"iphone1 10","mincost":"10000"},{"runmode":"y","maxcost":"100000","browser":"mozilla","productname":"IBM ThinkPad","mincost":"50000"},{"runmode":"n","maxcost":"5000","browser":"edge","productname":"Iball Headphones","mincost":"1000"}],"testName":"PurchaseProductTest"},{"data":[{"runmode":"y","browser":"chrome","productname":"iphone 10","operation":"remove"},{"runmode":"y","maxcost":"100000","browser":"mozilla","productname":"IBM ThinkPad","mincost":"50000"}],"testName":"ProductOperationTest"}]
{"data":[{"runmode":"y","password":"pass1234","browser":"chrome","username":"abc@gmail.com"},{"runmode":"n","password":"pass1234","browser":"mozilla","username":"abc@gmail.com"},{"runmode":"y","password":"pass1234","browser":"edge","username":"abc@gmail.com"}],"testName":"LoginTest"}
Instructor
Ashish Thakur Replied on 09/06/2021
Your code logic has some issue.
Please debug your code