go.sh # Scripts to set up the environment and run the tests.
├── acceptance-tests # An acceptance testing framework.
├── mockserver # Used for stubbing the 3rd party API.
├── casa # A service containing the CASA account bounded context.
├── bff-web # A backend-for-frontend serving the web UI.
├── ui-web # Web UI.
└── ...
- python3
- pip3
- yarn
- wget
- java
- docker
- docker-compose
The directory to read and write Pact files (reset per acceptance test).
Starting with an acceptance test from the user's perspective.
- Write a specification in
./acceptance-tests/features
based on the user story and ACs. - Write the high level steps in
./acceptance-tests/steps
using a ubiquitous domain language. - Re-use or extend the drivers in
./acceptance-tests/drivers
to isolate the technical details. Use a web driver in./acceptance-tests/drivers/web
for the first step. - Start the UI. (
DISABLE_AUTH=true yarn run dev
) - Run the test and ensure that it fails. (
pytest --driver=web
)
At this point, there is no element for the test to interact with, so the test will fail.
- Test-drive the UI using
./ui-web/src/__tests__
. (e.g., new folder forbalance
if that's the feature). - Create the contract test between
ui-web
(consumer) andbff-web
(provider). (e.g. new describe block in ./ui-web/src/__tests__/web.consumer.test.js
) - Start the
bff-web
contract stub, e.g.PACT_FOLDER=<absolute-path-to>/ui-web/pacts PORT=8080 ./go.sh run_pact_stubs
. - Run the acceptance test again to smoke test the UI.
- Run the provider contract verification and see that it fails. (
./bff-web/src/test/kotlin/com/jago/ProviderContractTest.kt
) - Use
./acceptance-tests/drivers/api/bff_api.py
to implement the technical details in the acceptance test this time. - Satisfy the
ui-web
API contract expectations using TDD. (e.g. this could begin by adding a controller test in CasaResourceTest.kt). - Continue with component and unit tests until all the provider verification tests pass.
- Create the contract test between
bff-web
(consumer) andcasa
(provider). (./bff-web/src/test/kotlin/com/jago/CasaConsumerContractTest.kt
) - Start the
casa
API contract stub, e.g.PACT_FOLDER=<absolute-path-to>/bff-web/build/pacts PORT=8081 ./go.sh run_pact_stubs
. - Run the acceptance test for the BFF.
- Run the provider contract verification and see that it fails. (
e.g. ./casa/src/test/kotlin/contracts/ProviderContractTest.kt
) - Create a new endpoint to support the
bff-web
consumer contract expectation using TDD. - Set up the provider state if that was declared in the pact consumer contract.
- See the provider contract verification pass.
- Start the
casa
API. - Refer to
./acceptance-tests/drivers/api/casa_api.py
if the test requires data to be in the database. - Run the acceptance test for the
casa
API.