Overview
Functional tests verify how several application components work together for a request. Depending on the project, tests may invoke the framework kernel or send HTTP requests to a test server.
Define observable contracts
Check status codes, response headers, content type, redirects and important response fields. For authenticated routes, verify both allowed and denied access.
Isolate external dependencies
Use a test mail transport, fake payment gateway or controlled API server. Tests should not send real customer email or charge real payment methods.
Cover negative paths
Test malformed JSON, missing parameters, invalid CSRF tokens, expired sessions and inaccessible resources. Error paths are part of the application's public behavior.
Keep the environment safe
Use test credentials and test storage paths. Ensure test configuration cannot accidentally load production secrets or connect to a production database.