> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Test 8 Untested Modules in One Night

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Test 8 Untested Modules in One Night" description="Launch 8 parallel Devin sessions overnight — each one writes unit tests for a different low-coverage module and opens a PR by morning." prompt="Run our test coverage report, find the 8 modules below 50% line coverage, and start a batch of parallel Devin sessions — one per module — each using our test-writing playbook to bring coverage above 80%. Open a separate PR for each module." category="Devin Optimization" features="Advanced, Playbooks" agent="advanced" intent="batch" />

<div className="uc-detail-wrapper">
  <Tip>Don't want to set this up manually? Paste a link to this page into a Devin session and ask it to set everything up for you.</Tip>

  <Steps>
    <Step title="Create a test-writing playbook">
      Your e-commerce monorepo has 30+ modules but only a handful have meaningful test coverage. You want to go from 44% overall coverage to 80% — starting with the 8 worst offenders. Before launching parallel sessions, you need a [playbook](/product-guides/creating-playbooks) that ensures all 8 sessions write tests the same way.

      Ask Devin to create the playbook for you — just describe your testing conventions in any session:

      <PromptBlock agent="advanced" intent="create">
        ```txt Create a test-writing playbook theme={null}
        Create a playbook for writing unit tests in our monorepo. It should enforce:
        1. Use Vitest with TypeScript. Import from `vitest`.
        2. Follow the AAA pattern (Arrange, Act, Assert).
        3. Mock external dependencies — never call real APIs, databases, or third-party services.
        4. Use test helpers from `src/test/helpers.ts` (e.g., `createMockUser()`, `setupTestDB()`).
        5. Place test files at `{module}/__tests__/{filename}.test.ts`.
        6. Cover success paths, error paths, and edge cases for every exported function.
        7. Run `npm test -- --coverage --reporter=json` and verify the module exceeds 80% line coverage.
        8. Open a PR with the new tests. Include the before/after coverage numbers in the PR description.
        ```
      </PromptBlock>

      This playbook becomes the shared instruction set for every parallel session. You can also add [Knowledge](/product-guides/knowledge) entries about your test utilities, mocking patterns, or any project-specific quirks (e.g., "always call `resetMocks()` in `afterEach`").
    </Step>

    <Step title="Launch 8 parallel sessions at 6 PM">
      At the end of your workday, open a new Devin session from the [Devin home page](https://app.devin.ai/?utm_source=docs\&utm_medium=use-case-gallery) and describe the batch task.

      1. Select your test-writing playbook from the dropdown
      2. Describe the task in the prompt:

      <PromptBlock agent="advanced" intent="batch">
        ```txt Overnight test coverage batch — 8 modules theme={null}
        Run `npm run test:coverage` against our repo. Identify the 8 modules
        with the lowest line coverage (skip anything under src/generated/).

        For each module, start a parallel Devin session using the selected playbook.
        Each session should:
        - Read the module's source code and any existing tests
        - Write new unit tests to bring line coverage above 80%
        - Run the full test suite to confirm nothing breaks
        - Open a PR with the new test files and a before/after coverage summary
        ```
      </PromptBlock>

      3. Review the proposed sessions — Devin lists each module with its current coverage and confirms which sessions it will create:

      ```
      Proposed sessions (8 modules, all below 50% coverage):
        1. src/services/PaymentService — 31% coverage
        2. src/services/UserService — 38% coverage
        3. src/api/routes/billing — 42% coverage
        4. src/middleware/auth — 44% coverage
        5. src/services/NotificationSvc — 47% coverage
        6. src/components/Checkout — 49% coverage
        7. src/utils/validation — 51% coverage
        8. src/services/SearchService — 53% coverage

      Start 8 parallel sessions? (y/n)
      ```

      4. Approve the batch and close your laptop. All 8 sessions launch simultaneously on separate Devin machines, each following your playbook independently.
    </Step>

    <Step title="Wake up to 8 PRs">
      By morning, each session has finished and opened its own PR. You'll see 8 PRs in your repository, each containing new test files and a coverage summary:

      ```
      Module                       | Before | After  | PR     | Status
      -----------------------------|--------|--------|--------|--------
      src/services/PaymentService  |  31%   |  87%   | #412   | Ready
      src/services/UserService     |  38%   |  84%   | #413   | Ready
      src/api/routes/billing       |  42%   |  91%   | #414   | Ready
      src/middleware/auth           |  44%   |  82%   | #415   | Ready
      src/services/NotificationSvc |  47%   |  85%   | #416   | Ready
      src/components/Checkout      |  49%   |  83%   | #417   | Ready
      src/utils/validation         |  51%   |  93%   | #418   | Ready
      src/services/SearchService   |  53%   |  86%   | #419   | Ready

      Overall coverage: 44% -> 68% (+24 pts across targeted modules)
      ```

      Merge the PRs in any order — since each session only adds new test files to its own module, conflicts are rare. If two sessions touched a shared test helper, resolve the conflict manually or ask Devin to fix it.
    </Step>

    <Step title="Run a second batch for the next tier">
      One overnight batch won't hit your 80% target across the entire codebase. The next evening, run a follow-up for the next tier of modules:

      <PromptBlock agent="advanced" intent="batch">
        ```txt Second overnight coverage pass theme={null}
        We're at 68% overall and need 80%. Run the coverage report again,
        find the next 6 lowest-coverage modules (skip anything already above
        80%), and start another batch using the same test-writing playbook.
        ```
      </PromptBlock>

      You can also shift from unit tests to integration tests for critical user flows:

      <PromptBlock agent="advanced" intent="batch">
        ```txt Batch integration tests for critical flows theme={null}
        Identify our 5 most critical user flows (signup, login, checkout,
        password reset, account deletion). Start a parallel session for each
        to write end-to-end integration tests using Playwright. Each session
        should test the happy path plus 2-3 error scenarios.
        ```
      </PromptBlock>

      Two nights of parallel sessions can take a codebase from under 50% coverage to over 80% — work that would take an engineer weeks of dedicated effort.
    </Step>
  </Steps>
</div>
