I need to find a solution to test some render scripts. Basically are some applications that display some animations on the screen. If the animation is displayed the test passes if not it fails.
I don't have the sources for the apk.
Until now using monkeyrunner i used to take 2 screenshots and compare them. If the two pictures where different the tests pass. Now because of a bug in android emulator i cannot take screenshot anymore.
If you can't take screenshots using MonkeyRunner, I'd suggest trying to take a screenshot on the device using a shell command, pulling the resulting image to the host computer and reading the image to a MonkeyImage.
First, get the device to take a screenshot on it's own:
monkeyDevice.shell("screencap -p /sdcard/screen.png")
Second, pull the screenshot from the device:
from subprocess import call
call(["adb", "pull", "/sdcard/screen.png"])
Third, load the screenshot as a MonkeyImage
image = MonkeyRunner.loadImageFromFile('screen.png')
Now you can compare the images using image.sameAs like normal.
Note that MonkeyRunner.loadImageFromFile was added in SDK version 13.
Related
I have 200 android tablets all the same make and model and identical. I want to get one of them and install a few apps and make changes to some settings and so on and basically personalize it and then create an image of this device and clone it to all other 199 devices.
This is to avoid the time that is required to personalize all the devices one at the time. These are MTK base and I can use SP Flash Tool to load an image to them but I don't know how to build an image from one and then load it to others.
Thanks,
There's a chance to change the screen size and density of an already created genymotion machine by going to the machine on the genymotion launcher-> configure-> Screen size - Density.
I'd like to do this through a shell command, does this command exist? How can it be called if so?
For now it is not possible.
But we will soon release features related to continuous integration and automation. A command line tool will be included on these features. It allows you to do all what you can do with your mouse, but through the command line. And it will be available to paid licenses.
Editing the screen size and resolution is part of it.
Here is a demo we gave at Droidcon Paris
My situation in a nutshell : http://i.imgur.com/wUpMgX5.jpg
This is my main.lua file: http://pastebin.com/1t2rhim1
Anything in main( ) starting in ---PLAYER--- does not show up when I try to play the .apk game on my Samsung Galaxy Note II. Everything is fine as I intended when I simulate it on the computer.
My game is basically a title screen, where I press on a word and then it jumps to displaying a background and draws out a D-Pad, 3 buttons, and 2 characters with their HP/MP bars, whereby it becomes a fighting game. However, only the background appears.
I've tried disabling the background, but the other images just do not appear.
I don't know if its because my Corona SDK is not the pro version, so there's a limit to how much I can draw, or,
There's issues based on the screen resolution, however I have been coding this game with a Galaxy SIII or Note II resolution in mind (1280 x 800), so the characters shouldn't be appearing off screen or anything.
--
And if that works, I don't understand how to have an infinitely updating loop. I am semi-familiar with Java, a bit less so with Python, and totally new to Lua. I want to modularize my code more as well.
How do I loop? I want to get an AI working, but currently that code is only run once. I tried putting a while-true-then loop at the end of my main function, but it crashed my simulator.
Not sure why your sprites wouldn't be showing, but not having the Pro version is NOT the problem. The free Starter Edition of Corona SDK can do everything the Pro version can do except in-app purchases.
I don't see anything wrong at first glance in your code, but did notice the files that load, like the background image, are stored in the root of your project, at the same level as main.lu -- while the sprites that don't load are down in subdirectories. First thing I'd do is check the names of those folders - are the folders Dennis and David actually capitalized the way you have it in you source? The simulator won't care, but the device will.
As far as the infinite loop goes, you can create a Runtime listener that can call a function every frame, like this:
Runtime:addEventListener("enterFrame", myUpdateFunc)
That myUpdateFunc function will be called 30 or 60 times per second, depending on how you have things set up in your config.lua file.
[EDIT: Looking again at how you're calling for the sprites, do you really mean to have the slash in front of Dennis, etc? Even if the case is correct, I'm not sure you mean what you're saying in that code. :)]
Android and IOS are based off linux that means its case sensitive. Its a common problem that people don't care about the case when creating display object or playing files or just loading story board scenes. It means that the game will run fine on a windows system but it won't run properly in linux.
Try checking the files you are referring in the code matches the file names in the project folder (check the case of the file name).
Hope that would fix your problem.
Make sure you you are not running into the typical problem of file name case sensitivity. The simulator ignores the case of the letters that make up the filenames, where the device is sensitive. This is easy to over look and miss. Check all filenames, not just images. Check your audio, your .lua files etc.
Also make sure to tether your device to your computer via the USB cord and use the "adb logcat" command and make sure you're not getting any errors on device.
There are only 3 reasons for that:
1. file name case sensitivity
2. Texture memory is not supported for your device.
3. There is some error in the code.
All these can be checked by putting print statement and connecting your device to computer and see logs by using "adb logcat" command.
Its because you created the background first. Move it to under the buttons and images and it should work.
I tried changing the screen resolution in build.prop file in system, but it requires re booting.
I need a solution for changing screen resolution on android devices without re booting.
Thanks,
Krishna
Unfortunately that is not possible. Everytime when Android boots, it will read the build.prop file and set parameters pointed by it accordingly. After it has booted, it will not access that file dynamically to change parameters. So for any change to take effect, a reboot is compulsary, you cannot escape it.
Set resolution (e.g. 1024x768):
$ am display-size 1024x768
Reset:
$ am display-size reset
Doesn't require a reboot. This works with Android 4.2. Solution for 4.3 is mentioned by LiTTle
There is also an App for that called NOMone Resolution Changer.
Android can change the screen resolution.
I think that you need Android 4.0 and above version.
Only things you need is terminal emulator and root access.
Reproduce the following steps:
1. Open the terminal emulator app.
2. Type su.
3. Type wm.
Read the help message appeared and you will understand...
In case you want an App take a look at this on Play Store or the source from Github.
I spend many time testing orientation changes, going back, changing again etc etc..checking if fragment are loaded correctly..
has anyone think about a process to test that issues or use a tool for that?
thanks
Using Robotium, you can change the orientation by simply calling:
solo.setActivityOrientation(Solo.LANDSCAPE);
or in JUnit:
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
I'm not really aware of an existing method of automatically testing with several screen sizes, but it would be easy enough to manually run the test using a different AVD if you configure AVDs for each screen resolution you want to test with. You could probably start various emulators and run the tests all from the command line on each emulator using something like the following (if you're using a Unix like operating system or Cygwin):
for i in avd_1 avd_2 avd_3
do
emulator -avd $i &
PID=$!
adb wait-for-device
adb -e install path/to/your/app.apk
kill $PID
done
where avd_1, avd_2, etc. are replaced by your android virtual device names for the devices with the different screen resolutions.
You might want to have a look at the Spoon test runner. It will run your instrumentation tests on all connected devices and can also make screenshots during the test to help you see the results visually.
If you want to run your unit & HMI tests on multiples emulators with different Screen size and resolution, the best thing to do is to setup a Jenkins with the android emulator plugin.
It allows you to define matrix jobs and check if your tests are ok on several platforms:
It will be painfull to set up but the benefits are really great!