In the last article, we looked at automating the assembly of mobile applications using Bitrise, figured out how to build Android (and iOS) applications, hooked up the Xamarin Test Cloud, conducted automatic UI testing, and implemented HockeyApp to get feedback. Today we will continue to dive into the world of Mobile DevOps tools, which not only accelerate, but also significantly simplify the development of mobile applications. This time we will look at the integrated solution of Visual Studio Mobile Center.
Note: we continue the series of publications of the full versions of articles from the magazine Hacker . Spelling and punctuation of the author saved.
We'll start a little distance away and look at Mobile DevOps in a historical perspective. By themselves, smartphones and tablets entered our life much faster than their noisy ancestors dust collectors, and for many people on our planet have long been the main way to connect to digital reality. Captain Obvious asserts that Mobile will enter tightly not only into the lives of ordinary users, but also into the business processes of modern companies around the world. Therefore, the developer of cool applications should definitely look at the practices of DevOps, in order to keep up with the train.
Microsoft in the recent past missed the market of mobile ecosystems, so now with all its might (and dollars) it is trying to catch up by offering developers a whole bunch of different SDKs, services and tools. The purchase of Xamarin and HockeyApp allowed the corporation to offer the market integrated tools for the professional development of mobile applications, regardless of the target platform. The Visual Studio Mobile Center pipeline (hereinafter VSMC) is based on the HockeyApp analytics and distribution service already familiar to us and the Xamarin Test Cloud cloud farm.
If we look at the development tools market, then everything goes to the fact that the Mobile world will be ruled by Android + Java (or what is promised there instead of Java in the future? Kotlin?), IOS + Swift , Xamarin and React Native . All four stacks are already supported out of the box in the new VSMC. And in the future they promise to add also Windows.
Mobile Center is still in the early Preview stage, so the possibilities are still quite limited and the service itself is not recommended for use in a production environment. However, all the main elements of Mobile DevOps pipeline are already available in VSMC: assembly, testing, distribution and analytics (various events and crashes).
A nice addition to VSMC is the Tables and Identity modules, which can be useful if you plan to use Azure in your mobile apps. Tables is a cloud-based MBaaS (mobile backend as a service) that allows you to deploy a database in the cloud and access it from within an application in a few lines of code. Azure will deploy SQL Database and a REST server (based on Azure App Services), configured to work together and ready for scaling and reliable access. In real and large projects, this piece can often be superfluous, but it’s perfect for your startup or fast prototype. Using Identity, you can easily authorize users via Facebook, Google or Twitter. Users authorized in this way will be able to access data from Tables marked as requiring authorization. Both Tables and Identity provide basic functionality that can be sufficient for small or simple projects. A couple of lines of code - and it works.
But the Mobile Center itself is first and foremost a DevOps pipeline, so let's move on to the consideration of key functionality.
So, we have the source code of the Navigation Drawer project from a set of standard Android Android examples. Fill them up with GitHub (support for other services will be added to VSMC later), create a free account on mobile.azure.com and add a new application.
Go to the Build section, connect the GitHub repository and select the main branch. After the build, we can download the received APK and detailed logs. Just like people and no frills.
Of the additional build options, you can note the possibility of running Unit tests and automatically notifying beta testers of the readiness of the installation package.
In the future, they also promise to add support for Bitbucket repositories and Visual Studio Team Services . For automated UI tests, it’s true, for now, you’ll have to flood the assembly with your hands from the console, which we'll discuss later.
If you are interested in a separate system for assembling projects , then we strongly recommend to get acquainted with Bitrise.io , which we told about .
As we already know, the Xamarin Test Cloud service is integrated into VSMC. For our example, we will use the previously written Calabash script.
First we need to install Node.js and Ruby plus a number of additional gems. You don’t have to invent anything, just follow the instructions in the Mobile Center. Before sending the application for testing, it needs to be assembled with the calabash-android build [ apk].apk
in the console. The result of this command should be the test_servers folder, which contains a correctly signed APK file. After the build, you will need to run the mobile-center test run command. In a few minutes we will see the test results and receive an email notification of the completion of the tests.
By the way, Amazon and Google also presented their farms for automated UI testing of applications.
There are few differences from the original Xamarin Test Cloud: there are step-by-step screenshots and resource consumption monitoring. There are many devices, but in the VSMC Preview there is still a limit on the number of simultaneous launches (one device at a time) and the allocated time (up to one hour per day).
If you are looking for a separate cloud farm of devices for automated UI testing, then I can advise you to look in the direction of AWS Device Farm , Xamarin Test Cloud , Google Firebase Test Lab .
HockeyApp service is used as a subsystem for assembling the most beautiful and events inside the VSMC. To integrate the SDK, it is enough to add new dependencies to the project and register the handler with crashes.
The crashes themselves can be viewed in the stack trace, and the events in the statistics.
For a more detailed analysis of user behavior, it’s still better to use Yandex.Metrica , Google Analytics or Flurry , as marketers prefer these services for their work.
So, today we met with the universal and integrated pipeline of Visual Studio Mobile Center. Compared with the same Bitrise.io, integrated solutions, on the one hand, can greatly simplify the life of mobile application developers and speed up the introduction of DevOps tools into everyday practice, but on the other hand, they are not as flexible and functional as DIY conveyors. In the near future we should expect the emergence of a larger number of integrated systems from other players. If the programmer's itch or project tasks require their own pipeline, then the choice of tools is already quite wide, including various open source projects, so you need to choose based on the requirements and product development plans.
Successful automation to you! There will be questions - write in the comments!
Vyacheslav Chernikov - head of development at Binwell . In the past, he was one of the Nokia Champion and Qt Certified Specialists, currently he is the Xamarin and Azure platform specialist. He came to the sphere of mobile in 2005, since 2008 he has been developing mobile applications: he started with Symbian, Maemo, Meego, Windows Mobile, then switched to iOS, Android and Windows Phone.
Articles Vyacheslav you can also read the blog on Medium .
Other articles by the author:
We remind you that this is the full version of an article from Hacker magazine .
Source: https://habr.com/ru/post/329908/
All Articles