{"schemaVersion":"1.0","source":"The Workflow Finder","sourceUrl":"https://www.theworkflowfinder.com","license":"Free to use with attribution and a link to the cited page","generated":"2026-08-28","workflow":{"title":"Write Automated Tests for an Untested Codebase","slug":"write-automated-tests-for-existing-code","url":"https://www.theworkflowfinder.com/workflows/write-automated-tests-for-existing-code","description":"Add meaningful test coverage to legacy or untested code in a single focused session, without reading every line first.","difficulty":"Intermediate","timeEstimate":"2–4 hrs depending on codebase size","schemaDuration":"PT3H","expectedResult":"A test suite with 60%+ coverage on your core functions, with unit and integration tests running in CI.","tags":["Development","Testing","Coding"]},"steps":[{"position":1,"title":"Analyze the Codebase Structure","instructions":"Open the project in Cursor and ask it to map the codebase, identify the key modules, public functions, and external dependencies that matter most to test.","input":"Workflow inputs: the topic, goal, or raw materials the user is starting from.","output":"Handoff artifact consumed by Step 2 (\"Prioritize Test Targets\").","toolSlots":[{"slug":"cursor","name":"Cursor","url":"https://www.theworkflowfinder.com/tools/cursor","category":"Coding","pricing":"freemium","capabilities":["Code generation","Code review","Debugging assistance"]}]},{"position":2,"title":"Prioritize Test Targets","instructions":"Ask Claude to rank which functions need tests most urgently based on business risk, complexity, and how often they change, focus on the top 20.","input":"Output of Step 1 (\"Analyze the Codebase Structure\").","output":"Handoff artifact consumed by Step 3 (\"Generate Unit Tests\").","toolSlots":[{"slug":"claude","name":"Claude","url":"https://www.theworkflowfinder.com/tools/claude","category":"Writing","pricing":"freemium","capabilities":["Long-form writing","Code generation","Web research"],"hasApi":true}]},{"position":3,"title":"Generate Unit Tests","instructions":"For each priority function, use GitHub Copilot inside your IDE to generate unit tests. Review each test to ensure it covers edge cases, not just the happy path.","input":"Output of Step 2 (\"Prioritize Test Targets\").","output":"Handoff artifact consumed by Step 4 (\"Write Integration Tests\").","toolSlots":[{"slug":"github-copilot","name":"GitHub Copilot","url":"https://www.theworkflowfinder.com/tools/github-copilot","category":"Coding","pricing":"paid","capabilities":["Code generation","Code review","Debugging assistance"]},{"slug":"cursor","name":"Cursor","url":"https://www.theworkflowfinder.com/tools/cursor","category":"Coding","pricing":"freemium","capabilities":["Code generation","Code review","Debugging assistance"]}]},{"position":4,"title":"Write Integration Tests","instructions":"Use Cursor to write integration tests for the critical user paths, the sequences of function calls that deliver core product value.","input":"Output of Step 3 (\"Generate Unit Tests\").","output":"Handoff artifact consumed by Step 5 (\"Fix Failures and Set Up CI\").","toolSlots":[{"slug":"cursor","name":"Cursor","url":"https://www.theworkflowfinder.com/tools/cursor","category":"Coding","pricing":"freemium","capabilities":["Code generation","Code review","Debugging assistance"]}]},{"position":5,"title":"Fix Failures and Set Up CI","instructions":"Run the test suite, fix any failures by asking Cursor to explain and correct them, then set up a GitHub Actions workflow using Copilot to run tests on every PR.","input":"Output of Step 4 (\"Write Integration Tests\").","output":"Final workflow output: A test suite with 60%+ coverage on your core functions, with unit and integration tests running in CI.","toolSlots":[{"slug":"cursor","name":"Cursor","url":"https://www.theworkflowfinder.com/tools/cursor","category":"Coding","pricing":"freemium","capabilities":["Code generation","Code review","Debugging assistance"]},{"slug":"github-copilot","name":"GitHub Copilot","url":"https://www.theworkflowfinder.com/tools/github-copilot","category":"Coding","pricing":"paid","capabilities":["Code generation","Code review","Debugging assistance"]}]}]}