Genymotion 2.5 Android testing and continuous integration

Just another WordPress site

Genymotion 2.5 Android testing and continuous integration

this one thank you all I think just Android people connected and we are ready now to a view to present you the new genymotion to that 5 release in this release we added a lot of feature around testing and tools to help you build continuous integration platforms using general Xiang the goal is as an emulator we have a wonderful opportunity to help in automation to a pin in injecting information right into the operating system as it is completely emulated and we control it perfectly it’s really easy for us to add tool to simulate a lot of different things and so we try to push them and to render them in a way that should be really efficient for Android developers so we will talk to the earth about that we are three people here you can see in Paris in our Paris office there’s two people say hi al hi I’m al I’m developer on genymotion and I’m also in charge of sometimes the developer relations the project then hi I’m on to now and I’m the scrum master of emotion and myself and Pascal on and the genie motion project manager we are here for our own one hour our goal is to show you this features on the show them around ring use cases with some code some demo of real application you can do to be able to be as near as we can of your typical Android projects if you have any question because there’s a lot of people it will not be really interactive that you can ask them in the youtube comments or even on the Google+ event we created just as the question until now we’ll take them all under at the end of the webinar it will ask them for you and we will not sell them so back please al can you switch to the next slide again oh there’s at first we will talk about gentle gentle hey it’s a command line tool where you can do everything you do today using your mouse engine emotion you will be able to do to automate them using gentle gentle it’s a really common line tool that allows you to manage genymotion on your genymotion virtual devices you can change the settings you can create device stop device clone them directly from the command line this with this is a wonderful opportunity for everyone that I’ve automation needs around on droid V of 12 devices but to go further we also created a Gradle plug-in that allows you to do that directly from your build.gradle file and this is nice for developers that just want to add some tool around and traumatic testing they will be able to define list of devices directly from their big brother file and launch their tests and all the devices will be downloaded created started right before the tests in order to test to to run the tests on all the devices they wanted to take them on will detail some use cases and at the end questionnaire survey data so i am not really a p to let al through all this nice feature of the new motion to the file i really hope you will enjoy or webinar ok let’s start just to tell you about three thing that we will show you today because uh that’s not all about GM tool and the grad employee but we will also highlighter in it a the java object you will see how it can be useful I mean that’s our Java object ok let’s start with GM to GM tool

as like Pascal said it’s a common line tool that will allows you to control genymotion from the come online a few facts it’s part of genymotion binaries between that since the 2.50 version it’s bolo with the genymotion package so when you install it you already have it on your computer and also it requires to be used fully the business or the indie license soft that’s for professional when we create gentle we work to try to isolate a few groups of actions that we would like to do with jen russian and we divided three four main categories paresis gem tool admin it allows you to manage your virtual devices in creating start you need etc and change the configuration sometimes do to device allows you to interact with started device gentle configured allows you to configure genymotion you will sleep that quickly and license allows you to control your license on Tom Waits ok i will switch to my common line as you see on the slide there are some darts on content that we won’t show you but it if you get this line and don’t have the video you will have them the full content that we will show you right now online there repeat from the this fight so this is my comment line here is my jelly motion folder and as you see there is this new tool which is called GM tool so I start typing GM to help to show you the usage of disk online and you can see on the use asian different categories so add me complete device health and license what we would like to do starting using this tool is for example configure because i want to add for your home my longing so just let check worry how it is already configured general to config print i chose the list of all the settings if i would like to change the something for example my username so i want to be called blah blah and then show to do too sorry to set a different password i just type gentle config username equal etc you get the point that’s really simple then what i want to do is create a device because I probably don’t have it one for now so what I want to know before creating an devices what kind of device I can create and there is a online for that it’s called GM tool admin templates so that’s under it so what you see now is a very long list of all the devices the kind of devices you can create with genymotion ah that’s a little bit hard to read it like this because that’s exhausted so let’s grab it and you have all the names that’s still not right but we should pour a lot of us are you know that what I’m doing inside I’m passing one named among the list that’s the nexus 5 running KitKat and what I will do is to create a device so i type Jim to lining aight i passed the template of this device and I call it nexus 7 because that’s the Nexus 7 so the device is creating as you’ve seen the time place is already in star in cash so it doesn’t need to download it anything need if it needs to download it will do it automatically so it’s created that’s great oh let’s get back so what I want to do now is you check if it’s on my list of devices so I have Jim to administer and you can see my nexus 5 device right here so now let’s start it Nexus 5 so GM to admin start Nexus 5 and you see it starting in front of my window an important point that you can see right here is that all the comment

that you are running with gem tool are blocking this is really really useful and if you are scripting because when you are scripting you are lynching a command it won’t when this comment is finished the action you ask is finished too so when you are doing a gem to uninstall it the common line the the standard output will be released only when the action changed so let’s wait a few more second okay so as you’ve seen the device is started and the command line released oh I think you get the point I will just show you another same dealing with devices so let’s see what we can do now we have the device started what we can do when the device is start I can do for example and let me be connect or a DVDs connect sometimes you’d useful when you don’t know when you have several genymotion devices lunched and you don’t want them to be on your IEP list just a or you want to get to get them back on your list so you can just control it quickly by using change GM tool you can also flash a zip on your on your device you can install an applique you can us to clear the logcat and to them also the logcat into a local file let’s do this and when you can do also is to pull and push faiz from and to your devices so let’s dump my load cut into my cut up cut by so i type Jim tool device lock cut them and the name of the file and we’ll set we can just display this black cat you see that’s very long and we’re good so let’s close this device as you see the the icons right here and what we can do to close the device is to get back to the admin gem tool admin stop my nexus 7 feet and into it right away what you can do then is to delete this device give it Nexus 5 and it’s deleted that’s very simple there are a lot of things to do the best thing for you now is to just look at the documentation look at what are your needs and not what you can do using these kind of law we will enrich it a lot there is a big road map for Jim to land or our unique tests related tools so don’t is it 82 just look at the documentation and give us feedback about your specific needs on this point so I switch back to the slides let’s pass this gentle thing okay so let’s talk about the other tool we wanted to present you the growl plugin what the growl plugin do it allows you to control your generation demon genymotion devices from your brother Fraggle it is based on gem tool and when you can do concretely the real limited is to create and customize customize your devices when you when you define your devices they will be automatically launched when you’re a specific rattle test task are running so they will be created configured start configure it again is needed and then available to host your instrumentation tests let’s see how you can add this gravel plug into your hood up trouble so because that’s grout plugin you need to declare the repository until you the bisque bill script the bill script block of your brother Carlo so Paul script rev repositories and the director is G center that’s very standard for this kind of tool then you put line the genymotion plugin and then you define your devices so let’s see what I’ve done right here is that I open the block genymotion devices I created a device

which is called Nexus 5 and I divine for yeast Nexus 5 named device the nexus 5 with kit kats templates and in two lines i declared a journey motion device that will be run automatically before my test are running I just down I I declare a nexus 7 also to give you an example about how to use spaces for your device so i have two devices and you clearly in 49 that’s really really simple directly in my brother problem but sometimes you have specific needs and you want something more complex so let’s see some part of seeing that you can do with your build a problem here is the nest nexus 10 i defined and defining your nexus 10 that’s a 4.3 ton planes right here and what i want to do is to change the the screen density of this nexus 10 so i take the nexus 10 template and i customized it depending because i have a very specific device to support that looks like a nexus 10 and i want to change it a little bit so i change the density actually I change the width and height and also actually that he has a virtual keyboard like many devices right what I want to do also is to flash because I had something to add into the system I want also to install an epic a but I could install several if my application when it’s running needs some very specific third party apps you can just define the past the list of the applique you want to see installed before your test our install and run you can also define you can also define theis that will be pushed and fruit before and after other words the test for your device you can also far a husk for logcat to be dumped after your test and we also support beautiful flavors so yes let me back yeah we there is a lot of things to do with it and we support good flavors I will try to give you a quick example but how we support the military where is just right after a little later in this presentation as you see there are others options there are really more options I really advise to to look at the tutorial and the documentation of this of the ground clinging because there are many things to do with it okay so we finished in to show you quick what are the tools who released one of the last expression and we wanted to tell you but to use cases that we know are very very important right now 400 developers and to try to to give you information about how we are considering it and how we could try it sometimes to help you on this topic first test in in in honoree there are many kind of way to do test there are many tests that you can do when you are developing in on rate application and your unit tests you are your functional tests you have a test that you are more or less smoking the framework at different level and what we’ve done when we wanted to tackle this problem as a merit or was first as many developer have to do are read the Google’s Android documentation and there is this page which is called what two tests in already the link is on the the speaker inert so if you have the slide you will be able just to click in it and here is what Google said what we should test on Android applications so your application should be tested on different kind of orientations when the orientation change we need to look after it to check if you are to change behavior well when also the keyboard or the system language is different you google wants you to test you are up on this kind of environment and also when the battery life is different sometimes you need and google has you’ve asked for II asked you for testing it and when external resources are changing for example network access sometimes the network is very good sometimes very bad sometimes it does not exist such time is saying that it exists but it doesn’t

exist there are many cases on network access and we know that sometimes tricky so that’s something you should test because that’s big part of the business of your app and depending on your GPS position depending on several even like phone calls or SMS that are arriving or bluetooth ascent to the device there are many many many things to do to test and that’s the thing Google advise you to test for your app that was a long list but the how much seems to do and analyzing this information that we found quite relevant we really consider that we had something to bring on it and mostly because all these are related to instrumentation tests an interval tation test is a test is running on a running device with an environment for your ad it means that the system behaved behaves differently depending on several event depending on configurations and as we provide an LS actually we provide six or seven version of android OS we were very on a good place on a good location to help you doing better improve your tests and improve the coverage and the power of your tests and there are a business of your app so what we decided to work on is a java api it has been released several months ago maybe more and let’s see what we put for now in this java api giving you a few example but what you could do into your test and how we could tell so through the Java API that you will run it that you can use inside your Java code into your unit tests you are able to control the battery on many ways the level the the weights applied etc the GPS position also on many settings the Android ID at the radio the radio means that you can control the eme you can control also foreign events our texts events that can have here and also the network for new network you can some different kind of provides for example the Wi-Fi is a very good connection there is no kind of limitation or the four years the 3g the edge or no connection at home and on this kind of only different profiles what you can do is what we play with is the the the the pan with the packet loss and the DNS delay so there are different kind of profiles and you can just switch and for example how you can use the network API on your application that if you have a local library that is learning content onto the web and doing specific things you can just change depending on the network profile if your library is behaving on a very on the good way the way you you expect depending if you are in the metro foil all the application can be some kind of lagging you can be sure that your application will be reduced even if the network is really ugly so that’s one of the example but you can imagine for example with the GPS if your application is really located you need a GPS position and you the interface need to be changed or modified a little bit depending on the position the battery also I will let’s talk about the battery then I think I do this ok so how we consider this job app yeah it is dedicated to Andre tests in Jenny motion so you will add it to your tests dependencies and an important point also is that’s all like in gym tool all the k√∂gel are blocking so when you are setting the GPS position at the beginning of your tests you can be sure when will you release the method setting the GPS position that the whole system knows that this GPS position is the one you choose you set right before so your whole application will be able ike the whole system is is a word about this setting and what you can do basically is that you can change the real system state and that’s really important important because that allows you to have less marks to simulate that the system is different because you are modifying the system from your tests

before running your logical assertion this is a bit ly two to the Java API documentation all the testing with all are on dailymotion com / dead zone or something like this okay let’s see how you can use now the the Java API so here is the the blog well do you add a repository this URL and on your dependencies you have your own retest compiled dependency referring to the Jenny motion Java API here is a very small instrumentation test case it’s called test SMS reception and i will show you very quickly on the very simple way how you can implement you can use the Java API so first what I do in this test is that I check if the test is running on the Jennie motion device of course the Java API is linked to the jelly motion on droid framework it means that there are done no end point for this we are not related to any motion so just check that your anjana motion device and avoid these tests if you are not then you get the genymotion manager and provided a simple contest context you get the radio and then you have to send an SMS giving the number and the message you want to receive on the phone at this moment and right at this moment everything is working until the SMS is received by the system and then what you can do is any tests any UI tests you want or any a controller as you want right from your instrumentation tests okay um before talking about the use case number two which is related to a continuous integration I will switch to honor in studio to show you a project that is called by Nicole it’s open source I think we will add Pascal the URL vehicle to the slides and it shows you how to use the jab up yet actually that this that’s a sample for the Java API and so it’s bowling if you are running a rural task you you you you will run a oil test on genymotion devices of course because other it or the device it doesn’t does not implement these kind of features or aki I and what I’ve done here on very simple way I added sorry I added the the genymotion Gradle plug-in into this project so what I’ve done I added the dissenter using I applied the Jameson plug in and eat something good very and what I’ve done also is that I defined these two devices a nexus 5 running lollipop and another device called my nexus 7 which is a nexus 7 device which is limited to one flavor only let’s look at just the curl here we define true flavors on this project we also asked for the nexus 7 to dump the logcat into a 10 directory that you can see here and also we have to clear the logcat after the would it mean when you enable this option it will ask to the device when it when you finish the boot to clear the line it means that all the content of the log that you will find on the file are related to your test run ok so what we can do now is to launch the growl task the connecting on red tests I lunch it and because it’s quite long we will tell a little bit around this project and how it is implemented so as I told you there are two flavors and when you are running correcting or retest it will build each flavor of your project and run the test on each of your flavors just to let you know so what you

will see so that they are already one device studies are created the Nexus 5 that’s the build flavor flav or when and that’s the only device that could be lunch because for this nexus a actual my 67 is only related to flavored that the reason why there is only Nexus 5 that is running not right now so there will be two benches of tests that will be run we’ve during a drink this execution now let’s switch to one other example so you will have another example how you can change the system that’s for the battery so what you’ve seen that we get the genymotion manager then we get the battery and then we set the level that’s 100 and the statues that is charging then there are other actions to test if the UI is behaving on the roadway and you have other tests then to change the battery to something very low discharging and check if something happen also so let’s see right now you see the UI is changing because the tests are running I think you get the point we are running only our first flavor so we can just let this run on its own size on the intro side and I’m continue to tell about continuous integration okay so continuous integration is a big big topic right now and actually that’s a real evolvement made the last year’s on younger development bring it to real industrial and professional environment and behavior what we will give you during this part is if you information what had to do it simply it takes all the information from a blog post that I’ve already been published so you can just read also these slides or the blog posts you have a more information first when you do you what you need to run your own read test into genymotion devices controlled by your CI a first is a hardware and an OS that is able to run genymotion this is very simple to have it you need a minimum opengl and if you Harbor seen but this is very common and an important for it its a mix it’s an x server on your on your computer that’s for mini technical reason the main is that we are accelerating the old younger either you I so we are we need an access to the to the GPU and this is this can be done only if you have an xserve er if you are using a Mac or Windows they have an xserve ER so that’s not a question the real question if you are using a small see I running only common line OS on linux it can be a question and that’s something you can easily solve but we will see that just a little bit later so what you really need on the project side and not on the infrastructure side for to be able to use genymotion on your CI is first to use the one of the last reason so the 2.5 10 release Jennifer motion using Jane phone so that’s the one you need to install on your on the device that will run your tests and a big advice to make it very easy for you is to use the growl plugin because you are supposedly already using Bravo on your CI and it will be very easy to control all the things from your build a cradle directly and you also already add the instruction for always and what I will show you let’s switch to a real Jenkins so here is this is a the configuration Palo Alto Jenkins and actually what you can do first sorry I

go back what you need is to add your project into your into your Jenkins and then you run your project running connecting all right or any gravel task you mode on your CI if your CI is running and is able to run genymotion in a good way how hard well ly speaking and you won’t hit it to run you have nothing to do more than running building your project right on your champions if you will be able to do that’s really related to Andre there is nothing specific but as I told you sometimes you want something without a DUI that’s how we work at geneva by for example our Jenkees is running on the darker so there is not really you I and the hardware is not done for that so we are delegating all the instrumentation tests to what Jenkins calls and notes or a slave or I like to call it the boat that’s a computer or some computer on your network that you can access from Jenny Jenkins to ask them resume a little bit oh you want to bet I will change so anyway we’ll switch so you need someone or several computers there are on your network that your Jenkins can’t control and you will see how you can configure it we will see it together so let’s switch to my Jenkins management I click on manage notes uyama yes do you think could be able to mean and also your door real okay let’s do it sorry for that guys I hope it’s good now thanks they’re real okay so now I’m unmatched on my dashboard of nodes if you have no notes you need to click on new note here what you will need it to dump a damn slave if it’s a little bit strange name but uh just select them slave type a name sing you want and then you go back and you click ok and you will already arrived on this kind of sorry yes you will arrive on this kind of page so this is my demo but the 1i i mounted for this demo so it’s called de Mirage that’s a CI server for genymotion instrumentation and torrented tests I need to suit the root directory that’s very very simple setup and what I decide to is that my Jenkins will communicate with this boat through ssh so this is the i the local IP local IP and the colonel shows that i created for a team approach and whereas I have to do now is because this food is running Linux that’s something you don’t need to do for windows and mac oasis but this a display environment variable you need to declare it and most of the time you need to declare it as the value need to be column 0 what this environment by all is doing when you are opening an ssh connection to a linux computer it is asking is looking for an output for all the UI thing by default when you open an ssh connection it will ask for something marked if you set the display environment variable to a specific value by default the first xserver an ex-client that is running is cullen 0 so most of the time this value will be column 0 for you you will be able to open genymotion and to let genymotion access to all the GP using i told you about before so what you should do if you are using a line expert choosing the display viable is to just go in front of this computer open a terminal type a code dollar display and it will show you a value most of time that column 0 but if you are playing sometimes your ruffled traffic dark graphic drivers are on somewhere exotic a configuration or Linus version you can have another value or another format but most of the time is a column 0 that’s our case I also export it over it owned by you soo it’s going to useful depending on your set up so I save it and what I need to do now on my project

size so this is my project bye Nicole project the one you using running just before is to check a small thing restrict word this project can be run and there is this field where you start typing the name of the slave you define before and it’s called dim about and when it’s done you just save it and then you can run it so the voice is not really ready because there are an SDK version problem that I didn’t update before the demo but it never mind now you know that you your bill will be able to run on your inert and you gather you can have many notes so let’s back to the slide so we keep all this information on one slide if you want to get it and there is also an article about that there is explaining what I said to your ready i finished to show you all the things we wanted to show you so I let a Pascal continue the top Thank You IL well done many many people are trying to run genymotion using Jenkins on other see I servers so it’s really nice to see it on screen working you can get all the slide we’ve seen and the we’ve put link in the Serai to or documentation or article and blog post you can get the slide at this URL so it’s a idea screenshot time or just uh if you have a photographic memory it should be really easy for you to remember the URL you will get the slide with all the receipts linked on it under under the nest next slide al piece you will have the link to the documentation of gem tool it’s on a website you can find it easily there on the dead zone oj a tutorial or to use the Gradle plug-in a blog post detailing also step required likely al shown us to run till emotional Jenkins and the the this very webinar the video will be recorded on the link will be a fee that you will be able to see it again if you missed something on want to see it again yeah I just want one thing quickly that’s the geneva by blog that we are now really investing trained with interesting content in it for example the genymotion and jenkins the block past is on this blog and several are all already planned to be a several post already planned to be published we the last one was quite interesting and not really related to genymotion and that’s really our ID to bring interesting content just right like we because we like it that was about from one of our system the rubber that’s used darker to build his a AOSP on read open source projects oscar and shows how how is how is using this technology to to delete on an easy way so there will be a lot of content that we really want to publish on it and there you will all that I really advise you to flow is blog that Jenny mobile com I think we will add it to the slide later thank you out you’re right ah there’s a lot of Android expert in Jenny mobile and we really want to use this blog to to provide good content to to everyone I’m interested in Andre topics I want to thank you all this is wrapping up a webinar we will have a question and answer right after that if you have any feedback about this very feature the grader plugins gym to rule Oregon genymotion in general please some Sun leads and discuss with us we are always a pin to to a feedback or to have information about maybe some bug that you should fine or some feature that you want to see in the product it really advertising the world or whatnot so please get in touch using Twitter teeny google please or even using our contact form on website and also at the end of

the month there is a new york droidcon if you’re wrong we will be really happy to meet because some people from jeanie mobile we’d be there web conference and booth so please if you’re around New York at the end of the month will be really a p2 to meet you on discuss a bit with you it will be rainin knives and we will now talk about question and answer though aunt ona I guess there is some Christian and the YouTube or the google twist event it is no time there is a rhythm the first question for you a young is about the annotation in a demotion Java API you know for example in G units you can add annotation in your test like which I require your device to run tests and need real physical device is there a hose on a patient for the new machine like genymotion device yes actually you can ask it pascal because we work on it pascal am i right here if I say that there are annotation to sort it out depending on the generation version well if you want to provide specific annotation we need to add them but that’s something we should be able to me okay so which be able to add it under my PhD we stopped talking on him not yet ready it’s not a big deal very good question another question is is the gem tool on the browser plug-in the racing available for the free version of June emotion pascal thanks it is not we wanted this feature this future are mainly for a professional usage even if I I can understand that some people are doing instrumented tests for personal use this are ready professional future this is why they are only on the business or in the version then that even if you are in in diversion you will be about to get the grader to gain on the gym tool to do some automation ok another question is about to run different estimated tests on different device simultaneously to shorten of course of the running time test ah yes this is possible I if everything that works with real devices always works with Jay motion because the emotion is like 11 hundred percent compliant with AOSP where we work really hard on that so and it is seen by a beer as a real devices so you’ve got some liberal library to do that we don’t provide this picture but you can find some library that does that and genymotion will work with that so you will be able to do to create 10 devices and you have a nandroid instrumented testis tests and you will be about 1 10 of them on the first device then of then on the second device etc to tattoo to shorten the run time yeah Marissa yell gave a conference about that I think I may be very wrong but I think they patched tuned to do something like this basically genymotion allows you to do that because it can be part of it but it’s not our real value because that’s really related to something that are really not dedicated to the owner 80 s but like any device with genymotion can be part of this kind of infrastructure but we don’t provide a framework to do it and I think there are two ways also I think Facebook is also providing this kind of bold King tests and possible sure or maybe foursquare you’re right yeah okay another question everything that Dean emotion was really a ways p compliance not a lot of people know that that we we run the android CGS tests regularly every day actually every night

on only bins and our score is really good same time even better than on real devices so right now we are prettier people with the the the fact that we are providing real standard Android device 202 developers yeah the cts is now for lolly pop warner red satin tests run on real devices and that’s the way for google to add me to certify that a device is behaving on a good andre device and that’s really the reason why we worked a lot to be compliant with it and to us and to have actually scored some times better than than some Nexus devices okay there is a other question so the question Nimba is about the network quality there is a widget about metro quality you can change your face your generation device the neutral created to test the different kind of network can you run the same automated tests with different network like stiff is a bad network then write test it with a better network see what happens basically that’s what the Java API allows you to implement that’s really something you can do easily okay so actually the old Java API is it probably is our only way to do it you will have to do to run two or three different instrumenta test that at the end it to Sam source code so it’s easy to manage that to you you just need to do at first using our IP I I change the network quality before running it give you package the the test on another one okay so that’s all for me I think we’re good great that’s great Greg exactly 10 perfect timing good thing bugs let’s Metro thank you thank you guys thank you everyone for attending we are ready open you enjoyed if you have any more questions don’t hesitate to interact with us Google Chris Twitter our website would be rare really ap2 to hear your feedback and I have any problem with the future will be really happy to discuss on over to you them or or maybe find ways to make it better fits on droid developers wardrobe thank you all goodbye I say bye bye you