generator icon indicating copy to clipboard operation
generator copied to clipboard

[FEATURE] Add Microcks acceptance test suite for Dart WebSocket client

Open devxdh opened this issue 1 month ago • 3 comments

Why do we need this improvement?

Under packages/templates/clients/websocket/test/, we already have containerized Microcks acceptance test suites for JavaScript, Python, and Java (Quarkus). However, the Dart client currently only has integration snapshot tests and lacks an acceptance test suite running against real Microcks mocks.

Rule 11 in packages/README.md states: "Acceptance tests must be configured with Microcks". Right now, Dart is the only WebSocket client template without acceptance tests. When changes are made to generator core or the template components, we cannot automatically verify in CI whether the generated Dart client still successfully connects and exchanges valid messages with real WebSocket servers.

How will this change help?

  1. Parity: Brings the Dart client template to full test parity with JavaScript, Python, and Java acceptance test setups.
  2. Automated Verification: Automatically validates both inbound and outbound WebSocket message flows on every PR via the CI test matrix.
  3. Regression Prevention: Catches breaking changes or schema serialization bugs in the Dart client before they reach users.

Screenshots

No response

How could it be implemented/designed?

The implementation follows the established pattern of the existing JavaScript, Python, and Java acceptance tests:

  1. Test Project (packages/templates/clients/websocket/test/dart/):

    • Add pubspec.yaml with testing dependencies: test, web_socket_channel, and http.
    • Implement test/acceptance_test.dart using the generated HoppscotchEchoWebSocketClient:
      • Inbound test: Connect to ws://microcks-async-minion:8081 and assert that the client receives the expected timestamp message.
      • Outbound test: Start a local WebSocket server on port 8085, trigger a Microcks schema runner test (POST /api/tests), send a message with client.sendEchoMessage(), and assert that Microcks validates schema compliance.
    • Add .gitignore to keep .dart_tool/ and pubspec.lock untracked.
  2. Container Infrastructure (microcks-podman.yml):

    • Add a tester-dart container service using the official docker.io/dart:stable image under the test-dart profile.
    • Expose port 8085 so Microcks can connect to the test server running inside the container.
  3. CI Pipeline (pr-testing-with-test-project.yml):

    • Add dart to matrix.language: [js, py, java, dart].
  4. Documentation (packages/templates/clients/websocket/test/README.md):

    • Document the --profile test-dart command for running Dart acceptance tests locally.

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

Yes I am willing to submit a PR!

devxdh avatar Nov 02 '26 17:11 devxdh

Above PRs were deliberately raised to verify the working prototype

I've implemented the test and verified it in CI on my fork first:

  • Fork PR: https://github.com/devxdh/asyncapi-generator/pull/3
  • Passing CI Run (Acceptance tests (dart)): https://github.com/devxdh/asyncapi-generator/actions/runs/41496139554/job/125451644747?pr=3

cc @Adi-204 in case you'd like to take a look when you have a moment. Just sharing the run and changes here to show it's already tested and working cleanly.

hope this helps in evaluating the issue :)

devxdh avatar Nov 02 '26 18:11 devxdh

/approve

@devxdh, no need to create PRs from a fork going forward! You can directly create a PR here and follow the usual review process.

Adi-204 avatar Nov 05 '26 16:11 Adi-204

👋 Thanks for your patience. This issue has been reviewed and is ready to be worked on.

Before you start:

  • Comment below to let others know you're working on it (avoids duplicate work)
  • Read our CONTRIBUTING.md if you haven't already
  • Fork the repo, create a feature branch, and open a draft PR early

Approved by @Adi-204

asyncapi-bot avatar Nov 05 '26 16:11 asyncapi-bot