Categoria

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 o scrivimi.

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

Quale LLM locale ti dà ragione anche quando sbagli

Quale LLM locale ti dà ragione anche quando sbagli 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
Ultima modifica:

Writing coding tasks that LLMs cannot fake

Writing coding tasks that LLMs cannot fake 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
Ultima modifica:

Determinism in local LLM output, measured run against run

Determinism in local LLM output, measured run against run 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
Ultima modifica:

Ornith-1.0-9B vs Ornith-1.5-9B on a 16GB RTX 5060 Ti

Ornith-1.0-9B vs Ornith-1.5-9B on a 16GB RTX 5060 Ti 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
Ultima modifica:

Green tests and wrong code, how local LLMs fake a fix

Green tests and wrong code, how local LLMs fake a fix 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
Ultima modifica:

What llama.cpp benchmarks get wrong, and how to catch it

What llama.cpp benchmarks get wrong, and how to catch it 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
Ultima modifica:

LLM per generazione test automatici: da 5% a 70% di copertura su codebase PHP legacy

LLM per generazione test automatici: da 5% a 70% di copertura su codebase PHP legacy 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
Ultima modifica:

Automazione test di regressione visuale con Playwright per applicazioni Laravel

Automazione test di regressione visuale con Playwright per applicazioni Laravel 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
Ultima modifica:

Architettura esagonale (Ports & Adapters) in Laravel: separare dominio da infrastruttura

Architettura esagonale (Ports & Adapters) in Laravel: separare dominio da infrastruttura 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
Ultima modifica:

Strumenti utili per il testing

Tool gratuiti per costruire e verificare i tuoi test:

Generatore dati fake, Regex tester, Glob pattern tester.