Meet My New Friend: Testing
Submitted by Preeti Wadhwani (@preetiwadhwani) on Sunday, 17 February 2019
Technical level: Intermediate
Every day we write a hundred, thousand lines of code to build products in the aim of impacting the lives of people in a positive way. But how can we make sure that the key features the user uses do not stop working with every new deployment? How can we get confidence that when refactoring code the existing feature still works as expected?
This talk I am going to share with you my experience of dealing with these in React Native by moving towards TDD. Also how writing unit and e2e tests helped me write better code and build beautiful apps.
- I will start with a story on how difficult it was to test when there were no tests in the codebase and manually testing everything was so tedious
- Many people had motivated me to move towards TDD and getting chance to work with people who encourage testing in the codebase helped me to move towards it
- I started with writing unit tests using Jest is used by Facebook, and as per my experience unit test helps in improving your code architecture and helps you write better code
- Showing the examples for the same to understand it better
- When the feature development is done to test it we used detox with Cucumber to write e2e tests
- This greatly helped us in BDD and automate tests saved time to manually tests everything
- Showing the example of the same
- Thus writing tests helped in refactoring with confidence as if any other developer is changing the code running tests provide information if the previous feature working as expected
Preeti is a programmer at heart, with over 4+ years on mobile. She’s worked on multiple but Android remains her passion, with her experience allowing her to handle complete development cycles, and to go on and lead adjacent teams. When she isn’t glued to her code, Preeti can be found experimenting with gourmet or playing her guitar.