At least this is what I thought when a year ago, I joined a team at ATO, a healthcare analytics company that offers a range of products for data scientists in the healthcare sector. It's a highly specialized and regulated business domain that probably has an acronym for pretty much everything in the world. Let me give you an example. In the International Classification of Diseases, that's a real thing, there is a code, W6162XD, that means, it literally means, struck by a duck, subsequent encounter. And in such a specialized business domain, our team was asked to cover all the major features with automated tests for regulation purposes.
The scope included 64 epics of tests. I still remember this number. For a non-professional like me, the UI looked like gazillion checkboxes, acronyms, tables with random numbers all around, powered by five-year-old React application and ten-year-old Java backend. Java had its own story going from monolith to microservices, then back, leaving us with a bunch of legacy outdated APIs, but that's for another time. For now, let's focus on React. As the product was evolving, some of the components have grown over a thousand lines of code with those huge use effects, with missing dependencies, and dependency array, and all that stuff.
React version 17, most of the code untyped. ESLint and Prettier got lost during cloud migration. And before we move on, I just wanted to mention that this is not an uncommon situation for growing businesses that focus on building new features. Now, having that said, our first reaction to this project can be summarized by a quote from my teammate. This code is impossible to test. Or, speaking scientific language, R45.4, irritability and anger. Challenge was not accepted. With all those excuses running in my head, no, it's not my job, even a junior developer can do that, even AI can do that, and after five hours of me prompting chatgpt, stupid AI, it will never take my job, okay, I'll write the test, at least tell me what kind of test should I write, where do I start? We needed a testing strategy.
Comments