I want to use travis ci for the build process, It looks like a good option as they have emulators also. But I want to run tests on real devices, like Amazon device farm. I am not able to find relevant documentation for that. Any help will be appreciated.
To my knowledge there's not direct support for Travis CI. Admittedly, this is the first I've heard of Travis CI. If it has the ability to run scripts you can write a script to create and schedule the run in Device Farm.
Hope that helps.
Related
I am implementing CI in my android project, but I am not able to put my Android espresso tests to run in the pipeline. Can anybody help me?
You need to have devices to run espresso tests against. You can use services like a Firebase Test Lab and send your build to be tested there, and after the tests are finished, your results will be returned back to the bitbucket pipeline so you can continue with your CI process.
You can explore google cloud CLI, with which you can run bash scripts from your CI to send the build to the TestLab.
I've got my travis CI set up with espresso instrumental testing for my android library but some test fail on Travis CI while on my local machine (emulator and physical device) everything is okay and all test are passed..
I don't understand why on the server side someone fail, while on the local machine in my ide, with the same script command everything is okay.
Can someone help me out?
Thanks
Instrumented UI tests using Espresso Testing Framework depend on the emulator that you created.
We normally use Android Studio locally, and a different one in CI build servers.
The chosen server is not the reason of the failure, probably the screen size of the emulator.
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.
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.
I have seen several post regarding making a build in Jenkins fail if the unit test execution fail (e.g. this one). It turns out that by default Jenkins reports builds with failing tests as unstable and some people do not like that. This, however, will be perfectly fine for me. I just want to be able to easily differentiate builds with passing tests from such with failing tests.
And here is the catch: I am developing for Android so my build is configured following this page. Basically the tests are run with the following command:
ant all clean emma debug install test
As result coverage report is generated and published in Jenkins.
All posts I have read about configuring the Jenkins result according to tests results
were dealing with ant task manipulation. However, if we look at the android build.xml the Android tests are run with adb command: adb shell am instrument .... I don't know how to configure this command to print the tests results. It can be configured to print the coverage report. I have already done that, but was never able to make the build fail according to the coverage report.
I hope somebody else also faced the same problem and managed to solve it. Any guidance will be most appreciated.
Consider using 'the-missing-android-xml-junit-test-runner' - the idea being to produce jUnit reports that Jenkins understands. Disclaimer: I do have no personal experience with adb. However, I do know from experience that Jenkins deals with properly generated jUnit reports very gracefully.
This is possible, configure the server using the following documentation:
https://wiki.jenkins-ci.org/display/JENKINS/Android+Emulator+Plugin
See "Parsing monkey output" in the link.
Addition, Jenkins can test instrumentation, below have a link of a good place to start in the learning of instrumentation:
http://developer.android.com/resources/tutorials/testing/helloandroid_test.html
I hope it is useful.