Test data import fails with JSON schema mismatch when integrating automated test results

We’re trying to import automated test results into Windchill but the JSON payload validation keeps failing with schema mismatch errors. Our test automation framework generates JSON files with test case results, but when we POST them to the Windchill API, we get validation errors. The test case structure alignment seems off - our JSON schema includes fields that Windchill doesn’t recognize, and the API payload mapping isn’t working as expected.

API error response:

{
  "error": "SCHEMA_MISMATCH",
  "details": "Field 'executionDuration' not defined in schema",
  "line": 23
}

Has anyone successfully integrated external test results into Windchill test management? What’s the correct JSON structure for test case imports?

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:

  1. Load test automation results JSON from file/API
  2. Parse and validate against source schema
  3. Map required fields: testCaseID, name, status, executedBy to Windchill equivalents
  4. Transform timestamps to ISO 8601 format (yyyy-MM-dd’T’HH:mm:ss’Z’)
  5. Map custom fields to customAttributes object structure
  6. For nested suites: First POST test suite objects, capture returned IDs
  7. Then POST test cases with parentSuiteId references
  8. 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.

The test management API in Windchill 12.0 has a very specific schema for test case imports. You can’t just send arbitrary JSON fields - they need to match Windchill’s internal test case model. Check the API documentation for the TestCase object definition. You might need to transform your automation framework’s output to match Windchill’s expected structure.

I’ve integrated several test automation tools with Windchill. The key is understanding that Windchill’s test case structure is fairly rigid. Fields like ‘executionDuration’ need to be mapped to Windchill’s equivalent field names. There’s usually a transformation layer required between your test tool’s JSON output and what Windchill expects. Some fields might need to go into custom attributes rather than standard fields.

Thanks for the input. I found the TestCase schema documentation, but it’s not clear which fields are required vs optional. Our automation generates about 20 different fields per test result. Do I need to map all of them, or can I send a minimal payload and add the rest as custom attributes? Also, how do I handle nested test suites in the JSON structure?

Tested this on Windchill 12.0 with our Jenkins pipeline, and the fieldMappings configuration for executionDuration and executedDate eliminated the schema mismatch errors immediately.

For JSON schema validation in Windchill, only a subset of fields are mandatory: testCaseID, name, status, and executedBy. Everything else can be optional or custom. However, the API is very particular about data types - make sure timestamps are in ISO 8601 format and status values match Windchill’s enumeration exactly. I’ve found that it’s easier to create a JSON template that matches Windchill’s schema perfectly and then map your test data into that template rather than trying to modify your automation output directly.

The nested test suite issue is tricky. Windchill’s test management uses a hierarchical structure but the JSON import doesn’t support deep nesting in a single payload. You need to import test suites first, get their IDs, and then import individual test cases with references to the parent suite IDs. This requires multiple API calls and proper sequencing. Also, make sure you’re using the correct API version endpoint - 12.0 CPS05 has some differences from earlier versions in how it handles test data structures.