arquillian android container implementation
smikloso Jan 3, 2013 12:29 PMHi all,
I started to code a container for android devices, I just took the whole concept of Arquillian - creating archive locally, deploying it to the container which enriches it and tests are executed - to the Android platform, so I basically code against DeployableContainer (1). I am doing it like managed container.
I know that there is Arquillian Drone & Android extensions, on which the code is based heavilly, but just internal logic is little bit different, I am following container lifecycle and all that pattern, inspite of using observers and events.
I polished the code a lot, refactored it here and there, repaired some bugs and made the code more concise and robust, I added some features too, e.g. automatic creation of AVD in case none is defined in the container descriptor (plus all possible combinations, e.g. when phone serial code is bad, avd is started, if it is not present in the system it is created and deleted after tests and so on ...)
The main reason I am writing this thread is because I am litte bit on the crossroad right now. I do not quite understand how to implement deployment of the archive to the android device as such. I have (in my head ) all concept of testing of native android applications, not only web-based one, but the crucial point is to somehow be able to get that archive to the android as such. There is a way how to install some APK via AndroidDevice in Android extension but I would like to make it in the way you can specify @Deployment method as easily as via normal containers and you do not have to install it manually in test methods like here (2)
I identified two ways how to deal with it:
1) create APK archive for ShrinkWrap just the same way as JavaArchive is done - means coding the whole fluent api for the apk archive
2) install prepared APK file manually via means of AndroidDevice in the Android extension.
The first options seems to be more "clear" but it is also harder to do. But it opens so many doors to hook other features ...
The second big problem is that I am somehow lost in the programming as such, following this image (3) I am just on the "Container Deploy", I am about to code the part between "test method" lines, where things are going to be, from the implementation point of view, really complicated. I guess I has to implement AuxiliaryArchiveAppender but do I have to implement my own DeploymentPackager? What's the difference between AuxiliaryArchiveAppender and AuxiliaryArchiveProcessor?
In general, it is a good idea to code against the container.test.spi.* interfaces? How about the "another side" of the test? I am not quite sure how to catch all these things in the android device. Do I have to implement my own protocol?
Thank you for reading this, you can check the code here: https://github.com/smiklosovic/arquillian-container-android
It does pretty nothing but it starts emulator or device, you are welcome to test it via test artifact.