- Start LocalStack, loading the Mock Configuration File
LOCALSTACK_SFN_MOCK_CONFIG=/tmp/MockConfigFile.json localstack start --volume $PWD/MockConfigFi
le.json:/tmp/MockConfigFile.json- Deploy the application
cdklocal bootstrap
cdklocal deploy --require-approval=never - Invoke the state machine, specifying the test case name using a special ARN suffix:
awslocal stepfunctions start-execution \
--state-machine arn:aws:states:us-east-1:000000000000:stateMachine:MyStateMachine#BaseCase \
--input '{"name": "John", "surname": "smith"}' \
--name "MockExecutionBaseCase" --region us-east-1BaseCase) must match the name of the test case in MockConfigFile.json.
Otherwise, LocalStack will try to invoke a real Lambda function, which does not exist!
📌 See Run Test Cases with Mocked Integrations in the LocalStack documentation.