Testing and monitoring best practices for app building
Best practices for evaluating apps built with AI.
Use the best practices in the following sections to monitor your apps for errors and ensure they are working as expected.
Use app testing
App testing lets the agent write and run tests that verify your app's behavior before you publish it to end users. Use the following practices to get the most from it:
- Keep Build with tests on. The agent writes or updates tests whenever it adds or changes behavior, and Retool sends failures back to the agent to fix. For apps without tests, turn on Build with tests in the Chat tab or the debug console.
- Ask for tests that cover critical flows. Request tests for flows where a failure is costly, such as approvals, payments, or permission checks. For example, "Add tests for the order approval flow."
- Prefer behavioral tests. Tests that check what a user sees and does survive refactors better than tests tied to implementation details. Ask for unit tests only for functions with their own logic, such as
calculateDiscount. - Don't weaken tests to make them pass. When a test fails, fix the app. Change a test's expectations only when the intended behavior changes, and say so in your prompt.
Use third-party packages
You can integrate a third-party package for error reporting or performance monitoring service into your app, such as those from Datadog or Sentry. Only frontend errors or logs will be reported; Retool blocks third-party packages from accessing your app's backend.
Retool's default Content Security Policy limits connect-src to 'self', which blocks packages from sending reports directly to a provider. Ask an admin to add the provider's intake origin to the connect-src directive.
Retool does not support out-of-the-box performance monitoring or error reporting with Datadog or Sentry for apps.