Skip to content

Add api_test.mustache template for auto-generated test classes#1674

Open
agrja-rastogi-okta wants to merge 2 commits intomasterfrom
api-test-template-pr
Open

Add api_test.mustache template for auto-generated test classes#1674
agrja-rastogi-okta wants to merge 2 commits intomasterfrom
api-test-template-pr

Conversation

@agrja-rastogi-okta
Copy link
Contributor

This template generates comprehensive unit tests for all API operations. Each test:

  • Loads prerequisite data created by Terraform
  • Extracts method parameters from the prerequisite data
  • Executes the actual API method
  • Validates HTTP response codes (200, 201, 202, 204)

The template includes:

  • Smart parameter extraction that handles field name variations
  • Support for file uploads via file_path parameter
  • Automatic model deserialization with fallback to alternative class names
  • Comprehensive error handling and validation
  • Javadoc comments explaining test behavior

This enables automated testing of all Okta SDK operations against live APIs while maintaining code consistency and reducing manual test maintenance.

This template generates comprehensive unit tests for all API operations. Each test:
- Loads prerequisite data created by Terraform
- Extracts method parameters from the prerequisite data
- Executes the actual API method
- Validates HTTP response codes (200, 201, 202, 204)

The template includes:
- Smart parameter extraction that handles field name variations
- Support for file uploads via file_path parameter
- Automatic model deserialization with fallback to alternative class names
- Comprehensive error handling and validation
- Javadoc comments explaining test behavior

This enables automated testing of all Okta SDK operations against live APIs
while maintaining code consistency and reducing manual test maintenance.
The toSnakeCase method was not being called anywhere in the template.
The camelCase to snake_case conversion is already handled by
TerraformHelper.getPrerequisiteDataForTest() on the backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant