Skip to content

Instantly share code, notes, and snippets.

@dg3feiko
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dg3feiko/eff8c72c752cf29223ee to your computer and use it in GitHub Desktop.
Save dg3feiko/eff8c72c752cf29223ee to your computer and use it in GitHub Desktop.
{
"sample": {
"valid": ["PK123123","OI2123123","haha"],
"no_result": ["))kjjkkdf","**kjkljsdf"],
"bad_format": ["&^&^*^*&*","()()()():P"]
},
"test": {
"basic_test":
{
"expect":
{
//check against each of result of all trackings
"exist":[
"shipment.weight",//single field
"checkpoints..address.country_iso3"//field in array, use double dot
]
}
},
"correctness_test":
{
"cases":[
{
"description":"it should have sign_by",//optional
"tracking_numbers":["123123123"],
"expect":
{
"exist":["shipment.signed_by"]
}
},
{
"description":"it should have no result with invalid number",//optional
"tracking_numbers":["123123123"],
"expect":
{
"error":801//or Tracking_No_Result(string), check against each tracking in returned result
}
},
{
"description":"it should have proof or delivery",
"tracking_numbers":["456456456"],
"expect":
{
"result":[
//the whole results array
]
}
},
{
"description":"it should have only one tracking error",
"tracking_numbers":["valid_no","invalid_no"];
"expect":
{
"result":[
//the whole results array
]
}
}
]
}
}
}
@fedor
Copy link

fedor commented Oct 30, 2014

Proposal of flat config

{
    "sample": {
        "valid": ["user1"],
        "no_result": ["))kjjkkdf","**kjkljsdf"],
        "bad_format": ["&^&^*^*&*","()()()():P"]
    },
    "tests": [
        // Basic Test
        {
            //check against each of result of all trackings
            "exist":[
                "shipment.weight",//single field
                "checkpoints..address.country_iso3"//field in array, use double dot
            ]
        },

        // Correctness Test
        {
            "description":"it should have sign_by",//optional
            "tracking_numbers":["123123123"],
            "exist": [
                "shipment.weight",
                {"shipment.signed_by": "John Doe", "shipment.signed_by.OTHER": "..."}
            ]
        }, {
            "description":"it should have no result with invalid number",//optional
            "tracking_numbers":["123123123"],
            "error": 801//or Tracking_No_Result(string), check against each tracking in returned result
        }, {
            "description": "it should have proof or delivery",
            "tracking_numbers": ["456456456"],
            "result": [
                //the whole results array
            ]
        }, {
            "description":"it should have only one tracking error",
            "tracking_numbers":["valid_no","invalid_no"],
            "result": [
                //the whole results array
            ]
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment