Test it like you mean it
A journey towards better code quality
Telmo Pestana
My name is Telmo Pestana, I'm a portuguese software developer based in Malaga since 2022 with more than 15 years of experience and I'm currently working as a senior frontend developer at Fortris. For the past couple years I've developed a keen interest in testing which is the reason I want to share my acquired knowledge with other developers.
No video of the event yet, sorry!
Join us for an insightful journey through the world of testing in software development. Testing is a crucial part of a CI/CD environment. We'll share the story of a project that underwent a series of transformations in its testing approach, evolving from a pyramid to an hourglass, and finally settling on a trophy-shaped strategy. Along the way, we encountered challenges, learned valuable lessons, and made decisions aimed at enhancing testing practices.
Our expedition began with a project boasting a decent unit test coverage (75%), yet plagued by persistent bugs reported by the quality team. In response, we initially ramped up our E2E tests, creating one for each new task/story/ticket. However, this approach soon revealed three major hurdles: prolonged test execution times, unreliable test environments leading to sporadic failures, and the inherent flakiness of E2E tests, impacting result accuracy. We were facing the common problems of an hourglass shaped testing approach.
To address these challenges, we diversified our testing strategy, introducing two distinct test types: smoke tests, covering critical application functionalities like login; and nightly tests, encompassing remaining scenarios executed daily. Despite these efforts, the persistence of post-deployment bugs prompted a reevaluation of our testing approach. We recognized the need for alternatives that were faster, easier to develop, and provided immediate feedback during development.
Our quest led us to explore integration tests as a potential solution for our frontend project. Though initial attempts using Angular's approach with harnesses felt cumbersome, a breakthrough occurred when we discovered the Testing Library (https://testing-library.com/), which revolutionized our integration testing experience. This newfound clarity and ease of implementation empowered us to replace many E2E tests with integration tests, offering benefits in execution times, readability, and reliability, a significant shift towards a trophy-shaped testing approach.
Encouraged by our success on the frontend, we extended our exploration to the backend, leveraging Supertest (https://github.com/ladjs/supertest) for integration testing of GraphQL and REST endpoints. This shift reduced reliance on unit tests and emphasized testing behaviors, a more robust approach less prone to breaking when changes occur.
But our journey didn't end there. We recognized the importance of contract tests, ensuring seamless communication between frontend and backend components. Employing Pact ((https://pact.io/), we established consumer-driven contracts, fostering collaboration and early detection of discrepancies during development.
Yet, one piece was missing: visual regression tests. Despite limited audience exposure, we recognized the need to verify visual correctness. Leveraging Cypress, which we already used for E2E tests, we adopted a mocked data approach, enhancing test speed and reliability.
Join us as we share our experiences and insights, making testing more accessible and meaningful for frontend and backend developers alike.
- Date:
- 2024 June 22 - 13:00
- Duration:
- 45 min
- Room:
- Sala Fuengirola
- Conference:
- OpenSouthCode 2024
- Language:
- English
- Track:
- Difficulty:
- Medium
- OpenSouthKids
- Start Time:
- 2024 June 22 10:00
- Room:
- Sala Málaga
- Mutation Testing Workshop
- Start Time:
- 2024 June 22 12:00
- Room:
- Sala Riogordo 1
- Optimización de Costes en Kubernetes con Escalador Automático de Clústeres, arquitecturas Arm e instancias Spot.
- Start Time:
- 2024 June 22 12:00
- Room:
- Sala Riogordo 2
- Krilloud goes Open Source
- Start Time:
- 2024 June 22 13:00
- Room:
- Sala Canillas
- SidecarT: Innovando Contra Todo Pronóstico - Cómo Crear una Coprocesadora para Atari ST
- Start Time:
- 2024 June 22 13:00
- Room:
- Sala Riogordo 3
- BoxLang - The Future is Dynamic. A new JVM Dynamic Language
- Start Time:
- 2024 June 22 13:00
- Room:
- Sala Benalmádena