[aerogear-dev] Automatic quickstart ftesting solution

Stefan Miklosovic smikloso at redhat.com
Fri Apr 3 03:48:13 EDT 2015


Hi Daniel,

yes you can test it with emulator, meaning you create AVD and provide
avdName to arquillian.xml, in this automatic scenario it is little bit
more complicated because you need to add there avdName parameter
exactly here (1). Notice that arquillian.xml file is empty regarding
of property values, they are filled by test script dynamically here
(2). Then you have to be sure your Android SDK is installed in a such
way you have Android AVD of Google API.

To not mess with bundled Android SDK in the test (3) script, you can
point test to your local Android SDK installation where, I guess,
everything is already downloaded. You just need to provide paths to it
here (4)

I abandoned emulator testing because I have some problems to automate
it and I was not able to get push message on it. Maybe I just did
something wrong. It seems you have to have Google API based emulator.
This is not very important issue for me right now, core interest was
given to physical device when it comes to push notification receiving.

(1) https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/quickstartTests/aerogear-push-helloworld-cordova/src/test/resources/arquillian.xml#L4
(2) https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/build.gradle#L1004-L1008
(3) https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/build.gradle#L627-L633
(4) https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/build.gradle#L1010-L1016

On Wed, Apr 1, 2015 at 4:18 PM, Daniel Passos <dpassos at redhat.com> wrote:
> That is really awesome. Is possible create and use an emulator instead of a
> real device.
>
> -- Passos
>
> On Wed, Mar 25, 2015 at 12:37 PM, Stefan Miklosovic <smikloso at redhat.com>
> wrote:
>>
>> Hi,
>>
>> I think few days ago there was some information from Karel Piwko that we
>> developed fully automatic functional tests when it comes to Cordova
>> quickstarts (1) (hello world and shoot and share)
>>
>> We think that it could be useful for developers as well. This tests the
>> whole life cycle of the push from creation of UPS cartridge through building
>> of the example to the functional test in a fully automatic manner from zero
>> setup to push notification receive at mobile device you have connected to
>> your notebook and it could be useful for developers in order to not execute
>> it manually every time and set it up all over again.
>>
>> By what I mean "fully automatic" is the following scenario:
>>
>> 1) Automatic creation of UPS cartridge on OpenShift right from our test,
>> patched with this extension * (2), (3)
>> 2) Because of the deployed extension to UPS in 1), we can login via REST
>> and we do not need to change passwords so we can create application with
>> some variant directly from our test script (4)
>> 3) After this is done, quickstart example is downloaded from GH, Android
>> SDK is installed locally at your PC, quickstart is filled with application
>> and google credentials automatically and after that it is built
>> 4) APK built in 3) is then used in functional test by Arquillian Droidium
>> (5) which deploys that APK to physical device and in that test, we send push
>> notification request to UPS
>> 5) Once push notification comes to UPS, it sends it to GCM which in turn
>> sends it to physical device and Droidium test asserts that the message
>> really came and appeared on the mobile device.
>>
>> It takes about 10 minutes, you have to have Android device attached to
>> your PC since test will communicate with it. Time could be massively
>> decreased when you do not expect new OS UPS instance to be created every
>> time.
>>
>> You execute it like this in
>> https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests
>> repository
>>
>> ./gradlew test -Pprofile=helloWorldCordovaQuickstart \
>>     -PgoogleProjectNumber=<your  project number> \
>>     -PgoogleKey=<your google key> \
>>     -PopenShiftUsername=<email of your openshift account>
>>     -PopenShiftPassword=<password for your openshift account> \
>>
>> -PopenShiftCartridge=https://cartreflect-claytondev.rhcloud.com/reflect?github=aerogear/openshift-origin-cartridge-aerogear-push
>> \
>>     -PopenShiftAppDirectory=aerogear-push
>>
>> Similar process is executed with Shoot & Share demo where we send image to
>> Facebook. All triggered by one shell command from integration tests and
>> after that the above magic happens.
>>
>> I case you want to use it and you struggle with it, feel free to ask me
>> for guidance.
>>
>> * unified-test-extension adds custom functionality to UPS cartridge, it
>> adds fancy performance test endpoints where you can feed UPS instance with
>> custom number of generated installations / categories / variants and so on.
>> More to it, it can put proxy behind sender API so push notifications goes
>> nowhere in the end but it seems like they were indeed sent from UPS point of
>> view. This is particularly handy in test environment where you really do not
>> want to send anything to APNS or GCM.
>>
>> (1) https://github.com/jboss-mobile/unified-push-helloworld
>> (2)
>> https://github.com/aerogear/aerogear-testing-tools/tree/master/unifiedpush-test-extension
>> (3)
>> https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/build.gradle#L354-L356
>> (4)
>> https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/build.gradle#L472-L543
>> (5)
>> https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/master/quickstartTests/aerogear-push-helloworld-cordova/src/test/java/org/jboss/aerogear/push/helloworld/cordova/test/AerogearPushHelloworldCordovaTestCase.java#L65-L85
>>
>> --
>> Stefan Miklosovic
>> Red Hat Brno - JBoss Mobile Platform
>>
>> e-mail: smikloso at redhat.com
>> irc: smikloso
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev



-- 
Stefan Miklosovic
Red Hat Brno - JBoss Mobile Platform

e-mail: smikloso at redhat.com
irc: smikloso


More information about the aerogear-dev mailing list