Skip to content

Add e2e-cli for E2E testing#142

Merged
MichaelGHSeg merged 3 commits into
mainfrom
add-e2e-cli
May 11, 2026
Merged

Add e2e-cli for E2E testing#142
MichaelGHSeg merged 3 commits into
mainfrom
add-e2e-cli

Conversation

@MichaelGHSeg

Copy link
Copy Markdown
Contributor

Summary

  • Adds e2e-cli/ — a .NET 10 console app that reads a JSON event sequence via --input, sends events through Segment.Analytics.Analytics, and outputs {"success": true/false, "sentBatches": N} to stdout
  • Supports all six event types: track, identify, page, screen, alias, group
  • Implements PlainHttpClientProvider / PlainHttpClient overriding SegmentURL to support http:// targets (the SDK always prepends https://)
  • Passes cdnHost from the input JSON so settings fetches go to the mock server rather than the real CDN
  • Uses InMemoryStorageProvider to avoid leftover files between test runs
  • Adds .github/workflows/e2e-tests.yml and publish-e2e-cli.yml
  • Restricts e2e-config.json to basic test suite

Test plan

  • dotnet e2e-cli/build/e2e-cli.dll --input '{"writeKey":"...","apiHost":"...","cdnHost":"...","sequences":[...]}' exits 0 and prints JSON
  • Basic E2E suite passes: cd sdk-e2e-tests && CLI_COMMAND="dotnet .../e2e-cli.dll" E2E_TEST_SUITES=basic npx vitest run
  • e2e-tests.yml workflow runs clean on CI

Comment thread e2e-cli/Program.cs
{
if (args[i] == "--input")
{
inputJson = args[i + 1];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could be out of bounds, if last thing --input with no arg?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the loop goes to <Length-1, so there should always be an argument left. The logic would have to be refactored if it had any non-argment flags but should be fine for this.

@MichaelGHSeg MichaelGHSeg merged commit 85f025e into main May 11, 2026
13 of 15 checks passed
@MichaelGHSeg MichaelGHSeg deleted the add-e2e-cli branch May 11, 2026 19:21
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.

2 participants