Continuos delivery pipeline for Android Applications - android

I am doing a little research on how to setup Continuos delivery pipeline for Android apps. I am aware of existing approaches of using Jenkins and Ant scripts for making a build. What I'd really like to do is when I do a git push on say a development branch, I'd like Jenkins to do a build on bunch of emulators (With different resolutions) run my Robotium scripts and email me results.
I am looking for end-to-end setup preferably the server would run on Ubuntu.

Siddharth,
You may want to consider CloudMunch for this need. All you need to do is launch the emulators as part your pipeline to test various stacks and finally get an update over mail. Robotium scripts can be called over shell and reports will come to you as mail at the end of the test.

Related

Android Build Server for a 1 Programmer "Team"?

Would you recommend the overhead of installing & configuring an Android build server for a 1 programmer project?
The alternative is to upload all sources from development computer to git, download to another computer with Android Studio & Android SDK, and build from Android Studio.
If the answer is yes, would you recommend Jenkins, or another solution?
IMHO, yes, if you have significant time to set it up and maintain it on a separate machine. (I personally would not use a shared machine: too many reasons to restart and disrupt it.)
I feel an extra level of confidence each time I check in if Jenkins builds the whole project successfully from a fresh dir (one less thing I have to do.)
If I forget to check in an important file, Jenkins complains. Or, if I code something that generates a new Lint warning, Jenkins puts a spike in the graph. In other words, on solo projects, Jenkins is like an assistant (or mentor) that helps check my work.
Jenkins can warehouse app installers for future reference. So, it also helps me stay organized.
Jenkins offers some nice communications capabilities too. You can have it automatically notify others via Slack, or put an installer on Dropbox, or, through a service like Zapier, create a custom card in Trello. So Jenkins gives me an outward-facing messenger and delivery service.
These are some plugins I have found useful with Android builds:
Android Lint
Credentials Binding
Environment Injector
Gradle
Slack Notification
ThinBackup
Version Number
Zentimestamp
Of course, this only scratches the surface.
It requires some ongoing maintenance work though. And sometimes it's confusing/challenging to configure. (e.g. some plugins are poorly documented or no longer actively maintained. The linter in Android Studio is not exactly the same as the default one run through gradle by Jenkins, etc)
When I first set my build server up, I had a couple weeks of downtime when I was able to experiment with different plugins and troubleshoot the server. I probably wouldn't have done it without that empty window of time at the start.

Automation testing with ARC?

I'm currently using ARC to manually test my app, but am hoping to move towards automation of the testing process.
Is it possible to use ARC to automate tests, something similar to what Selenium Webdriver does for FF/Chrome?
I know it's still early in the development process but something like this would be incredibly helpful.
Yes. ARC supports the Android adb "shell instrument" command, per the Android documentation
See the Getting Started document for starting adb.
If you create an .apk for the tests that is separate from the .apk being tested, you will need to bundle both .apk files together in the .crx package. It should be straightforward to incorporate doing that and launching the tests into any build/test environment.

What tools use and how do continuous integration and test in Android with eclipse?

I have some experience in Android, and I have been working always with Eclipse. Now I want to start to develop doing test and continuous integration, so I have been researching in Google, but I have found so much different information, and I'm a little confused.
I have seen Jenkins as a good option for CI server, Robolectric for tests, and I have read about ant, maven and gradle, but, are this the best options? How I configure this tools to work together in Eclipse? Do you recommend me something better to start?
Thank you
For my part, I use Android Studio, and gradle. I use TeamCity as the continuous integration server, which supports Gradle.
I have my unit tests launched automatically by TeamCity, using Gradle, on a desktop Android device (kind of mini-computer), it's pretty usefull.
I've started tests with a phone plugged in USB on a TeamCity agent, that works very well too.

Use of CTS in android source code

I have run android CTS test case for ics on custom board. AOSP had their own cts/ folder under android/ folder. I'm having two questions.
What is the use/role of cts/ in building and flashing android on board?
Why we download CTS from site to run cts test cases, instead of using source code's cts?
For your first question, CTS doesn't play any big roles in flashing android onto a device. It gets included with the build when you repo sync so it stays synced with your version of android.
As for why you download it off the site, there's 2 good reasons. One, most people who run or execute CTS are not interested in downloading, and building, an extremely large project just to make sure their device is compliant with that version of the android sdk.
Two, the CTS package you get off the site is what is going to be run by everyone, and not the CTS that gets built from your machine. If you create an AOSP fork, the the person who uses your ROM will still want to make sure that it is CTS compliant. They need to use the package from the site because they need to know it hasn't been tampered with. You could easily change CTS so your device passes your version of CTS, but that doesn't help anyone else.

Continuous Integration for Android via TeamCity. Preferred tools?

Our team is new to both Android and Java development (originally, we came from C++), therefore our knowledge about build tools for java is pretty shallow.
There are few build tools which can be used for build automation, and the most interesting I found were ant and maven. And although there are many articles on build automation, I didn't find any comprehensive tutorial on automating Integration process for android apps.
I would be very greatful if you could state your preferable build tool for Android and explain or give any links explaining the process of continuous integration for android apps (which cover not only building application package, but running tests under the emulator).
Thank you very much for your time and assistance.
P.S.: We are using Team City as the Continuous Integration server.
We are building our continuous integration platform for Android using the following:
Maven - for managing the build/unit-test/integration-test/deploy cycle
Hudson - for continuous integration
Team City will also run Maven projects - it is fairly simple to configure a TeamCity agent to run a specific Maven goal e.g. mvn integration-test - the agent could be running on a PC with an Android emulator or a real Android device plugged in.
In the past I've had a whole bank of TeamCity agents testing against different hardware. For example if you have 5 Android devices plugged into an agent you can configure the TeamCity build pipeline to run the integration tests (controlled easily via Maven) on ALL 5 devices and only declare a PASS when they pass on all 5.
Ant (http://ant.apache.org/) is pretty much the de facto standard for building java projects. It features a very easy to learn scripting language and can even be used to deploy your application to multiple targets.
For automated testing, most java developers use jUnit (http://www.junit.org/). While not quite as seamless as the Ruby on Rails testing framework, jUnit tests do allow for test-driven development.
Maven (http://maven.apache.org/what-is-maven.html) is more of a meta-program that can use ant scripts and run your jUnit tests. True, ant can also be used to run jUnit tests, but Maven does a good job of pulling all of that together as well as providing extra functionality (example: the ability to automatically find external dependencies and download them).
While I am not familiar with TeamCity, I would be surprised if it did not have a way to integrate with ant/maven/junit.
Best of luck!

Categories

Resources