You can use createRoutesStub in data and framework modes. Please refer to the Testing Guide.
createRoutesStub