Testing React Native

with Jest and Testing Library



Series

Written by one of our expert developers here at Keyhole, this series serves as a resource for anyone interested in testing their React Native app. Testing saves time and cuts costs! It's important to implement some form of testing into any application you build.

In this blog tutorial series, we'll dive deeper into testing React Native with Jest and Testing Library. We start by helping you get up and running and then go on to cover everything from writing your first test to Functional Testing.


Part One

Setting Up

Here's how to set up your testing environment for React Native with Jest and Testing Library.

Part Two

Our First Test

Not that we're set up, it's time to embark on the adventure of writing our first test! In the post, we'll walk you through the process.

Part Three

What To Do When an Element Is Not Found

In this post, we get a little deeper into testing with Jest and Testing Library. Here's what to do if the element you're testing isn't found.

Part Four

Testing a Button

Part Four covers button testing! We'll give you a step-by-step guide on how to write a button test and discuss what to do if your test fails.

Part Five

Styles Testing

To start, we'll drill down deep into Styles Testing - what it is and the point of it. Then, we'll talk about testing with toHaveStyle.

Part Six

Functional Testing

We begin Part Six of the series by discussing how to use useState hook. Then, we learn how to toggle components with onPress and test it with fireEvent.

Part Seven

Extra Tips and Tricks with Jest

The final installment in the series is a conglomeration of handy Jest tips and tricks that didn't quite make it into the other parts.