Replies: 5 comments 3 replies
-
|
@bernata lets move the discussion here |
Beta Was this translation helpful? Give feedback.
-
Testing the clientThe typescript client can be tested in the following ways:
The main developer experience goal of a unit test is you can open your IDE and run the test. No "unreasonable" setup needed. Reasonable setup includes running npm install. Unreasonable setup [for a unit test] is installing docker/podman to run the java server. For unit tests, we prefer option 2 [simulated environment]. It runs the most code that resembles what runs in a production environment. It is simple to execute from the IDE, and from the command line. It is also easy to debug in the IDE. And most importantly it executes the seams [integration] between components. These unit tests are great for testing interesting failure paths like the connection to the server timing out, server returning an error, browser failing to create credentials, etc... And at the same time doesn't bind the tests too tightly to the implementation [i.e. we don't check if a specific product function was called in a certain way]. Option 1 is still very good and can be very useful for testing difficult-to-simulate error cases or even unique success cases. Option 3: For this project, we treat integration and end-to-end to be the same meaning you run the real java server. You can run the client in a simple nodejs environment [closer to an integration test] or a headless browser [end-to-end test]. This test infrastructure gives the best signal for working in production, but also is hardest to setup, slowest to run, difficult/impossible to orchestrate specific codepaths, and can be cumbersome to step-through-debug across client+server. What is a simulated enviornment? @wolpert how's this for a start? |
Beta Was this translation helpful? Give feedback.
-
|
It's a good premise, though I'm struggling with how much of a 'mock' server do we make? In other words, at what point do we just publish a swagger spec and say 'Mock this, Claude'. Are we there yet, @bernata? |
Beta Was this translation helpful? Give feedback.
-
|
@bernata in general with using mock server for unit tests, and we still will run e2e tests in the CI... that's all normal. It's about how we get there. |
Beta Was this translation helpful? Give feedback.
-
|
Eh... apparently Claude says the path you are doing is the best path. The mock service I was thinking wouldn't get us where it needs to be. Ask claude to write an ADR on your next PR Carry on, wayward son. Carry on. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Starting a thread for how to best test the typescript client.
Beta Was this translation helpful? Give feedback.
All reactions