Skip to content

Add e2e tests for client-initialization scenarios (azure-http-specs) - #9994

Merged
Weidong Xu (weidongxu-microsoft) merged 3 commits into
http-client-java_upgrade-compilerfrom
copilot/add-e2e-test-azure-http-specs-again
Mar 11, 2026
Merged

Weidong Xu (weidongxu-microsoft) merged 3 commits into
http-client-java_upgrade-compilerfrom
copilot/add-e2e-test-azure-http-specs-again

Conversation

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

No e2e test coverage existed for the generated clients under azure/clientgenerator/core/clientinitialization. Adds Spector-backed tests for all three sub-packages against the azure-http-specs mock API definitions.

New test files

  • DefaultClientTests.java — covers all 6 default clients: HeaderParam, MultipleParams, MixedParams, PathParam, ParamAlias, QueryParam
  • IndividuallyClientTests.java — covers 6 individually-configured nested clients (path, query, header, multiple, mixed, paramAlias variants)
  • IndividuallyParentClientTests.java — covers the parent factory pattern where IndividuallyParentClient spawns typed child clients

Test values

Derived directly from mockapi.ts in azure-http-specs:

Param Value
name (header) test-name-value
blobName (query/path) test-blob or sample-blob
region us-west

Example

// DefaultClientTests — mixed params: name stored in client, region+id as method args
MixedParamsClient mixedParamsClient = new MixedParamsClientBuilder()
    .name("test-name-value")
    .buildClient();
mixedParamsClient.withQuery("us-west", "test-id");
mixedParamsClient.withBody("us-west", new WithBodyRequest("test-name"));

// IndividuallyParentClientTests — factory pattern
IndividuallyParentClient parentClient = new IndividuallyParentClientBuilder().buildClient();
IndividuallyParentNestedWithPathClient pathClient =
    parentClient.getIndividuallyParentNestedWithPathClient("test-blob");
BlobProperties props = pathClient.getStandalone();

Copilot AI and others added 2 commits March 11, 2026 06:02
…ividuallyclient, individuallyparentclient)

Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Mar 11, 2026
@weidongxu-microsoft
Weidong Xu (weidongxu-microsoft) marked this pull request as ready for review March 11, 2026 06:31
@weidongxu-microsoft
Weidong Xu (weidongxu-microsoft) merged commit f26f9ed into http-client-java_upgrade-compiler Mar 11, 2026
1 check passed
@weidongxu-microsoft
Weidong Xu (weidongxu-microsoft) deleted the copilot/add-e2e-test-azure-http-specs-again branch March 11, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:java Issue for the Java client emitter: @typespec/http-client-java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants