how to do cross app automation testing for android - android

lots of apps now need to interact with other apps. i'll give some examples:
take picture by calling system camera
open url like http://www.shihuangzhilu.com in a browser
android instruments can only test one app per time. can we do automation testing here?

You can't explicit definitely not using the current testing framework of android.
What you can do is use robotium, and then check if you have gotten the values back, and that you are no longer within your application/activity, that's the only way i can think of.

Yes, you can test across applications, see monkeyrunner:
http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html
(not to be confused with Monkey, another android tool)

Related

How to use Android UI Automator without access to source code

so I am trying to learn test automation on an Android, Basically I want to learn how to use Google's UI Automator, however, it seems like all tutorial that I could find requires me to have access to the source code of the app under test.
I found this repo AndroidTestWithoutSource it uses espresso but requires me to re-sign the APK.
My target environment basically is a production test environment I mean like install the app under test on an android device then connect the device to my PC through ADB, for learning purposes I like to test youtube or even the native settings app.
Is my goal even possible with UI Automator? like being able to test apps installed in the device like appium does?
I would really appreciate a sample to that launch youtube app just to get me started.
Thank you!
Yes you can for instance use UI Automator viewer to get the resource ids (textview ids, edittext ids, etc) you want to click or act on.
After that you can write a UI Automator test that starts the app you're going to test (having the package name) and acts on the resource ids you previously collected.
Hope this helps.

Create a code that installs an application and runs only that application

I need a device that runs only one custom application and does not allow the Users to access any other features. Building a complete device would involve a lot of time and money for sure(only if this can be done with android). This can usually done for each android device seperately. It could be better if there could be simply a piece of code that can be simply executed on the device that installs the application and at the same time restricts the device as per requirement.
Could someone advice me a way to implement in the Android devices. Is it something possible :(
Would also like to know if the same is possible with iOS..
Thanks..
If you want to be absolutely sure that users cannot do anything but accessing one specific app, the only way to do this is to create a custom ROM that allows to install your app only.

How to execute apk inside another apk

i'm developing an app that runs in some tablets. these tablets are rooted and the user that uses that can't go out the single app that tablet run. If i want to use an external app inside my app is possible? Like an emulator inside my app.. Thanks!
Technically to run android application inside android application you need and android emulator on your Android device, which needs lots of CPU, and is neither implemented now, nor a good solution for any problem that you may be facing. Theoretically it's possible but technically - very complicated and to my mind useless.
You should try to find a more elegant solution rather than this. The simplest thing you can do is to make incapsulated switching mechanism between your restricted apps or think about solution how this apps can be integrated.

Use an intent from another Android application or use code?

I am writing an Android application that uses some functionality that has been published under the Apache 2.0 license. The functionality is available in 2 ways:
As java code
As an intent in an Android application.
Being the typical developer that I am, I don't want to make the user install a separate application so that they can use my own application - because it would definitely put me off using the application if I had to.
On the other hand, doing the work to get the application up and running using the Java code will take much longer.
My questions are thus:
What are most developers doing now? Are they using intents from other apps?
Does it matter to the average consumer that they need to download a separate application to make it work?
In my application EmailAlbum, I first depended on the presence of OpenIntents OIFileManager on the user phone to pick a file on SDCard or chose a destination folder for exporting a generated file.
Later, I integrated my own version of the code of OIFileManager in my app's source code for several reasons:
Depending on another app for basic (but essential) application features is like a suicide. If your app can't really live without the other app and this app is not installed on most devices, your app won't get used. Most people want apps that work on first start.
Another app was on the market which was providing it's own (bad) implementation of the same intent and was making my app crash... users having it installed on their phone thought that was my app's fault.
Providing a consistent UI was not possible.
I think using public Intents is great to allow people to chose from various applications to extend your applications features or to reuse the content generated by your application. BUT your application has to be able to live on its own, depending only on standard apps provided with ALL android devices (ie. not even depending on Google proprietary apps if you want your app to be able to be used on devices which have not been approved by Google, those which come without the Android Market or GMail).
Most developers are going to use a common intent (phone call, web browser, camera, etc.) to call an activity. If your app replaces one of these common intents, then you shouldn't have anything to worry about.
Developers do sometimes include intents to use other (non-common apps). One example that comes to my mind is OpenWatch that provides an API for other developers to build on. Of course, in this case, if you are using a bluetooth watch like this, then you most likely already have OpenWatch installed, therefore it isn't much of a bother to get another app that builds on top of it.
If you think people are going to use it, I'd say provide an API.
Might also want to take a look at here: http://www.openintents.org/en/
I think even google had an app at one time that depended on a third party package. At application startup the user was greeted with a dialogue that asked him to download said package. If he declined, the respective functionality was disabled.
But I'd only use that approach for tech savvy users, the regular joe will much likely be put off by it. If the functionality isn't crucial, just use it as an added bonus and leave it out otherwise.

Showcasing Android app on a website

I have an app in Android Market which is a standalone app that's essentially a full conduit to an SQLite Database(add, change, delete, inquiry). Some of my potential clients have asked to see a sample of my work, but they don't have an Android device.
Other than just showing them screenshots etc., is there a way I could have them go to a website where they can actually run it & check it out.
I'm thinking there would be a programming element involved (convert app to a mobile website essentially?), hence posted this question here.
Not quite sure where to get started. Any help would be appreciated.
You can use one of the patterns like MVC/MVP/MVVM to create your core library and then develop additional UI variants for different clients: Android, java applet etc.
Alternatively you can develop a mobile web site as you suggested and use simple android app to navigate built-in browser to it. This might be somewhat transparent to most users. I think Android MSN client uses such an approach.
I see 2 relatively easy options.
Give them an .apk designed to only
run on the emulator (you can check
the ID, the emulator ID is 00000...)
and they can boot up an emulator and
run it. If you're worried about them
reverse engineering your .apk you
probably shouldn't go down this
route. Or if you don't want them to
have to install the emulator
Set up a virtual machine and let
your clients remote desktop into it.
Give them permissions to only run
the emulator or however you want to
set it up

Categories

Resources