Here’s a complete solution addressing all three focus areas:
1. JSON Schema Validation:
Windchill requires strict adherence to its TestCase schema. Create a mapping configuration:
{
"schemaVersion": "12.0",
"fieldMappings": {
"executionDuration": "customAttributes.duration",
"timestamp": "executedDate"
}
}
2. Test Case Structure Alignment:
Your JSON must match this minimal structure:
{
"testCaseID": "TC-001",
"name": "Login Test",
"status": "PASSED",
"executedBy": "automation_user"
}
3. API Payload Mapping:
Implement a transformation layer that converts your automation output to Windchill’s expected format.
// Pseudocode - Key implementation steps:
- Load test automation results JSON from file/API
- Parse and validate against source schema
- Map required fields: testCaseID, name, status, executedBy to Windchill equivalents
- Transform timestamps to ISO 8601 format (yyyy-MM-dd’T’HH:mm:ss’Z’)
- Map custom fields to customAttributes object structure
- For nested suites: First POST test suite objects, capture returned IDs
- Then POST test cases with parentSuiteId references
- Handle API responses and log any validation errors with field details
// See documentation: Windchill Test Management API Guide Section 6.3
Key implementation details:
a) Status values must match Windchill enumeration exactly: PASSED, FAILED, BLOCKED, NOT_RUN (case-sensitive)
b) Use batch import for multiple test cases - send array of test case objects in single request to improve performance
c) Custom fields go into the customAttributes object as key-value pairs
d) For test suites, use separate endpoint /testsuites before importing test cases
e) Implement retry logic for validation errors - the API sometimes needs schema cache refresh
Create a transformation middleware that sits between your test automation and Windchill API. This middleware validates your automation JSON, transforms it to Windchill schema, and handles the multi-step import process for hierarchical structures. Test with a small dataset first to verify the mapping works correctly.
This draft is based on general Windchill knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.