Travis CI still failing with Espresso test - Android - android

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.

Related

How to implement android espresso tests in the bitbucket pipeline?

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.

Automate Android Espresso test cases using Jenkins

I've been trying to automate android espresso test cases using Jenkins pipeline on mac mini, we have pipeline up and running for Android build and sonar test cases are not included. I have installed SDK created AVD and Emulators as well but unfortunately I'm not able to make it run the test cases.
(environment variables JDK, Android SDK, Gradle, Git in Jenkins config is all setup correctly)
Is there any blog/Article that can help me to setup the pipeline cause I'm running out of options, I googled but no luck, found some articles but those were outdated.
Please suggest if you have any ideas or if you have worked/working on same scenario..!!

What is the best location to store Appium tests? Same Android repo? separated automation repository?

I am developing an automation framework using Appium and Webdriver. I have a bunch of classes for the framework and JUnit tests. Everything is working in a separated repository in which the appium server is initialized, the tests run and then the server is terminated.
My question is if I should move those tests into the Android app repo, in order for the developers to have a more confortable access to them and run the tests against a dev or debug apk.
Some questions:
1) Should these appium tests be located on the test folder (unit tests) or androidTest (instrumented tests)?
2) How is the best way to execute test tasks in gradle in order to generate an apk (with different flavors/environments), install it in a phone or emulator and run the tests?
I haven't found a lot of examples answering these questions in the web.
Thanks!

how to run tests on amazon device farm using travis CI

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.

Make Android jenkins build fail if tests fail

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.

Categories

Resources