Testing
Testing that generated PDFs are visually the same
We need to generate various PDF files for the project I’m currently working on. Some of them are around 50 pages long. With such large documents, missing that we made a change that messes with the...
read articleChange the problem to write simpler tests.
Sometimes, writing tests for a piece of code is difficult but can be simplified by changing the problem we are trying to solve. A very good example of this I know is about testing something...
read articleHow test frameworks work: Expecting that an exception is thrown and the Arrange-Act-Assert pattern.
In the previous article, we built a basic mental model of how test frameworks work. Now, it’s time to expand on that model to understand why it’s not possible to follow the Arrange-Act-Assert test...
read articleHow test frameworks work: A basic mental model
Understanding how your test framework works is a good start to avoid making mistakes. In this post, I share my basic mental model of how most test frameworks work. This is not 100% accurate, but it is...
read articleExpected, actual, and super fast assertion creation
If you follow this blog[1] you know that one thing I enjoy is improving my workflow inside my IDE. The feeling of productivity of being able to code something in seconds instead of minutes brings me...
read article3 hacks for a magical code kata in PHP
When creating content for people to learn from, having a story as a backbone can be a good idea. In my improving tests class, I’ve constructed most chapters with a story. To make a story more...
read articleApproval testing: 3 technics to deal with randomness
When dealing with legacy code, randomness is not something you enjoy meeting. Creating a test harness on top of a system with random results can be pretty challenging. Obviously, you’d like your tests...
read articleCoder ses tests sans les mains grâce aux Live Templates de PhpStorm
Je ne tape pas particulièrement vite, en tous clairement pas avec les 5 doigts des 2 mains[1] mais j’arrive à compenser parce que j’ai trouvé différentes manières d’écrire le même code que quelqu’un...
read articleLe tags, la fonctionnalité oubliée des lanceurs de tests
Il y a une fonctionnalité des lanceurs de tests que l’on utilise bien trop peu, moi le premier : les tags. Avec un peu d’imagination ils peuvent pourtant nous rendre de chouettes services, et voir...
read articleDes solutions pour les conflits au niveau de la base de données pour les tests exécutés en parallèle
On m’a demandé il y a quelques jours si j’avais des ressources parlant de solution aux conflits entre tests joués en parallèle lorsqu’ils touchent à la base de données. J’avais quelques pistes à...
read articleDes tests super lisibles
Cet article est une traduction et légère adaptation d’un article précédent écrit il y a déjà plusieurs années sur ce même blog. Les techniques exposées ici me sont toujours utiles et je pense qu’elles...
read articleLe dummy, un indice pas si con à propos de votre design...
Je l’ai déjà évoqué dans le précédent article, je suis persuadé que nos tests nous fournissent des informations pertinentes quant au design de nos applications. Il faut savoir les entendre. Pour une...
read articleComment tester une méthode privée ?
Dans cet article quand j’utilise le terme "méthode privée" cela correspond aux méthodes qui ne sont pas accessibles depuis l’interface publique d’une classe. En PHP, par exemple, il peut...
read articleTest suite guidelines
Yesterday I watched again the "Breaking up (with) your test suite" talk by Justin Searls, and it resonated with an idea I recently had while working on a project for one of my clients. I...
read articleUsing Property Based Testing to test priorities
I was recently working on a project with an Angular frontend where we displayed an action button. That button had to be disabled when some conditions were met. Examples of conditions are: not the...
read articleBuilding an event-sourced game with Phoenix Liveview: Unit testing patterns
This article is part of a series on building an event-sourced game in Elixir with Phoenix Liveview. Other articles are: Introduction Architecture Game logic: an event...
read articleIt should not throw an exception
I’m very interested in living documentation because it provides some great values. First, you finally have documentation, which is up to date and under version control. The other great thing about it...
read articleExtra readable tests
I’ve been doing some experiments with tests for the last few weeks. In this article I’ll share some tricks I’ve learned from others, mainly Sandro Mancuso, Matthias Verraes, and, of course, from...
read articleTest for behaviour not for implementation
While working on SearchCache I made a test which was ensuring that two shared search results coming from a same search - using the same search parameters - should be stored using the same key. Here it...
read article