This refactoring provided enough encapsulation to allow me to refactor the tests for the workspace endpoint to work with both BrowserSpys (an in-memory test double) and BrowserFakes (an actual server running as a background process) without further modification.
This might open the door to future tests with an actual broadway daemon in the background as an acceptance test.
Whenever a test is running with a BrowserFake it is automatically marked as an integration test.
Therefore, running the tests with not integration is significantly faster now and allows for faster iteration.
For users of pdm, like myself, I have added extra script commands to pyproject.toml to either run only unit or both unit and integration tests.
Unit tests only: pdm run test
Unit and integration tests: pdm run test-integration
I refactored the
OcrdBrowser
s to use the interface described in #14This refactoring provided enough encapsulation to allow me to refactor the tests for the workspace endpoint to work with both
BrowserSpy
s (an in-memory test double) andBrowserFake
s (an actual server running as a background process) without further modification. This might open the door to future tests with an actualbroadway
daemon in the background as an acceptance test. Whenever a test is running with aBrowserFake
it is automatically marked as an integration test. Therefore, running the tests withnot integration
is significantly faster now and allows for faster iteration. For users ofpdm
, like myself, I have added extra script commands topyproject.toml
to either run only unit or both unit and integration tests.Unit tests only:
pdm run test
Unit and integration tests:pdm run test-integration