Testing React Native apps with zero effort
Tags: reactnative, react, reactnativenavigation, appdevelopment
Published: 2021-01-12 21:46:06

Hi folks,

I am going to introduce a cool and convenient CLI that is aiming to make the React Native app developing experience as smooth as possible. It is **not** a replacer for react-native CLI but a good addition to it.
> [The project](https://github.com/kanzitelli/cli-rn) is currently in the very alpha stage and under heavy testing.

## Quickstart

In this section, we are going to start using [cli-rn](https://github.com/kanzitelli/cli-rn) and see it in action!
> Note: I assume that you have some development experience with React Native.

Install [cli-rn](https://github.com/kanzitelli/cli-rn) globally and generate new app

    > npm i -g cli-rn
    > cli-rn new AppName

It will start generating an app that is bootstrapped from [rnn-starter](https://github.com/kanzitelli/rnn-starter). The process is going to take some time.

Once the process is finished, you will have a production-ready app on your local machine. If you’d like to read more about the app structure and related things, please follow the [rnn-starter page](https://github.com/kanzitelli/rnn-starter).

## Testing

Let’s assume that you have coded a feature in your app and would like to test it in **release** mode on a real device to feel the experience of an end-user. We have 2 options here:

1. Open XCode and run the project in Release mode (takes ~4–5 minutes).

1. Use [cli-rn](https://github.com/kanzitelli/cli-rn) and [cli-rn-app](https://apps.apple.com/app/id1548165379) (takes < 1 minute).

As you may have guessed, we are going to stick with the second option 🙂

In order to start testing your app remotely, you will need to download [cli-rn-app](https://apps.apple.com/app/id1548165379) from the [App Store](https://apps.apple.com/app/id1548165379). As an alternative, you can install the most recent version from [Github](https://github.com/kanzitelli/cli-rn-app) (with a single command > cli-rn app) and also modify it for your needs.

As was mentioned before, we want to test the app in **release** mode. In order to achieve it, run the following command:

    > cli-rn remote:prod

![](https://cdn-images-1.medium.com/max/2528/1*-fc4g92rF1I-cbWE7U9EgA.png)

This command will generate an App Code that has to be put in [cli-rn-app](https://apps.apple.com/app/id1548165379) as shown on the video below.

![](https://cdn-images-1.medium.com/max/2000/1*r7xksOGEAtVI2uGmovDZxQ.gif)

*[HD quality on Youtube.](https://www.youtube.com/embed/ESxQc3wQUAw)*

After hitting the Run button, you will see the black screen which means that your app started loading.
> Note: seeing the black screen is totally okay as I haven’t found a way to manage it yet *🙂*

*Voila!* You should be able to see your app! Happy testing 🤙

[cli-rn-app](https://apps.apple.com/app/id1548165379) can be reused for testing any of your RN apps. The only thing to keep in mind is that libraries that are installed in [cli-rn-app](https://github.com/kanzitelli/cli-rn-app) might be not enough for your needs. You can always add it by yourself or [open an issue](https://github.com/kanzitelli/cli-rn-app/issues).

## Summary

Working on this project made me learn a lot of things such as writing a CLI for the first time and connecting all parts of the project together, like backend, server for tunneling, mobile app, etc.

💚 Thanks to [React Native](https://reactnative.dev/)

💙 Thanks to [Expo](https://expo.io/) for inspiration

❤️ Thanks to [Wix team](https://github.com/wix) for initiating [react-native-navigation](https://github.com/wix/react-native-navigation) and all contributors for maintaining it

[cli-rn](https://github.com/kanzitelli/cli-rn) and [cli-rn-app](https://github.com/kanzitelli/cli-rn-app) saved me a lot of time, I hope they will do the same for you! I will keep working on these tools as they have become essential attributes of my daily developer life. There are some cool features which I’d like to add and, of course, fixing existing issues and improving the codebase will need some time 😇

I appreciate your time in reading this article. I wish you a great day and Happy Coding 🤙

[https://cli-rn.batyr.io](https://cli-rn.batyr.io)