Suggestions
Chafik H'nini
Creator of RebootX - Your infra in your pocket
Chafik H'nini is an experienced software engineer with a passion for working on various enterprise and personal projects. With a Bachelor's degree in Maths from Lycée André Maurois and a degree in Computer Science and Industrial Engineering from Ecole centrale de Lille, H'nini is a curious and driven individual with a thirst for knowledge.
H'nini has served as a Lead Developer at Holberton and was previously a Senior Software Engineer at Gorgias, vente-privee (now Veepee), CAR360 Inc, and Societe Generale Corporate and Investment Banking (SGCIB). He has also founded his own ventures, Apiloop and Piwibi, and has worked as a Developer at Pictime and as a Web Developer at ADEXOS.
As a Freelance Developer at Auto-Entrepreneur, H'nini honed his skills in various programming languages, including Python, C++, and Java. He is always testing new technologies and tools, but he approaches them with a discerning eye, eschewing hype for practicality.
Highlights
A lot of applications use UUID v4 as a primary key for entities. In tests you do not want to rely on an auto-generated value. Here is how to generate deterministic UUID v4 in JavaScript.
#UUID #JavaScript #Nodejs
I haven't written any tests for my applications for a while (including RebootX).
Yet they have great code coverage* (> 90%) AND most of the edge cases are handled.
All of that is achieved thanks to the small snippet below 💡.
The hard truth is that writing tests manually create lots of holes in the racket as testing the full combinatory of inputs is impossible for a human.
And letting #AI writing them (#Copilot, #ChatGPT, #Devin, #Cursor, insert any new #YCombinator company) is even worse because it makes them very verbose, which leads to what I call shanty towns tests. And last but not least, it makes the whole thing undeterministic.
If we take a step back, any application is a collection of nested flows as follows :
Input ➡️ Logic ➡️ Output
The test suite must be able to instrument these flows and create deterministic test cases automatically, with extreme ones.
But for that, a codebase needs to be "instrumentable". Often you can rely on reflection when the language allows it, but if you didn't structure it well, you end up doing a lot of ugly things to mock side effects and external dependencies.
AI is not the answer, we need to rethink the thing.
And you, what about your applications ? What happens when you :
- enter a 1GB string in the email input ?
- disable JS and pass a string instead of a number in a specific payload ?
- do some other extreme thing ?
*of course code coverage alone is not enough.
