Visual Studio App Center is a great tool for React Native automated testing. This blog post explains how to implement it on the repositories and how Continuous Integration helps ensure its code repository quality, blocking or merging changes depending on the testing environment, and more. Keep reading!
What is Continuous Integration?
Continuous Integration (CI) is a workflow strategy we can use to help we ensure new code will integrate into the current version of our software. At the same time, CI are tools that help us with frequent changes into a repository.
In fact, with it, we can run unit, functional, and integration tests automatically. To illustrate it, let’s suppose we are working within a team with ten people in the same application. Then, we need to review all the changes when a developer wants to push code into the repository. In essence, CI will run the tests in the background, ensuring that all parts of the code that come from different developers work together.
Continuous Integration (CI) is a workflow strategy we can use to help we ensure new code will integrate into the current version of our software.
Definitely, React Native is one of the most popular frameworks used for mobile development. And, for the better, we have CI for React Native and we will get a tested build if we use it.
Most common benefits
Some of the benefits of using CI are:
- It can be installed in our repository easily
- Code integration is safer
- It will help us detect errors before the code is merged
- The merge will be blocked if it finds some error
- Builds are run automatically
- All dependencies can be installed before merging the code
- We can do a pre-build review before merging the code
Ultimately, it’s also important to know that there are many CI services. So too, that they vary by price, available features, customizations, integrations with different services, technical support, the community using it, among others.
Visual Studio App Center
Website: appcenter.ms
Visual Studio App Center is:
integrated developer services for building, testing, releasing, and monitoring mobile and desktop apps.
According to the documentation, Visual Studio App Center is:
Integrated developer services for building, testing, releasing, and monitoring mobile and desktop apps.
Besides CI services, Visual Studio App Center also offers Cloud UI testing capabilities (to be described in a future post).
Price examples as of August 2020.
How to install it
In order to install Visual Studio App Center:
-
1. Go to [GitHub](https://github.com/). On the nav bar, we have an option called “Marketplace”. Click it.
-
2. Click on the ‘Continuous Integration’ tab and search for “App Center”.
-
3. Authorize Visual Studio App Center to interact with our repository.
-
4. Select the repositories on which to install App Center.
-
5. Authorize App Center.
-
6. It will ask you again to select the repo in which to install it.
-
7. Create a new app on App Center for our selected repository.
-
8. Configure the built by Operating System (iOS, Android, or you can select both).
Consequently, now a new screen will open. This new screen will contain the variables to create our build (both screens for Android or iOS are similar to configure).
- Project: We specify the
package.json
. With this file we are going to install our dependencies. - Build Variant: This is the kind of build we want, like debug, release, or real candidate.
- Node.js: Specify the
Node.js
version to build the environment. - Build Scripts: If we have scripts on our
package.json
, we can choose to run them. - Build Frequency: Here we can choose if we want to make the builds manual or automatic.
- Build Android App Bundle: This option lets us create a
.apk
file and then download it.
We need to activate the “Run unit tests” option to run our test suite cases. Doing this completes the configuration.
The final result:
Congrats! Now we have installed CI in our repository with App Center.
Conclusion
To conclude, other alternatives to App Center are Bitrise and Nevercode: Bitrise is a bit more difficult to configure than Visual Studio App Center, but it is cheaper. However, it might be a good option for smaller projects. Also, both mentioned choices work with other platforms besides React Native.
Above all, App Center feels easier to use than Bitrise. A good thing is that both platforms have a free trial option, so you can get to know them before deciding which one you need. There is not a single best option, you should pick the tool depending on your project size and budget. For every one of them, you will find comprehensive and explicit documentation.