The rules for building the JSON data file are fairly simple:
- Each section in the file should have the same name as the test method.
- Each set of data in each section should be sequentially numbered starting with the method name + .01, .02, .03, and so on. This will allow users to debug the set of data that failed the test.
- Each key/value pair should correspond to the fields in the JSON object being used.
- The number of sets of data for each test method is unlimited.
- All dynamic data should be stubbed out in the data file and replaced on the fly:
{
"tc001_registerEmployees":
[
{
"rowID": "tc001_registerEmployees.01",
"description": "Register Employee",
"id": "ID1",
"address": {"street": "1600 Pennsylvania Ave NW", "city":
"Washington",
"state": "DC", "zip": "20500"},
"phone": {"home": "800-555-1212", "work": "800-555-1212",
"mobile": "800-555-1212"}
},
{
"rowID": "tc001_registerEmployees.02",
"description": "Register Employee",
"id": "ID2",
"address": {"street": "1600 Pennsylvania Ave NW",
"city": "Washington", "state": "DC", "zip":
"20500"},
"phone": {"home": "800-555-1212", "work": "800-555-1212",
"mobile": "800-555-1212"}
}
]
}