Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator implementation for V2 smoke tests for C2J files. #3578

Open
wants to merge 2 commits into
base: normj/v4-smoketests
Choose a base branch
from

Conversation

AlexDaines
Copy link

Description

Implements the generator for smoke tests v2 format based on the new smoke-2.json schema. Key features:

  • Supports all configuration options from the smoke-2.json schema
  • Handles complex input types including arrays and nested objects
  • Generates both success and failure test cases
  • Includes proper test categorization
  • Manages special cases for Tags and Includes objects

Questions for review:

  1. Special case handling for Tags/Includes - should this be more generic?
  2. Configuration defaults - should we explicitly set schema defaults?
  3. Error handling - any additional checks needed beyond ErrorCode?
  4. Input validation - should we validate against operation parameters?
  5. Test categorization - any additional AWS-specific categories needed?

Motivation and Context

This implementation supports the new smoke tests format (smoke-2.json) which provides more configuration options and better structure for test cases. The generator creates test files that:

  • Allow per-test configuration
  • Support all endpoint configuration options
  • Handle complex input structures
  • Provide proper error handling and validation

Testing

  • Verified generation with ACM service model
  • Tested various scenarios including:
    • Success and failure cases
    • Complex input structures (arrays, nested objects)
    • Special cases (Tags, Includes)
    • Edge cases (null values, empty strings)
    • All configuration options
  • Generated tests compile successfully

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

}
catch (Amazon<#=this.Config.ClassName#>Exception ex)
{
Assert.AreEqual("<#=errorId#>", ex.ErrorCode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this locally I get an exception because the <#= doesn't handle errorId being null. You need to add a null check before adding the Assert.AreEqual.

}
}
#>
public async Task <#=testCase["id"]?.ToString() ?? "Test"#>()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were there tests without an id field? Seems like a field that would be required.

if (value.IsString)
{
#>
request.<#=key#> = "<#=value.ToString()#>";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are going to be times that the key defined in the smoke json file do not match exactly to the property name on the request. We change the case to match .NET conventions and sometimes have customizations to rename it. Look at how I wrote the FindOperation method that looks in the ServiceModel to find the shape by the model name versus the .NET name.

}
else
{
var arrayValues = new List<string>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't remember in the SEP can there be arrays of more then just strings.

@@ -8,6 +8,7 @@
AddLicenseHeader();
#>
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm not reviewing the PR, but...) Is there a reason why you're using MSTest as the test framework?

The hand-written files we have right now use xUnit (meaning they can run in parallel) and using xUnit will allow you to test your PR without making any changes to our build system (as long as they're found by the projects in this folder: https://github.com/aws/aws-sdk-net/tree/v4-development/sdk/test/SmokeTests).

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.

3 participants