JSON → TPH Migration¶
Convert existing hand-authored TestPlan JSON to TestPlan Shorthand (TPH).
Mapping Reference¶
| JSON element | TPH equivalent |
|---|---|
"id" |
TestPlan: <id> |
"title" |
Title: "<title>" |
"description" |
Description: "<desc>" |
"status" |
Status: #<value> |
"url" |
Url: "<url>" |
testCase[].key |
TestCase: <key> |
testCase[].testRun[].script.reference |
TestRun: <reference> |
testCase[].dependency[].predecessor.reference |
Dependency: <key> |
testCase[].testData[].content.reference |
TestData: <reference> |
Step-by-Step Example¶
Original JSON¶
{
"resourceType": "TestPlan",
"id": "erequesting-suite",
"title": "AU eRequesting Test Suite",
"status": "active",
"url": "http://example.org/TestPlan/erequesting-suite",
"testCase": [
{
"key": "CreateDraft",
"testRun": [
{ "script": { "reference": "TestScript/create-draft" } }
]
},
{
"key": "Activate",
"dependency": [
{ "predecessor": { "reference": "#CreateDraft" } }
],
"testRun": [
{ "script": { "reference": "TestScript/activate" } }
]
},
{
"key": "Complete",
"dependency": [
{ "predecessor": { "reference": "#Activate" } }
],
"testRun": [
{ "script": { "reference": "TestScript/complete" } }
]
},
{
"key": "Revoke",
"dependency": [
{ "predecessor": { "reference": "#CreateDraft" } }
],
"testRun": [
{ "script": { "reference": "TestScript/revoke" } }
]
}
]
}
Converted TPH¶
TestPlan: erequesting-suite
Title: "AU eRequesting Test Suite"
Status: #active
Url: "http://example.org/TestPlan/erequesting-suite"
TestCase: CreateDraft
TestRun: TestScript/create-draft
TestCase: Activate
Dependency: CreateDraft
TestRun: TestScript/activate
TestCase: Complete
Dependency: Activate
TestRun: TestScript/complete
TestCase: Revoke
Dependency: CreateDraft
TestRun: TestScript/revoke
Lines: 80 → 18 (78% reduction)
Migration Checklist¶
- [ ] Replace JSON header fields with TPH keywords
- [ ] Convert each
testCaseentry to aTestCase:block - [ ] Convert
dependency[].predecessor.reference— strip the leading# - [ ] Convert
testRun[].script.referencetoTestRun:line - [ ] Rename file from
.jsonto.tph - [ ] Verify with
ant testor JUnit runner
Handling Unsupported Elements¶
Some advanced TestPlan fields are not yet supported in TPH syntax. Keep the JSON version for those cases and file a feature request.
Currently unsupported:
- testCase[].assertion (structured assertions on test outcomes)
- testCase[].testData with inline content (only references supported)
- scope, objective, exitCriteria at the TestPlan level
Next Steps¶
- TPH Syntax — Full syntax reference
- TestPlan Expansion — How TPH is executed