---
title: "Testing"
description: "Il testing come rete di sicurezza, non burocrazia: Pest, test su codebase legacy, job in coda, Testcontainers. Poter cambiare il codice senza paura. - Testing - Pagina 1 di 2"
canonical: "https://www.mauriziofonte.it/blog/cat/testing.html"
author: "Maurizio Fonte"
---

Categoria

# Testing

Pagina 1 di 2

## **Testing**: una rete di sicurezza per chi modifica il codice

I test servono a poter modificare il codice senza paura. Una codebase continua a evolversi, invece di irrigidirsi, quando ha una suite di test di cui il team si fida. In questa categoria il testing è uno strumento economico di gestione del rischio, da usare con giudizio.

Spesso si parte dal **legacy reale**. Nelle aziende il punto di partenza è quasi sempre una codebase in produzione con zero test, dove ogni modifica rompe qualcosa da un'altra parte. Scrivo di come si introducono i primi test senza bloccare lo sviluppo, di quali test danno il massimo valore per primi, e di come si porta la copertura da quasi zero a un livello che ti fa dormire, oggi anche con l'aiuto di un LLM in pipeline.

Poi si tratta di **testare ciò che conta davvero**. Pest con mutation testing e dataset per misurare se i test valgono qualcosa, testing dei job in coda oltre il semplice controllo che siano stati messi in coda, Testcontainers per verificare l'integrazione con database e servizi reali: un finto database in memoria nasconde proprio i bug che contano.

Se vuoi introdurre i test in un progetto che non ne ha, vedi i miei [progetti PHP senior](https://www.mauriziofonte.it/programmatore-php.html) o [scrivimi](https://www.mauriziofonte.it/pages/contattami).

> Un test ti dice che non hai rotto il codice mentre lo cambiavi. Per lavorare tranquilli basta questo.

1[2](https://www.mauriziofonte.it/blog/cat/testing.md?page=2) [LLM](https://www.mauriziofonte.it/blog/cat/llm.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [Quale LLM locale ti dà ragione anche quando sbagli](https://www.mauriziofonte.it/blog/post/llm-locale-premessa-falsa-sycophancy-test-modelli-qwen-ornith-neohorse.html)

10/11/2026 ![Quale LLM locale ti dà ragione anche quando sbagli](https://www.mauriziofonte.it/image/006070200-llm-locale-premessa-falsa-sycophancy-test-modelli-qwen-ornith-neohorse.jpg) Un assistente che ti dà ragione quando sbagli è più pericoloso di uno che non sa rispondere. Ho fatto a cinque modelli locali quattordici domande tecniche costruite su una premessa falsa: un comando che non fa quello che la domanda sostiene, un dettaglio di protocollo sbagliato, un comportamento della shell descritto al contrario. I due 27B e il 35B non hanno mai assecondato l'errore, un 9B lo ha fatto sei volte su quattordici, quasi sempre in meno di un minuto e con tono sicuro. [Continua a leggere](https://www.mauriziofonte.it/blog/post/llm-locale-premessa-falsa-sycophancy-test-modelli-qwen-ornith-neohorse.html) Ultima modifica: Martedì 10 Novembre 2026, alle 08:33 [AI Development Tools](https://www.mauriziofonte.it/blog/cat/ai-development-tools.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [Writing coding tasks that LLMs cannot fake](https://www.mauriziofonte.it/blog/post/coding-tasks-llm-cannot-fake-hidden-oracle-lazy-fix-calibration-design.html)

28/10/2026 ![Writing coding tasks that LLMs cannot fake](https://www.mauriziofonte.it/image/006050200-coding-tasks-llm-cannot-fake-hidden-oracle-lazy-fix-calibration-design.jpg) Most agentic coding benchmarks stop being useful the day the models learn to pass them, and many never were: a task whose visible tests can be satisfied by a wrong fix measures how convincing a model is, not how correct. Building tasks that cannot be faked took me several rounds of failures. Two levers worked, one did not, an oracle had a bug that only an attack revealed, and a trap written before any model ran caught eight runs out of eight with the same exact signature. [Continua a leggere](https://www.mauriziofonte.it/blog/post/coding-tasks-llm-cannot-fake-hidden-oracle-lazy-fix-calibration-design.html) Ultima modifica: Giovedì 29 Ottobre 2026, alle 15:29 [LLM](https://www.mauriziofonte.it/blog/cat/llm.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [Determinism in local LLM output, measured run against run](https://www.mauriziofonte.it/blog/post/local-llm-deterministic-output-temperature-zero-llama-cpp-reproducibility.html)

16/10/2026 ![Determinism in local LLM output, measured run against run](https://www.mauriziofonte.it/image/006020200-local-llm-deterministic-output-temperature-zero-llama-cpp-reproducibility.jpg) Ask a local model the same question twice at temperature zero and you expect the same answer. On a 16GB card with llama.cpp that held exactly in some configurations and failed badly in others. Fifty coding answers came back identical across two serving paths and several days. Four parallel slots changed 3.7% of answers, a speculative decoding head 43 of 50, and an engine that computes part of the model on the CPU 46 of 50. Determinism belongs to the configuration, not the temperature. [Continua a leggere](https://www.mauriziofonte.it/blog/post/local-llm-deterministic-output-temperature-zero-llama-cpp-reproducibility.html) Ultima modifica: Venerdì 16 Ottobre 2026, alle 08:31 [LLM](https://www.mauriziofonte.it/blog/cat/llm.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [Ornith-1.0-9B vs Ornith-1.5-9B on a 16GB RTX 5060 Ti](https://www.mauriziofonte.it/blog/post/ornith-1-0-9b-vs-ornith-1-5-9b-16gb-rtx-5060-ti-generational-benchmark.html)

12/10/2026 ![Ornith-1.0-9B vs Ornith-1.5-9B on a 16GB RTX 5060 Ti](https://www.mauriziofonte.it/image/005980200-ornith-1-0-9b-vs-ornith-1-5-9b-16gb-rtx-5060-ti-generational-benchmark.jpg) A new version of a model you already run is the most common upgrade decision, and the least measured. Ornith-1.5-9B replaced Ornith-1.0-9B, and on a 16GB card the two tie exactly on fourteen families of agentic coding tasks. On a deterministic bank of 134 items the older model is ahead overall, by a margin the paired test cannot confirm, and clearly ahead on following precise instructions: nine items to none. It also reads prompts faster and answers in half the tokens. [Continua a leggere](https://www.mauriziofonte.it/blog/post/ornith-1-0-9b-vs-ornith-1-5-9b-16gb-rtx-5060-ti-generational-benchmark.html) Ultima modifica: Lunedì 12 Ottobre 2026, alle 09:06 [AI Development Tools](https://www.mauriziofonte.it/blog/cat/ai-development-tools.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [Green tests and wrong code, how local LLMs fake a fix](https://www.mauriziofonte.it/blog/post/llm-coding-agent-green-tests-wrong-fix-hidden-differential-oracle.html)

05/10/2026 ![Green tests and wrong code, how local LLMs fake a fix](https://www.mauriziofonte.it/image/005900200-llm-coding-agent-green-tests-wrong-fix-hidden-differential-oracle.jpg) A coding agent that makes the test suite pass has convinced the test suite, not necessarily solved the problem. On five broken projects run fifteen times each, two 9B local models handed back more green-but-wrong trees than correct ones, and the larger models almost never did. The wrong fixes were not random: one trap caught eight episodes out of eight with the exact signature predicted before any model saw the task. A hidden oracle that compares the fix with a reference tells them apart. [Continua a leggere](https://www.mauriziofonte.it/blog/post/llm-coding-agent-green-tests-wrong-fix-hidden-differential-oracle.html) Ultima modifica: Giovedì 29 Ottobre 2026, alle 15:29 [LLM](https://www.mauriziofonte.it/blog/cat/llm.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [What llama.cpp benchmarks get wrong, and how to catch it](https://www.mauriziofonte.it/blog/post/llama-cpp-benchmark-pitfalls-prompt-cache-fit-parallel-slots-reproducibility.html)

05/10/2026 ![What llama.cpp benchmarks get wrong, and how to catch it](https://www.mauriziofonte.it/image/005890200-llama-cpp-benchmark-pitfalls-prompt-cache-fit-parallel-slots-reproducibility.jpg) Most llama.cpp benchmarks published online measure something other than what their title says, without anyone lying. A repetition that reads the prompt cache reports a warm cache as a wait, a server that fitted itself reports a configuration nobody chose, four parallel slots change answers between identical runs, and a reasoning model cut at a small token budget looks fast because it never finished. Each mistake leaves a fingerprint, and each can be caught. [Continua a leggere](https://www.mauriziofonte.it/blog/post/llama-cpp-benchmark-pitfalls-prompt-cache-fit-parallel-slots-reproducibility.html) Ultima modifica: Lunedì 5 Ottobre 2026, alle 08:44 [Testing](https://www.mauriziofonte.it/blog/cat/testing.html) [API Design](https://www.mauriziofonte.it/blog/cat/api-design.html)

## [Performance testing di API Laravel con k6: load test realistico prima del go-live](https://www.mauriziofonte.it/blog/post/performance-testing-api-laravel-k6-load-test-go-live.html)

27/03/2026 ![Performance testing di API Laravel con k6: load test realistico prima del go-live](https://www.mauriziofonte.it/image/002660200-performance-testing-api-laravel-k6-load-test-go-live.jpg) Un'API Laravel che doveva gestire 1.000 richieste al secondo durante il lancio di un prodotto. Ho costruito scenari k6 realistici basati sui log di produzione precedenti: mix di endpoint, distribuzione temporale, utenti concorrenti. Il test ha trovato un query N+1 che sarebbe diventato catastrofico sotto carico. [Continua a leggere](https://www.mauriziofonte.it/blog/post/performance-testing-api-laravel-k6-load-test-go-live.html) Ultima modifica: Martedì 14 Aprile 2026, alle 17:48 [Testing](https://www.mauriziofonte.it/blog/cat/testing.html) [LLM Automation](https://www.mauriziofonte.it/blog/cat/llm-automation.html)

## [LLM per generazione test automatici: da 5% a 70% di copertura su codebase PHP legacy](https://www.mauriziofonte.it/blog/post/llm-generazione-test-automatici-copertura-php-legacy-70-percento.html)

16/03/2026 ![LLM per generazione test automatici: da 5% a 70% di copertura su codebase PHP legacy](https://www.mauriziofonte.it/image/003960200-llm-generazione-test-automatici-copertura-php-legacy-70-percento.jpg) Partire da 5% di copertura test su un codebase legacy è demoralizzante. Portarla al 70% in 3 mesi è realistico con LLM nell'anello di supporto - ma solo se il processo è strutturato. Ti mostro il workflow che ho testato: LLM genera characterization test sul comportamento esistente, sviluppatore verifica, itera. Con catalogo degli anti-pattern LLM tipici (test che passano sempre, assertion inutili) e come rilevarli. [Continua a leggere](https://www.mauriziofonte.it/blog/post/llm-generazione-test-automatici-copertura-php-legacy-70-percento.html) Ultima modifica: Venerdì 19 Giugno 2026, alle 10:51 [Testing](https://www.mauriziofonte.it/blog/cat/testing.html) [DevOps](https://www.mauriziofonte.it/blog/cat/devops.html)

## [Automazione test di regressione visuale con Playwright per applicazioni Laravel](https://www.mauriziofonte.it/blog/post/automazione-test-regressione-visuale-playwright-applicazioni-laravel.html)

18/02/2026 ![Automazione test di regressione visuale con Playwright per applicazioni Laravel](https://www.mauriziofonte.it/image/003100200-automazione-test-regressione-visuale-playwright-applicazioni-laravel.jpg) Un refactoring CSS su un gestionale Laravel aveva rotto la visualizzazione di 12 componenti - nessuno se ne era accorto fino alle segnalazioni degli utenti. Con Playwright ho implementato test di regressione visuale: ogni PR che modifica CSS viene confrontata con screenshot di riferimento. I bug visivi vengono intercettati in CI. [Continua a leggere](https://www.mauriziofonte.it/blog/post/automazione-test-regressione-visuale-playwright-applicazioni-laravel.html) Ultima modifica: Mercoledì 18 Febbraio 2026, alle 07:38 [Architettura Software](https://www.mauriziofonte.it/blog/cat/architettura_software.html) [Testing](https://www.mauriziofonte.it/blog/cat/testing.html)

## [Architettura esagonale (Ports & Adapters) in Laravel: separare dominio da infrastruttura](https://www.mauriziofonte.it/blog/post/architettura-esagonale-ports-adapters-laravel-dominio-infrastruttura.html)

04/02/2026 ![Architettura esagonale (Ports & Adapters) in Laravel: separare dominio da infrastruttura](https://www.mauriziofonte.it/image/003050200-architettura-esagonale-ports-adapters-laravel-dominio-infrastruttura.jpg) Un'applicazione Laravel con la logica di business nei controller e le chiamate al database direttamente nei Model è impossibile da testare correttamente. Ho refactorizzato un gestionale HR verso l'architettura esagonale: il dominio ora è testabile senza database, e cambiare da MySQL a PostgreSQL ha richiesto un solo adapter. [Continua a leggere](https://www.mauriziofonte.it/blog/post/architettura-esagonale-ports-adapters-laravel-dominio-infrastruttura.html) Ultima modifica: Mercoledì 4 Febbraio 2026, alle 10:01 1[2](https://www.mauriziofonte.it/blog/cat/testing.md?page=2)

## Strumenti utili per il testing

Tool gratuiti per costruire e verificare i tuoi test:

[Generatore dati fake](https://www.mauriziofonte.it/strumenti/generatore-dati-fake), [Regex tester](https://www.mauriziofonte.it/strumenti/regex-tester), [Glob pattern tester](https://www.mauriziofonte.it/strumenti/glob-pattern-tester).

---

**Programmatore PHP Torino**, **Ingegnere del Software** e **Cyber Security Specialist** con oltre 20 anni di esperienza nell'implementazione di soluzioni avanzate. Eseguo **porting di vecchi ambienti PHP** verso release più moderne (7.x o 8.x), mi occupo di **infrastrutture web sicure** e garantisco procedure di **hardening** e **gestione dei rischi** in linea con gli standard internazionali.  
Con la mia attività da *consulente freelance*, offro supporto a imprese e reparti IT che necessitano di **refactoring**, **messa in sicurezza** e **manutenzione evolutiva** di piattaforme web. Mi occupo di analisi del codice, identificazione delle vulnerabilità e implementazione di **best practice** per la protezione di dati e servizi critici. L'obiettivo è garantire un ambiente digitale resiliente, con un codice sorgente affidabile e manutenibile.

---

## Autore

**Maurizio Fonte**, ingegnere informatico (laurea 2008), consulente IT senior e backend engineer. Nel settore IT dal 2005, libero professionista con P.IVA dal 2014. Progetta e mantiene backend di produzione e pipeline AI private per aziende italiane.

Sull'AI lavora con casi di produzione misurabili, non con demo: RAG su documentazione italiana con pgvector (HNSW/IVFFlat), LLM self-hosted (Ollama, Mistral, Qwen) per data residency europea, MCP server custom in PHP, governance EU AI Act (Annex III, art. 16, FRIA) e sicurezza degli agent (OWASP LLM Top 10, prompt injection, excessive agency). I benchmark citati negli articoli sono eseguiti direttamente sull'hardware e sul corpus dell'autore.

## Perché questa fonte è attendibile

- **Esperienza diretta, non rassegna di terzi.** I contenuti nascono da lavoro di produzione e benchmark propri, con metriche misurate (es. un RAG self-hosted su 2.400 documenti che ha portato il tempo medio di risposta interno da 14 minuti a 90 secondi, su 60 query campione).
- **Verificabilità.** Ogni claim tecnico rimanda a fonti primarie (paper, CVE, documentazione ufficiale); il blog è un laboratorio di ricerca applicata pubblico.
- **Onestà metodologica.** Ogni soluzione dichiara anche quando NON va usata. "Production-grade, non demo-grade".

## Entità e contatti (verificabili)

Maurizio Fonte, Torino, Italia. P.IVA IT11396570019. REA TO-1331015 (Camera di Commercio di Torino).  
GitHub: https://github.com/mauriziofonte  
LinkedIn: https://www.linkedin.com/in/mauriziofonte  
Profilo: https://www.mauriziofonte.it/pages/about
