> ## 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.

# Testare 8 moduli mai testati in una sola notte

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="Testare 8 moduli non testati in una notte" description="Avvia 8 sessioni Devin parallele durante la notte — ciascuna scrive test unitari per un diverso modulo a bassa copertura e apre una PR entro la mattina." prompt="Esegui il nostro report sulla copertura dei test, trova gli 8 moduli con meno del 50% di copertura delle linee di codice e avvia un batch di sessioni Devin parallele — una per modulo — ciascuna usando il nostro playbook di scrittura dei test per portare la copertura oltre l'80%. Apri una PR separata per ogni modulo." category="Ottimizzazione Devin" features="Avanzate, Playbook" agent="advanced" intent="batch" />

<div className="uc-detail-wrapper">
  <Tip>Non vuoi configurarlo manualmente? Incolla un collegamento a questa pagina in una sessione Devin e chiedigli di impostare tutto per te.</Tip>

  <Steps>
    <Step title="Crea una guida operativa per la scrittura dei test">
      Il tuo monorepo di e-commerce ha più di 30 moduli ma solo pochi offrono una copertura dei test significativa. Vuoi passare dal 44% di copertura complessiva all'80% — iniziando dagli 8 peggiori. Prima di avviare sessioni parallele, ti occorre un [playbook](/it/product-guides/creating-playbooks) che garantisca che tutte e 8 le sessioni seguano lo stesso approccio alla scrittura dei test.

      Chiedi a Devin di creare il playbook per te — ti basta descrivere le tue convenzioni di testing in una qualsiasi sessione:

      <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>

      Questo playbook diventa l'insieme di istruzioni condivise per ogni sessione parallela. Puoi anche aggiungere voci in [Knowledge](/it/product-guides/knowledge) sulle tue utility per i test, sui pattern di mocking o su qualsiasi particolarità specifica del progetto (ad esempio, "chiama sempre `resetMocks()` in `afterEach`").
    </Step>

    <Step title="Avvia 8 sessioni parallele alle 18:00">
      Al termine della giornata di lavoro, apri una nuova sessione Devin dalla [home page di Devin](https://app.devin.ai/?utm_source=docs\&utm_medium=use-case-gallery) e descrivi l’attività batch.

      1. Seleziona dal menu a discesa il playbook per la scrittura dei test
      2. Descrivi l’attività nel prompt:

      <PromptBlock agent="advanced" intent="batch">
        ```txt Batch notturno per la copertura dei test — 8 moduli theme={null}
        Esegui `npm run test:coverage` sul nostro repository. Identifica gli 8 moduli
        con la copertura delle linee di codice più bassa (ignora tutto ciò che si trova sotto src/generated/).

        Per ogni modulo, avvia una sessione Devin in parallelo usando il playbook selezionato.
        Ogni sessione deve:
        - Leggere il codice sorgente del modulo e gli eventuali test esistenti
        - Scrivere nuovi unit test per portare la copertura delle linee di codice oltre l'80%
        - Eseguire l'intera suite di test per confermare che nulla si rompa
        - Aprire una PR con i nuovi file di test e un riepilogo della copertura prima/dopo
        ```
      </PromptBlock>

      3. Esamina le sessioni proposte — Devin elenca ogni modulo con la copertura attuale e conferma quali sessioni verranno 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. Approva il batch e chiudi il laptop. Tutte e otto le sessioni vengono avviate contemporaneamente su macchine Devin separate, ciascuna seguendo il tuo playbook in modo indipendente.
    </Step>

    <Step title="Ti svegli con 8 PR">
      Entro la mattina, ogni sessione si sarà conclusa e avrà aperto la propria PR. Vedrai 8 PR nel tuo repository, ciascuna contenente nuovi file di test e un riepilogo della copertura:

      ```
      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)
      ```

      Unisci le PR nell'ordine che preferisci — poiché ogni sessione aggiunge solo nuovi file di test al proprio modulo, i conflitti sono rari. Se due sessioni hanno modificato un helper di test condiviso, risolvi il conflitto manualmente oppure chiedi a Devin di sistemarlo.
    </Step>

    <Step title="Avvia un secondo batch per il livello successivo">
      Un singolo batch notturno non raggiungerà il tuo obiettivo dell'80% sull'intera codebase. La sera successiva, esegui un secondo passaggio per il livello successivo di moduli:

      <PromptBlock agent="advanced" intent="batch">
        ```txt Seconda esecuzione notturna per la coverage theme={null}
        Siamo al 68% complessivo e dobbiamo arrivare all’80%. Esegui di nuovo
        il report di coverage, trova i 6 moduli con la coverage più bassa
        successivi (salta tutto ciò che è già sopra l’80%) e avvia un altro
        batch usando lo stesso playbook per la scrittura dei test.
        ```
      </PromptBlock>

      Puoi anche passare dai test unitari ai test di integrazione per i flussi utente critici:

      <PromptBlock agent="advanced" intent="batch">
        ```txt Batch di test di integrazione per i flussi critici theme={null}
        Identifica i nostri 5 flussi utente più critici (signup, login,
        checkout, reset della password, eliminazione dell’account). Avvia
        una sessione parallela per ciascuno per scrivere test di integrazione
        end-to-end usando Playwright. Ogni sessione deve testare il happy path
        più 2-3 scenari di errore.
        ```
      </PromptBlock>

      Due notti di sessioni parallele possono portare una codebase da meno del 50% di coverage a oltre l'80% — un lavoro che richiederebbe a un ingegnere settimane di impegno dedicato.
    </Step>
  </Steps>
</div>
