How to use Sikuli for Android testing? - android

I am testing an Android application with Sikuli, but each time the test runs the behaviour is different:
the test stops at the first command, not finding the first image
finds only some images and the test stops at a particular image which isn't found
finds all images and the test runs successfully
Sikuli is runned on Windows 7. Does anyone know if it's a problem of focus or something else and how to solve it?
Thanks

Maybe you can fix your recognition issue by changing the matching level. From Sikuli Gui :
Click on the image
In Pattern Settings > Matching Preview, drag the Similarity bar to a value below 1.0 (try different values)

You may also need to add a delay for the browse button to appear on the screen. You could try something like this
wait("Browse.png", 10 ) # Wait for up to 10s for the app to load
You might also try increasing the size of the picture that you are matching to. Try including nearby artifacts. Remember that you can change the location on the picture that is the mouse click point if your Browse button is not dead centre.

You can try any click action twice, using a try/except block.
Sometimes the vision algorithm just fails.

Running the Android Emulator (for anything) is paaaainffullly sloooow and arbitrary.
So, it pays with Android ems to make Sikuli statements a little "smarter,"
like this:
wait(browsebutton.png, 20)
onAppear(browsebutton.png, click(browsebutton.png))
Looks busier, but it makes the script "smart" in both waiting for the button, and then clicking it as soon as it appears (instead of waiting twenty seconds if it appears after five).

Related

intel xdk tap/click not working

I have a problem using the intel xkd.
I used it for 2-3 month and it worked well.
Since the last update, my app doesn't work anymore.
The application works, but it seems that the device doesn't handle the tap on screen.
if i click on a button with the mouse on the pc it works, but i i tap it on the phone the event doesn't work.
I don't know why.
if i start a new project from a default template the problem is still there so i think it's a problem related to the XDK/Cordova, but searching on their forum i didn't found nothing.
Check the js file via the embedded editor. There's a high probability that you will see errors/warnings. It could be a missing semicolon or an unclosed bracket.
Secondly, add onclick like this:
function Tap(){
alert("tapped");
}
<button onclick="Tap();">ClickMe</button>

How to stop logcat from scrolling in Android Studio

I used Eclipse before and I could easily stop logcat from scrolling, but I can't find same funcionality in Android studio. Anyone knows how to do it?
There's no dedicated button for this, but you can just click on / highlight some text around where you want to stop scrolling.
android studio have this feature
you just click on the line three times and you can selectd the line , it will stops scrolling.
I had the same issue. Simple solution:
In Android monitor, on the right, change No Filters -> Show only selected application.
Android Studio Stop scrolling log
Disable Scroll to the end
If not - you are able to scroll to necessary line manually and LogCat will not be automatically scroll to down
I actually just had a problem (in 1.2.2) where I couldn't keep it from scrolling. I tried all the tricks and proper methods mentioned here, but it kept scrolling out from under me.
Turns out there was a problem trying to connect to an emulator that had long since been disconnected, and it kept retrying. And every time it did, it reloaded everything causing logcat to refresh. So it wasn't REALLY scrolling, it just felt like it was because of how big the buffer is.
I unplugged my physical device (that was running along side the emulator), restarted Android Studio, plugged the physical device back in, and boom, it no longer kept "scrolling".
Hopefully this might help someone else. Because I was getting incredibly frustrated for a while, there.
Goodness, the trick is to search. Search for something within LogCat and then scrolling will stop. Tested: running Android Studio 1.1.0 against a real device (S5). Also, was ticking one line up and one back down until I then right clicked. Then it totally stopped. After that, I can remove the search and the scrolling is no longer automatic.

Eclipse won't run Android app until I click Run a few times, no feedback or status information

I've started Android Development and I'm using Eclipse for the first time in years, coming from a Visual Studio background. When I click Run in Visual Studio I begin to get feedback immediately. Using Eclipse however, I get very little feedback and it's only after a few clicks of the run button.
It normally takes a few minutes for the app to run after making even only the littlest changes to the UI XML, and I will see nothing in the LogCat or Console tabs. I'll click run.... nothing, click run again after a few minutes.... nothing, click it again after a few minutes.... and finally it'll give me some feedback that it's launching the app.
Is there any way to improve the responsiveness / feedback I'm getting?
Yeah....just waiting. You don´t have to push the run button many times. I would be happy if there where another solution, but fact is, that the emulator is terrifying slow. Even this depends on the properties from which You created your AVD. There are some setting when creating a new one, internal storage and ram size. The lower these values are the faster it creates an emulator. This depends on what You need, if You don´t need sd card storage, disable it. If you don´t need much ram size, set the minimum. Even there are some tricks to speed up a little bit:
http://developer.android.com/tools/devices/emulator.html#acceleration
It seems that there is a faster alternative emulator, but I hadn´t tried it:
http://enisgeeks.wordpress.com/2013/03/21/an-amazing-alternative-to-android-emulator/

Any way to speed up the Debugging of Android Application?

I'm building the android application but I'm fed up while I'm designing my app every time I change even font size I will have to wait for re-installation is there any way to speed up this designing way?
and also
if I change the code every time I'll have to debug is there any way to speed up this task too?
My main question is if I navigated to 10 Activity and the changes are in 11
then I'll have to re-navigate every time I would be hectic. I can not move directly to the 11th activity coz I need some values from the previous activity and one more thing
something like on-web page we do just refresh that particular page and see changes
##Note: This question will help you a lot with this problem see here
I have felt that debugging on device directly is faster than using emulators. Also, if you're working in windows, its a little slower than Linux and MacOS. You can try those platforms too
Sometimes, it is inevitable that you have to re-install the apk to test some changes. In order to speed this up, the only way will be to try to fine tune your system, so that it runs faster.
For testing a simple change, like a new font size, you don't have to reinstall the apk however. You can visualize the changes inside Eclipse or use a tool like DroidDraw.
Yes, there is a faster way though, first step run the debugger in Android Studio. The first thing you notice is debugger breakpoints might slow debugging dramatically(something like that). Then click on this ...
Here you can see all the breakpoints you have in your project.
You can remove debug points left in your project in the bottom box.
This boosted my debug process in any device this is the best solution.
kishu27 is correct by saying that debugging on a device is far quicker than using the emulator. If you don't have a device available, you can keep the emulator open between runs, so you don't have to wait for it to initialize each time (which really is painfully slow).
Another tip - if you have a lot of resources in the project that results in a large APK file, you could take out all the unnecessary ones while you're debugging a particular part of the application. This can speed up the installation process if the APK becomes a fair bit smaller. (This comes from experience when I was writing an app that had many sample videos in for testing - cutting out all but one and using that one wherever possible when it didn't matter what video was there meant the APK was far smaller and vastly sped up installation time.)

Can we shrink Android as an OS to use only 70-80% of the actual screen?

What I want to achieve here is to shrink all of the Android's OS UI (everything inclusive) to use only 70-80% of the screen.
The reason is that I wish to have my area to put in whatever I want - apps icons which exist and are always visible (no matter if I am in a browser, or playing angry bird etc).. its like Windows's quick launch or Mac's dock which always stays there . I can also put some important text that I wish to see throughout my interaction with the device or anything else.
I just want to use 20-30% of the screen-size all by myself and run Android on the remaining portion of the screen.
Do you think it is possible? If so, can you please give me pointers?
Thanks much,
Rohan
There are two solutions for me:
1) create custom Android build. Change WindowManager code a little.
2) create own virtual keyboard which will serve keyboard and your stuff (http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html)

Categories

Resources