Feature: Validations : JSON manipulation
Testing JSON object key deletion and extraction
{
"directory": "./test"
}
{
"response": {
"error": {
"subErrorCodes": [
{
"subErrorCode": 1101,
"subErrorMessage": "Phone Number is required"
}
]
},
"doesnotexist": null
}
}
{
"error": {
"subErrorCodes": [
{
"subErrorCode": 1101,
"subErrorMessage": "Phone Number is required"
}
]
},
"doesnotexist": null
}
{
"lastRun": [
{
"subErrorCode": 1101,
"subErrorMessage": "Phone Number is required"
}
]
}
{}
{
"Data": {
"a": "apple",
"b": "banana"
}
}
{
"a":"apple",
"b":"banana"
}
Then
element "a" exists in item "Data"
00:00:00.001
{
"lastRun": "apple"
}
Then
it is equal to "apple"
00:00:00.001
{
"directory": "./test"
}
{
"Data": {
"a": "apple",
"b": "banana"
}
}
{
"a":"apple",
"b":"banana"
}
And
elements '["a", "b"]' exist in item "Data"
0s
And
elements 'a, b' exist in item "Data"
0s
{
"lastRun": {
"b": "banana"
}
}
Then
"${Data.b}" is equal to "banana"
0s
And
element "a" does not exist in item "Data"
00:00:00.001
And
elements '[c,d]' do not exist in item "Data"
0s
{
"directory": "./test"
}
{
"TestJSON": {
"url": "http://google.com",
"meh": "Test",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"url": "http://google.com",
"meh": "Test",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
{
"lastRun": {
"url": "http://google.com",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"lastRun": {
"url": "http://google.com",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"lastRun": {
"url": "http://google.com",
"meh2": "Another Test",
"deepMeh": {
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"directory": "./test"
}
{
"TestJSON": {
"url": "http://google.com",
"meh": "Test",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"url": "http://google.com",
"meh": "Test",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
{
"newJSON": {
"url": "http://google.com",
"meh": "Test",
"meh2": "Another Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3",
"deep4": "Testing4"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"lastRun": "Testing1"
}
{
"lastRun": {
"deep1": "Testing1",
"deep2": "Testing2"
}
}
And
JSON keys '["meh","deepMeh","deepMeh2.deep3", "arrayTest"]' are extracted from item "TestJSON"
0s
+ Show Info
{
"lastRun": {
"meh": "Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{}
And
JSON keys 'meh,deepMeh,deepMeh2.deep3, arrayTest]' are extracted from item "TestJSON"
00:00:00.001
+ Show Info
{
"lastRun": {
"meh": "Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"expected": {
"meh": "Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"meh": "Test",
"deepMeh": {
"deep1": "Testing1",
"deep2": "Testing2"
},
"deepMeh2": {
"deep3": "Testing3"
},
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
Then
item "expected" is equal to item "lastRun"
0s
{
"directory": "./test"
}
{
"data": {
"alreadylower": "lower",
"Alpha": "apple",
"BETA": "Banana",
"Charley": {
"Coconut": "Hierarchy"
}
}
}
{
"alreadylower": "lower",
"Alpha": "apple",
"BETA": "Banana",
"Charley": { "Coconut": "Hierarchy"}
}
{
"alreadylower": "lower",
"alpha": "apple",
"beta": "Banana",
"charley": {
"coconut": "Hierarchy"
}
}
Then
item "data" is equal to:
0s
{
"alreadylower": "lower",
"alpha": "apple",
"beta": "Banana",
"charley": { "coconut": "Hierarchy" }
}
{
"directory": "./test"
}
{
"data": {
"Alpha": "apple",
"BETA": "Banana",
"Charley": "coconut"
}
}
{
"Alpha": "apple",
"BETA": "Banana",
"Charley": "coconut"
}
{
"alpha": "apple",
"beta": "Banana",
"charley": "coconut"
}
Then
item "data" is equal to:
0s
{
"alpha": "apple",
"beta": "Banana",
"charley": "coconut"
}
{
"directory": "./test"
}
{
"data": {
"Alpha": "123",
"Beta": {
"Beta_21": "456",
"Beta_22": "some_word"
},
"Charley": {
"Charley_21": "45.6",
"Charley_22": 24.9
},
"Delta": "1.2.3"
}
}
{
"Alpha": "123",
"Beta": {
"Beta_21": "456",
"Beta_22": "some_word"
},
"Charley": {
"Charley_21": "45.6",
"Charley_22": 24.9
},
"Delta": "1.2.3"
}
{
"Alpha": 123,
"Beta": {
"Beta_21": 456,
"Beta_22": "some_word"
},
"Charley": {
"Charley_21": 45.6,
"Charley_22": 24.9
},
"Delta": "1.2.3"
}
Then
item "data" is equal to:
0s
{
"Alpha": 123,
"Beta": {
"Beta_21": 456,
"Beta_22": "some_word"
},
"Charley": {
"Charley_21": 45.6,
"Charley_22": 24.9
},
"Delta": "1.2.3"
}
{
"directory": "./test"
}
{
"data": {
"Alpha": {
"Alpha_2": "Apple "
},
"John": 5,
"Beta": "_Banana_",
"Charley": "Spaces are kept in between words",
"Delta": {
"Delta_21": " But spaces at the beginning and end are removed ",
"Delta_22": "\nSo are new lines\n"
}
}
}
{
"Alpha": {
"Alpha_2": "Apple "
},
"John": 5,
"Beta": "_Banana_",
"Charley": "Spaces are kept in between words",
"Delta": {
"Delta_21" : " But spaces at the beginning and end are removed ",
"Delta_22" : "\nSo are new lines\n"
}
}
{
"Alpha": {
"Alpha_2": "Apple"
},
"John": 5,
"Beta": "_Banana_",
"Charley": "Spaces are kept in between words",
"Delta": {
"Delta_21": "But spaces at the beginning and end are removed",
"Delta_22": "So are new lines"
}
}
Then
item "data" is equal to:
00:00:00.001
{
"Alpha": {
"Alpha_2": "Apple"
},
"John": 5,
"Beta": "_Banana_",
"Charley": "Spaces are kept in between words",
"Delta": {
"Delta_21": "But spaces at the beginning and end are removed",
"Delta_22": "So are new lines"
}
}
{
"directory": "./test"
}
{
"data": {
"Alpha": {
"Alpha_2": "Apple"
},
"Beta": "Banana",
"Charley": {
"Charley_2": {
"Charley_3": "Coconut"
}
},
"Delta": {
"Delta_21": "Durian1",
"Delta_22": "Durian2"
}
}
}
{
"Alpha": {
"Alpha_2": "Apple"
},
"Beta": "Banana",
"Charley": {
"Charley_2": {
"Charley_3": "Coconut"
}
},
"Delta": {
"Delta_21" : "Durian1",
"Delta_22" : "Durian2"
}
}
{
"Alpha_2": "Apple",
"Beta": "Banana",
"Charley_3": "Coconut",
"Delta_21": "Durian1",
"Delta_22": "Durian2"
}
Then
item "data" is equal to:
0s
{
"Alpha_2": "Apple",
"Beta": "Banana",
"Charley_3": "Coconut",
"Delta_21": "Durian1",
"Delta_22": "Durian2"
}
{
"directory": "./test"
}
{
"meh": {
"url": "http://google.com",
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"url": "http://google.com",
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
{
"expected": {
"url": null,
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
}
{
"url": null,
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
{
"url": null,
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}
Then
item "expected" is equal to item "meh"
0s
{
"url": "",
"arrayTest": [
"Testing1",
"Testing2",
"Testing3"
]
}