Automation of Android APK with UI Automator - android

I want to automate an Android app using Google firebase test lab. I came to know that there are 2 tools with which we can do this.
Espresso & UI Automator: To use Espresso we need the App source code, but while reading some articles I came to know that we doesn't need App source code for UI Automator. I have even tried to use app source code of an hybrid app and found that there is only one element for App and not able to proceed.
Can someone help me how to automate an android app using UI Automator without app source code. I have my apk with me and not able to find any solution to run automation scripts using it.

The only way to automate android APK without source code is to use Selenium WebDriver, Appium or some similar framework, especially when it is not a native application.
For native applications, I strongly suggest to use Espresso.

Related

How to create stand alone UI Automator test using UI Automator testing framework

I use Appium to create instrumented tests. I would like to switch over to a native testing client for Android, and there appear to be a couple options
1) Espresso testing framework (for single app)
2) UI Automator testing framework (for multiple apps)
and as per the suggestion, I imagine I should use UI Automator testing framework since I will be testing multiple instances of the same app on multiple devices.
However, all tutorials and information on how to use UI Automator testing framework indicate its usage from within an Android application project.
So my question is, can I create a stand alone project, say like a Gradle IntelliJ project that is not coded from within an Android Studio project?
Is this technically possible?
edit
Even the sample app includes the test within an android app module project. If I can define any apk build I want, I guess I have no problem using an application project. Maybe that's the direction I need to go in?
edit
Just looking at the sample test, it looks like the framework is deeply coupled within the android project, and I'm disappointed I can't make a stand alone framework.
What I learned is I can create a separate app module with no app source, and only test code, then use a script to automate the install of the build from another app module.
However, the test code is run internally to the device as an APK, and thus testing is restricted to one device only AFAIK for now.

Where do we write Appium automation tests for apps whose source code is not freely available, like Whatsapp or Skype?

I need to learn how to automate Android apps such as Whatsapp, Skype etc. using Appium.
I followed this tutorial to get started. They have taught how to set up Appium. That I did successfully. Then they taught how to run a first test on an application whose code is available. I used a basic app I wrote to do it. That is, within the src code of the project in Android Studio, I wrote a test class.
Now the problem is that the code of Android apps such as Whatsapp and Skype etc. is not available. So how do we write automation tests for those. More specifically, where do we write automation tests for those when the source code is not available?
Do we write a separate android application to write those test classes for such closed source Android apps? I have searched on the web, but they all started by starting to write a test class etc. But I am confused about where to write that test class.
I think you are confused
1) Appium just only provides API to interact with the devices and
perform different tasks
2) What exactly you need to test, you need to write down as
requirement .
3) requirements can be written as test cases by using any client. e.g.
Java,Python,RobotFramework
4) Test cases will interact with Appium to do the desired tasks for
you.
May be below URL can provide you a head start
Robot Framework - How to start with Appiuum Library?
You need to create a separate project to write test case for the app. You can write test case in any programming language such as java, python, javascript, ruby, php and c#. You can use any ide of your preference.
To test the app you don't need source code. All you need is to know their appPackage and appActivity. For automation testing you must have unique id or automation id in the app's element to interact with that element. Read "How to find appPackage and appActivity" to get appPackage and appActivity.
To inspect mobile element you can use appium desktop inspector. Learn how to use Appium Desktop Inspector.
Required tools
Android Studio
node.js
Appium Server
Appium Desktop: Here is the tutorial
IDE of your choice, i am using intellij idea
Required jars
Java-client 6.1.0
selenium java 3.14.0
Testng 6.14.3
Here is the basic tutorial to get started with appium.

Regarding instrumentation test cases for APK

I have developed an Android application that parses RSS feed from a website.
I have developed instrumentation test cases for application since I have access to code. So far everything is ok.
Now I want to ask is there any way or is it possible through which I can develop instrument test cases for apk when I don't have access to code.
If yes then what are all components in Android that can be tested through.
Thanks in advance
Now I want to ask is there any way or is it possible through which I
can develop instrument test cases for apk when I don't have access to
code.
You can test it using Appium
If yes then what all components in Android can be tested through.
I have tested UI and flow for app.

how to test project using Android Test Project

i am new in test android project. just i try to test sample hello world application. its working. i refer the following link
https://developer.android.com/resources/tutorials/testing/helloandroid_test.html
i have one doubt can i test whole android project using android test? its possible?. otherwise that android test only applicable for small applications. i want to test tabs and web service hitting and lot of functionality using android test project.
any one can help me?
JUnit test is possible for android application.if you want to test an android application then you use testing tool like robotium.here you follow this link
http://code.google.com/p/robotium/wiki/Getting_Started
Robotium is a test framework created to make it easy to write powerful and robust automatic black-box test cases for Android applications.

Android Test Automation

How can i automate Android Apis for better quality ? How can i test the android applications to get a better quality of this software..?
I would recommend you checkout Robolectric for testing Android apps.
Use Robotium, its a good tool to use for Android Automation
http://www.robotium.org/
Try robotium, i am using it, Its very easy for writing your Functional Test Cases and can be tested in all android Devices.
Espresso is the best option coming forward to automate the android API's. Google has developed this testing kit for developers to write the unit test cases. Here's the Google's home page for espresso
https://code.google.com/p/android-test-kit/wiki/EspressoStartGuide
Google has also implemented the sample test cases which help to learn espresso faster. Main advantage of espresso is its speed of execution and its work asynchronously meaning we are not explicitly required to write wait for actions in espresso. Developer should only perform action, waiting time taken care by espresso.
Here's link which gives start to espresso in easy to understand way:
http://www.stevenmarkford.com/android-ui-testing-with-espresso-basics-tutorial/
I would suggest you to use Seetest.
This is also an automation tool independent of any platform. You can run the same test script across all the platforms like Android, IPhone, Windows Phone using this tool. Moreover it has a plugin for existing test frameworks like QTP, Testcomplete etc. Here is the link to download the trial version of the same.
http://experitest.com/support/download-2/
I would suggest Webdriver/ selenium 2.0 android driver if you are looking for open source. its good and robust as well
Try bot-bot. Its a functional automation tool built over Robotium/Nativedriver. It have recording feature which helps in easy element identification and writing test-cases.
It uses "Ant" for build and running the tests. This helps in integration with continuous integration tools.
At the end of your test execution it generates emailable html reports with pass-fail status.
If you have a spare Raspberry-Pi, you can also use that to speedup your test :) , much better than running on Emulator:
Raspberry-PI for Android Test Automation

Categories

Resources