Run tests, diagnose failures, and fix bugs with your AI agent
Your AI agent can run your test suite, read the results, understand why tests failed, and fix the code. It doesn’t just report “3 tests failed” - it traces each failure to the root cause and determines whether the bug is in the production code or the test itself.
The agent will execute the full test suite, identify any failures, trace each one to its root cause, and fix the code. It re-runs to confirm everything passes.
Run only the CheckoutTests and fix whatever is failing.
The agent filters the run to just that class, identifies failures, and fixes them. This is useful when you’re working on a specific feature and don’t want to wait for the full suite.
Run CheckoutTests.testApplyDiscountCode. If it fails, figure outwhether the bug is in the test or the implementation and fix it.
You can go as specific as a single test method. The agent will run it, read the assertion error, compare the test expectation against the implementation, and fix whichever side has the bug.
Run tests. If anything fails, figure out why and fix it.
The agent runs the suite, identifies failures, and for each one, reads the test and the production code to understand what went wrong. It applies fixes (to whichever side has the bug) and re-runs to confirm everything passes.
I just refactored the PaymentService. Run the tests for that moduleand make sure nothing broke. Fix any regressions.
The agent will find the relevant test files, run them, and if your refactor broke something, it traces exactly which behavior changed and fixes the code to make the tests pass again.
Run all tests related to authentication. Identify any gaps in coverageand write tests for any untested paths.
The agent will discover test files matching the area (by name or by searching for relevant imports), run them, and analyze what’s covered. If it finds gaps - like missing tests for the password reset flow or error handling - it writes the missing tests and runs them to confirm they pass.
I just added a CartManager class. Write unit tests for the addItem,removeItem, and calculateTotal methods. Make sure they all pass.
The agent will read the CartManager implementation, write tests covering the happy path and edge cases (empty cart, duplicate items, negative quantities), add them to the test target, and run the suite to verify they all pass.
CheckoutTests.testConcurrentAddToCart fails intermittently.Run it 5 times, find the root cause, and fix it.
The agent will run the test multiple times, compare the outputs, and look for patterns: race conditions, timing dependencies, shared state leaking between runs. Once it identifies the root cause, it fixes the underlying issue and re-runs to confirm the test is stable.
Run the UI tests on iPad Pro. Make sure all layout assertions passon the larger screen size.
The agent will resolve the iPad simulator, boot it if needed, and run the UI test suite. This catches layout issues that only appear on different screen sizes. If any tests fail, it traces and fixes the layout problems.
Name your tests clearly. Tests like testCalculateTotal_withDiscountCode_appliesPercentageOff give the agent immediate context about the expected behavior without reading the implementation.
Tell the agent which module or area to focus on. “Run the payment tests” is faster and more focused than “run all tests” when you’re iterating on a specific feature.
Ask the agent to explain, not just fix. “Explain why this test fails” often gives you better insight than “fix the failing test”, especially when the root cause might be a design issue rather than a simple bug.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"FlowDeck","description":"Flow","colors":{"primary":"#FF4407","light":"#FF4407","dark":"#FF4407"},"logo":{"light":"https://mintcdn.com/flowdeck/1mH37I1K6jA8b08h/images/Logo-BW-WhiteBg.png?fit=max\u0026auto=format\u0026n=1mH37I1K6jA8b08h\u0026q=85\u0026s=6130dfa97a692bdca791c30dd99fa3d7","dark":"https://mintcdn.com/flowdeck/1mH37I1K6jA8b08h/images/Logo-BW-BlackBg.png?fit=max\u0026auto=format\u0026n=1mH37I1K6jA8b08h\u0026q=85\u0026s=ca0c89fed26da5b5624b97fff0dd0211","href":"https://flowdeck.studio"},"favicon":{"light":"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePicture.png?fit=max\u0026auto=format\u0026n=WYbJRp5-oO6kcB2T\u0026q=85\u0026s=a542d6694e7f4b658d7283da721205c7","dark":"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePictureDark.png?fit=max\u0026auto=format\u0026n=WYbJRp5-oO6kcB2T\u0026q=85\u0026s=daf8cce9606d106c12c4640b9e0fe852"},"api":{},"appearance":{"default":"dark"},"background":{"color":{"light":"#FFFFFF","dark":"#000000"}},"navbar":{"primary":{"type":"button","label":"Get FlowDeck","href":"https://flowdeck.studio/"}},"search":{"prompt":"Search FlowDeck docs..."},"seo":{"indexing":"navigable"},"metadata":{"timestamp":false},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"flowdeck","hasAudioNarration":false,"actualSubdomain":"flowdeck","customDomains":["docs.flowdeck.studio"],"gitSource":{"type":"github","owner":"flowdeck-dev","repo":"flowdeck","deployBranch":"stable","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":"","_id":"6ad9380a8934a879d89251bf"},"chroma":{"liveDeploymentHistoryId":"6ad9388bec81d57a48f60f02","collectionId":"b792c53e-f802-443d-856b-9e8d47d66db3","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad9388bec81d57a48f60f02"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ad93afc4b43520dc7b19f1e","clientVersion":"0.0.3964","searchFilterCounts":[{"language":"default","tag":"FlowDeck CLI","count":74},{"language":"default","tag":"Command Reference","count":37},{"language":"default","tag":"FlowDeck for Mac","count":20},{"language":"default","tag":"Simulator Commands","count":11},{"language":"default","tag":"Interactive Mode (TUI)","count":11},{"language":"default","tag":"Core Actions","count":10},{"language":"default","tag":"IDE Features","count":10},{"language":"default","tag":"Core Features","count":9},{"language":"default","tag":"FlowDeck for AI","count":6},{"language":"default","tag":"Advanced","count":6}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"privacy":{"consentBanner":{"enabled":false}},"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"cli/ai-agents/testing","slug":"/cli/ai-agents/testing","pageMetadata":{"title":"Testing with AI","description":"Run tests, diagnose failures, and fix bugs with your AI agent","href":"/cli/ai-agents/testing"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Run tests, diagnose failures, and fix bugs with your AI agent\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,hr:`hr`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Your AI agent can run your test suite, read the results, understand why tests failed, and fix the code. It doesn’t just report “3 tests failed” - it traces each failure to the root cause and determines whether the bug is in the production code or the test itself.`}),`\n`,_jsx(Heading,{level:`2`,id:`how-the-agent-handles-test-failures`,children:`How the agent handles test failures`}),`\n`,_jsx(_components.p,{children:`When a test fails, the agent doesn’t stop at the error message. It:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Reads the full test output to identify which tests failed and why`}),`\n`,_jsx(_components.li,{children:`Opens the failing test file and reads the test expectations`}),`\n`,_jsx(_components.li,{children:`Opens the code under test and reads the implementation`}),`\n`,_jsx(_components.li,{children:`Determines whether the test expectation is wrong or the implementation has a bug`}),`\n`,_jsx(_components.li,{children:`Applies the fix and re-runs the tests to confirm`}),`\n`]}),`\n`,_jsx(_components.p,{children:`This means you can hand off a red test suite and come back to a green one.`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`what-you-can-ask`,children:`What you can ask`}),`\n`,_jsx(Heading,{level:`3`,id:`run-all-tests`,children:`Run all tests`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run my tests. If anything fails, fix it.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent will execute the full test suite, identify any failures, trace each one to its root cause, and fix the code. It re-runs to confirm everything passes.`}),`\n`,_jsx(Heading,{level:`3`,id:`run-a-specific-test-class-or-method`,children:`Run a specific test class or method`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run only the CheckoutTests and fix whatever is failing.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent filters the run to just that class, identifies failures, and fixes them. This is useful when you’re working on a specific feature and don’t want to wait for the full suite.`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run CheckoutTests.testApplyDiscountCode. If it fails, figure out`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`whether the bug is in the test or the implementation and fix it.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`You can go as specific as a single test method. The agent will run it, read the assertion error, compare the test expectation against the implementation, and fix whichever side has the bug.`}),`\n`,_jsx(Heading,{level:`3`,id:`fix-failing-tests`,children:`Fix failing tests`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run tests. If anything fails, figure out why and fix it.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent runs the suite, identifies failures, and for each one, reads the test and the production code to understand what went wrong. It applies fixes (to whichever side has the bug) and re-runs to confirm everything passes.`}),`\n`,_jsx(Heading,{level:`3`,id:`run-tests-after-a-code-change`,children:`Run tests after a code change`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`I just refactored the PaymentService. Run the tests for that module`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`and make sure nothing broke. Fix any regressions.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent will find the relevant test files, run them, and if your refactor broke something, it traces exactly which behavior changed and fixes the code to make the tests pass again.`}),`\n`,_jsx(Heading,{level:`3`,id:`audit-test-coverage-for-a-feature-area`,children:`Audit test coverage for a feature area`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run all tests related to authentication. Identify any gaps in coverage`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`and write tests for any untested paths.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent will discover test files matching the area (by name or by searching for relevant imports), run them, and analyze what’s covered. If it finds gaps - like missing tests for the password reset flow or error handling - it writes the missing tests and runs them to confirm they pass.`}),`\n`,_jsx(Heading,{level:`3`,id:`write-tests-for-new-code`,children:`Write tests for new code`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`I just added a CartManager class. Write unit tests for the addItem,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`removeItem, and calculateTotal methods. Make sure they all pass.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent will read the CartManager implementation, write tests covering the happy path and edge cases (empty cart, duplicate items, negative quantities), add them to the test target, and run the suite to verify they all pass.`}),`\n`,_jsx(Heading,{level:`3`,id:`fix-a-flaky-test`,children:`Fix a flaky test`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`CheckoutTests.testConcurrentAddToCart fails intermittently.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run it 5 times, find the root cause, and fix it.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent will run the test multiple times, compare the outputs, and look for patterns: race conditions, timing dependencies, shared state leaking between runs. Once it identifies the root cause, it fixes the underlying issue and re-runs to confirm the test is stable.`}),`\n`,_jsx(Heading,{level:`3`,id:`run-tests-on-a-different-simulator`,children:`Run tests on a different simulator`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Run the UI tests on iPad Pro. Make sure all layout assertions pass`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`on the larger screen size.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The agent will resolve the iPad simulator, boot it if needed, and run the UI test suite. This catches layout issues that only appear on different screen sizes. If any tests fail, it traces and fixes the layout problems.`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`tips-for-better-results`,children:`Tips for better results`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Name your tests clearly.`}),` Tests like `,_jsx(_components.code,{children:`testCalculateTotal_withDiscountCode_appliesPercentageOff`}),` give the agent immediate context about the expected behavior without reading the implementation.`]})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Tell the agent which module or area to focus on.`}),` “Run the payment tests” is faster and more focused than “run all tests” when you’re iterating on a specific feature.`]})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Ask the agent to explain, not just fix.`}),` “Explain why this test fails” often gives you better insight than “fix the failing test”, especially when the root cause might be a design issue rather than a simple bug.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Testing with AI","description":"Run tests, diagnose failures, and fix bugs with your AI agent","href":"/cli/ai-agents/testing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"How the agent handles test failures","slug":"how-the-agent-handles-test-failures","depth":2,"children":[]},{"title":"What you can ask","slug":"what-you-can-ask","depth":2,"children":[{"title":"Run all tests","slug":"run-all-tests","depth":3,"children":[]},{"title":"Run a specific test class or method","slug":"run-a-specific-test-class-or-method","depth":3,"children":[]},{"title":"Fix failing tests","slug":"fix-failing-tests","depth":3,"children":[]},{"title":"Run tests after a code change","slug":"run-tests-after-a-code-change","depth":3,"children":[]},{"title":"Audit test coverage for a feature area","slug":"audit-test-coverage-for-a-feature-area","depth":3,"children":[]},{"title":"Write tests for new code","slug":"write-tests-for-new-code","depth":3,"children":[]},{"title":"Fix a flaky test","slug":"fix-a-flaky-test","depth":3,"children":[]},{"title":"Run tests on a different simulator","slug":"run-tests-on-a-different-simulator","depth":3,"children":[]}]},{"title":"Tips for better results","slug":"tips-for-better-results","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"flowdeck","siteName":"FlowDeck","title":"Testing with AI - FlowDeck","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-06T11:54:39.532Z","originalFileLocation":"cli/ai-agents/testing.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Run tests, diagnose failures, and fix bugs with your AI agent\">\u003cmeta data-mint-head name=\"application-name\" content=\"FlowDeck\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePicture.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=a542d6694e7f4b658d7283da721205c7\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePicture.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=a542d6694e7f4b658d7283da721205c7\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePicture.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=a542d6694e7f4b658d7283da721205c7\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/png\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePicture.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=a542d6694e7f4b658d7283da721205c7\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePictureDark.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=daf8cce9606d106c12c4640b9e0fe852\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePictureDark.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=daf8cce9606d106c12c4640b9e0fe852\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/png\" href=\"https://mintcdn.com/flowdeck/WYbJRp5-oO6kcB2T/images/ProfilePictureDark.png?fit=max\u0026amp;auto=format\u0026amp;n=WYbJRp5-oO6kcB2T\u0026amp;q=85\u0026amp;s=daf8cce9606d106c12c4640b9e0fe852\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Testing with AI - FlowDeck\">\u003cmeta data-mint-head property=\"og:description\" content=\"Run tests, diagnose failures, and fix bugs with your AI agent\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"FlowDeck\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.flowdeck.studio/cli/ai-agents/testing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://flowdeck.mintlify.app/_mintlify/api/og/v2?division=FlowDeck+for+AI\u0026amp;title=Testing+with+AI\u0026amp;description=Run+tests%2C+diagnose+failures%2C+and+fix+bugs+with+your+AI+agent\u0026amp;theme=d4ee9523425cdf7b8cb44c77\u0026amp;signature=6b8db5ba88aa15642fa746803cb95372e1534be04cb8325b1d5b7b25bb9e8094\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Testing with AI - FlowDeck\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Run tests, diagnose failures, and fix bugs with your AI agent\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://flowdeck.mintlify.app/_mintlify/api/og/v2?division=FlowDeck+for+AI\u0026amp;title=Testing+with+AI\u0026amp;description=Run+tests%2C+diagnose+failures%2C+and+fix+bugs+with+your+AI+agent\u0026amp;theme=d4ee9523425cdf7b8cb44c77\u0026amp;signature=6b8db5ba88aa15642fa746803cb95372e1534be04cb8325b1d5b7b25bb9e8094\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/flowdeck/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"FlowDeck\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FF4407\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.flowdeck.studio/cli/ai-agents/testing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/cli/ai-agents/testing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.flowdeck.studio/#organization\",\"name\":\"FlowDeck\",\"url\":\"https://docs.flowdeck.studio\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/flowdeck/1mH37I1K6jA8b08h/images/Logo-BW-WhiteBg.png?fit=max\u0026auto=format\u0026n=1mH37I1K6jA8b08h\u0026q=85\u0026s=6130dfa97a692bdca791c30dd99fa3d7\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.flowdeck.studio#website\",\"name\":\"FlowDeck\",\"url\":\"https://docs.flowdeck.studio\",\"publisher\":{\"@id\":\"https://docs.flowdeck.studio/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.flowdeck.studio/cli/ai-agents/testing#webpage\",\"url\":\"https://docs.flowdeck.studio/cli/ai-agents/testing\",\"name\":\"Testing with AI\",\"description\":\"Run tests, diagnose failures, and fix bugs with your AI agent\",\"dateModified\":\"2026-04-06T11:54:39.532Z\",\"isPartOf\":{\"@id\":\"https://docs.flowdeck.studio#website\"},\"breadcrumb\":{\"@id\":\"https://docs.flowdeck.studio/cli/ai-agents/testing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.flowdeck.studio/cli/ai-agents/testing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"FlowDeck for AI\",\"item\":\"https://docs.flowdeck.studio/cli/ai-agents\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Testing with AI\",\"item\":\"https://docs.flowdeck.studio/cli/ai-agents/testing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.flowdeck.studio/cli/ai-agents/testing#article\",\"headline\":\"Testing with AI\",\"name\":\"Testing with AI\",\"description\":\"Run tests, diagnose failures, and fix bugs with your AI agent\",\"url\":\"https://docs.flowdeck.studio/cli/ai-agents/testing\",\"mainEntityOfPage\":{\"@id\":\"https://docs.flowdeck.studio/cli/ai-agents/testing#webpage\"},\"dateModified\":\"2026-04-06T11:54:39.532Z\",\"publisher\":{\"@id\":\"https://docs.flowdeck.studio/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.flowdeck.studio#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"FlowDeck\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"FlowDeck","nav":{"global":null,"tabs":[{"tab":"FlowDeck for Mac","pages":[{"title":"FlowDeck for Mac","href":"/macos/introduction"}]},{"tab":"FlowDeck CLI","groups":[{"group":"Overview","pages":[{"title":"What is FlowDeck CLI?","href":"/introduction"},{"title":"Installation","href":"/cli/install"},{"title":"Requirements","href":"/requirements"},{"title":"FlowDeck for Mac vs FlowDeck CLI","href":"/comparison"}]},{"group":"FlowDeck for AI","pages":[{"title":"Give Your Agent Eyes and Hands","href":"/cli/ai-agents"},{"title":"UI Automation with AI","href":"/cli/ai-agents/ui-automation"},{"title":"Design to Code with AI","description":"Turn mockups into SwiftUI views with AI-driven implementation and visual verification","href":"/cli/ai-agents/ui-implementation"},{"title":"Testing with AI","href":"/cli/ai-agents/testing"},{"title":"Building and Running with AI","description":"Build apps, stream logs, fix errors, and debug runtime issues with your AI agent","href":"/cli/ai-agents/building"},{"title":"Infrastructure with AI","href":"/cli/ai-agents/infrastructure"}]},{"group":"Interactive Mode (TUI)","pages":[{"title":"Introduction","href":"/cli/interactive"},{"title":"Working with Projects","href":"/cli/interactive/working-with-projects"},{"title":"Build, Run \u0026 Test","href":"/cli/interactive/build-run-test"},{"title":"Build Settings","href":"/cli/interactive/build-settings"},{"title":"Manage Devices and Simulators","href":"/cli/interactive/tools-settings/devices-simulators"},{"title":"Project Tools","href":"/cli/interactive/tools-settings/project-commands"},{"title":"Manage Swift Packages","href":"/cli/interactive/tools-settings/swift-packages"},{"title":"FlowDeck Settings","href":"/cli/interactive/tools-settings/flowdeck-settings"},{"title":"Support","href":"/cli/interactive/tools-settings/help-support"},{"title":"Troubleshooting","href":"/cli/interactive/help"},{"title":"Command Reference","href":"/cli/interactive/shortcuts"}]},{"group":"Core Features","pages":[{"title":"Create a Project","href":"/cli/create-project"},{"title":"Building \u0026 Running","href":"/cli/building"},{"title":"Testing","href":"/cli/testing"},{"title":"UI Automation","href":"/cli/ui-automation"},{"title":"macOS Automation","href":"/cli/macos-automation"},{"group":"Simulators \u0026 Devices","pages":[{"title":"Managing Simulators","href":"/cli/simulators"},{"title":"Runtimes","href":"/cli/simulators/runtimes"},{"title":"Devices","href":"/cli/devices"}]},{"title":"Log Streaming","href":"/cli/logging"}]},{"group":"Command Reference","pages":[{"title":"Command Overview","href":"/cli/commands/overview"},{"group":"Core Actions","pages":[{"title":"Config","href":"/cli/commands/config"},{"title":"Context","href":"/cli/commands/context"},{"title":"Build","href":"/cli/commands/build"},{"title":"Run","href":"/cli/commands/run"},{"title":"Test Commands","href":"/cli/commands/test"},{"title":"Clean","href":"/cli/commands/clean"},{"title":"Logs","href":"/cli/commands/logs"},{"title":"Stop","href":"/cli/commands/stop"},{"title":"Uninstall","href":"/cli/commands/uninstall"},{"title":"Apps","href":"/cli/commands/apps"},{"title":"Activity","href":"/cli/commands/activity"}]},{"group":"Project Tools","pages":[{"title":"Create Project","href":"/cli/commands/project/create"},{"title":"Schemes","href":"/cli/commands/project/schemes"},{"title":"Build Configurations","href":"/cli/commands/project/configs"},{"title":"Swift Packages","href":"/cli/commands/project/packages"},{"title":"Provisioning Profiles","href":"/cli/commands/project/sync-profiles"}]},{"group":"App Store \u0026 TestFlight","pages":[{"title":"App Store Connect Account","href":"/cli/commands/ship/account"},{"title":"TestFlight","href":"/cli/commands/ship/testflight"}]},{"group":"Simulator Commands","pages":[{"title":"Listing","href":"/cli/commands/simulator/list"},{"title":"Lifecycle","href":"/cli/commands/simulator/lifecycle"},{"title":"Management","href":"/cli/commands/simulator/management"},{"title":"Runtimes","href":"/cli/commands/simulator/runtimes"},{"title":"Location","href":"/cli/commands/simulator/location"},{"title":"Media","href":"/cli/commands/simulator/media"},{"title":"Record","href":"/cli/commands/simulator/record"},{"title":"Frames","href":"/cli/commands/simulator/frames"},{"title":"Orientation","href":"/cli/commands/simulator/orientation"},{"title":"Pose","href":"/cli/commands/simulator/pose"},{"title":"Hardware and Appearance","href":"/cli/commands/simulator/hardware"}]},{"title":"UI Automation","href":"/cli/commands/ui/automation"},{"title":"macOS UI Automation","href":"/cli/commands/ui/mac-automation"},{"title":"Device Commands","href":"/cli/commands/device"},{"title":"Apps","href":"/cli/commands/apps"},{"title":"AI Agent Skills","href":"/cli/commands/ai"},{"title":"License","href":"/cli/commands/license"},{"title":"Update","href":"/cli/commands/update"},{"title":"MCP","href":"/cli/commands/mcp"}]},{"group":"Advanced","pages":[{"title":"Automation \u0026 Scripting","href":"/cli/automation"},{"title":"Dry-Run Previews","href":"/cli/dry-run"},{"title":"CI/CD Integration","href":"/cli/ci-cd"},{"title":"Xcodebuild Arguments","href":"/cli/xcodebuild-args"},{"title":"App Launch Settings","href":"/cli/app-launch-settings"},{"title":"Configuration File","href":"/cli/configuration-file"}]},{"group":"Support","pages":[{"title":"Getting Help","href":"/support"}]}]}]},"title":"Testing with AI - FlowDeck","buildId":"dpl_HcHmUS6i3UwswnTHJUEdcTtwfdTQ","deploymentId":"dpl_HcHmUS6i3UwswnTHJUEdcTtwfdTQ","dynamics":[],"chunks":[]}