 Thank you for coming to the advanced Appium training session and let's go and get started. So first things first for those of you Don't know me. My name is Dan Coyer. I'm the creative Appium. I'm head of software testing at Foodit in London Previously I've worked for Shazam and Zeus in Microsoft and way back in the day I went to school and got a computer science degree But anyways first off things first You may wondering why I'm not in Bangalore. Well, let me teach you something about the American passport here So you may see that this passport appears to have enough space for a one-page India visa stamp But you would be incorrect As you noted this page is marked visas and this page is marked endorsements And apparently they care about that at the border in India So I got to come back to rainy London And I'm here broadcasting live from the Foodit headquarters in the bowels of four crown place Bunkering down for whatever happens with the Brexit vote today But hopefully you enjoy this talk and I will join you later And I will take your questions and answer them live via some sort of Skype or VoIP or something Anyway, so today here's what we're going to talk about So I'll start with a brief overview of the story of Appium. We'll move on to what's new in 1.5 We'll talk about automating Mac and Windows applications. Then I'll show you some advanced techniques that I've Seen and done by others over the last few years And at the end we'll have some type of questions and I'll close with a something or other So anyways Appium for those of you who don't know what it is I'm about to tell you the story of Appium But this is an advanced session. So hopefully you know what it is and you came here, but I know that's not true Probably So let's talk about how Appium came about so it all starts with what I call the most terrifying five words in software testing So normally I would ask you to guess what those are and then you'd guess something and then I'd laugh at your guess because it's probably funny But since it's a video, I'll just tell you what they are. They are available on the App Store So you might be wondering why is that terrifying? Well, that's terrifying because on the App Store You're not allowed to just push out a new code whenever you like. There's a lengthy review process So when you make mistakes, they're quite expensive So I took over a new site a new job at a dating site in San Francisco Which had a mobile app which made quite a lot of money and our mobile app kept having bugs in it And whenever we'd have a bug it would take us two or three weeks to roll out a patch Because the App Store review process takes that long and because of that it became quite important to get things right and testing became very important So out of that it spawned a need for some sort of tool to automate our testing and this is 2011 so at the time Appium did not exist and many of the solutions we use nowadays You're not an Appium user one around either and so I needed something and it reminded me of my days Earlier in my career when I worked on other things where testing was more important Having worked on websites for the previous few years Websites are a lot different than other applications because you control the server and you can deploy new codes if you make a mistake You can send a new code onto the server and then the blog is fixed Whereas on desktop software like something like this And once you print it to the CD you're sort of stuck with it and the App Store is very similar to this So whenever you write something on your CD in order to change it you got to make a new one Which is quite expensive whenever you make a mistake on the App Store There's a whole review process that happens that takes several days and meanwhile every day your company's losing money while that bug is out There so I thought back to what we did and there were several things we did for testing there that we don't We I never did on websites and that amount of code freezes and all sorts of Sort of managerial practices to reduce bugs. That's not gonna fly to small dating startup But one thing we did was heavy thorough automated testing so looked around what was out there at the time to do this on mobile and Everything was terrible It was all quite terrible. I won't go through these tools individually You guys are at this conference where I know what most of them do But they're all bad in their own special way You are animation JavaScript is bad because it runs the JavaScript and developers don't write apps and JavaScript for iOS Robotium has been built as part of the application you modify your application. It's written in Java It's kind of limited not of syntax people familiar with and then phone monkey doesn't even deserve any more words about it So anyways, I came up with a solution and I was at Selenium conference this conference You're at only four years ago in London and so I came to London and I was there to talk about something else and As part of my other talk I showed My what I was doing for iOS automation We wrote a little driver-like thing that we control an iOS app with Selenium like commands and The talk was about the page object model and how you abstracted your test correctly You could use the same test on your website that you use on your mobile apps And so on the web apps it would use Selenium and on the mobile apps It would use our tool which didn't have a name at the time I never thought that was really neat not so much the page object model because if you're at the same conference I'm sure there's ten talks today about the page object model It's not something to walk me with but more that people I was automating iOS with Selenium protocol or Selenium like protocol and so at the end of the talk, I think the conference I gave a liking talk and People saw it and there was a big round of applause and then no one ever talked to me again and nothing happened and Then a few months later. I got a call from some people at Sauce Labs And they buy me this conference and this conference a bunch of people were showing Automation tools for mobile and so Unbeknownst to me the people at Sauce Labs had started a fork of my project and started contributing to it and Had put it in the cloud and things like that And so at this conference the open source project really started it got the name Appium two days before It's a funny story. I probably don't have time for today But someone can probably look up any other video. I've done that probably told the story So anyways after the mobile test summit it really started to kick off And so this is what Appium is for those of you who aren't familiar and don't worry. We'll get to the advanced stuff soon I know this is my session These are the four pillars of Appium. I don't know who came up with them. I think it's Jason Huggins I think it all stems back to a rubric for grading automation frameworks that he came up with for a conference And Appium just happened to meet them, which is why he liked it and the people at Sauce Labs jumped on board But Appium uses standard tech APIs and techniques. We don't use any private APIs We don't do any hacking no attacks. Nothing like that. It's all legit We use the tools the vendors provide We allow you to code the language of your choice We do that by implementing the Selenium Jason Lyre protocol which has bindings and it does under so different languages We don't modify the application for testing and as always it's always free and open source We don't charge for anything So that's what it is. It's the currently most popular cross-platform mobile automation framework out there There are big companies like Amazon and Microsoft who jumped on board We support Windows apps. We support Android apps. We support iOS apps We're just generally there for all your apps where Selenium is for websites. We're for apps And it works just like Selenium so you'll see you write a test script It sends a sheet of e-commands of the Jason Lyre protocol to a server It goes off and executes them and whatever the framework you need to for whatever platform you're using and then it's Back to you a protocol compliant response and voila test automation same as Selenium by the numbers We have 3,500 stars on github. I think last time I checked that was more than Selenium I'll just rub that in while I'm there, but I could be wrong. I should check that 2004 or 150 people have submitted a patch and I do want to have over 150,000 downloads 1.5 has had many more than that. I think so it's quite popular and it's used by a lot of people and we have closed 3500 issues Which is sort of a two-edged sword one you fixed a lot, but two there were a lot of issues Which isn't great. So now on to the advanced new stuff that you all came here for so I'm going to talk about what's new in Appium 1.5 and I normally have this side be blank because there's really nothing new in it But do you course me to say what's new in it? There's a complete rewrite of our entire code base We now have continuous integration and unit tests all around Our command line arguments have largely been moved to capabilities and we're getting to be a more legitimate Project there's a code of conduct and a governance structure and those sorts of exciting things that some people care about So why did we do this? Three years of patches organic growth led to a total mess The first version of Appium was never even designed to support Android and then one day someone came up with a patch to do that And we sort of patched it in there And so you can just understand from the beginning that Appium was never really intended to become what it has become And because of that it needs a bit of rewrite We were getting lots of complaints from our customers about how unstable it was Generally when we patched one thing we break other things Our code wasn't very modular We had many layers of callbacks if anyone's ever contributed to patch I'm sure they've seen that and the whole thing was generally poorly tested or really never tested except by the end users So anyways now it's beautiful when there's this organize structure that someone can show you that's not me But just know that it's better So anyways because we've done this big rewrite now it's going to enable us to do a lot of things really soon in the future Some of these are actually already done on this list Windows phone and Windows 10 applications for Microsoft is currently working on that. It's in beta right now I will provide the link to it later if you want to get on board with that The new GUIs we don't think of them started my knowledge yet We have two new IOS backends that are nearing done if not usable at this point An Android back-end rewrite is wrapping up hopefully soon better docs and onboarding material we were working on that as well and then There's a foundation and some rules and things now and as we looked at the pull request being submitted lately You'll notice they're a lot more organized and it's a lot more structure in them Which is helping so the first thing we're going to talk about it's more advanced is desktop apps So app VMs mission is to automate apps desktop apps or apps I think from the beginning we always thought this day might come and thanks to Microsoft and some other people It has come so if you want to learn about the Windows support Here's a link to it. There's a project called win app driver. It works in visual studio 2015 You can use it without visual studio 253 and go on to as well It's really easy to install you download installer. It's really simple And my Christian I was working on making it work well with Windows 10 And from what I've seen you you made me able to go a little bit further back than that And if not with this tool with another one, I'll talk about it just a second. So this is really cool I was really excited to get an email from Microsoft I want to say it was nine months ago saying they were interested in doing this and it's really cool now That it's actually usable and I can play with it. I'm not going to show a video of it today But I'll show you a video of another framework Just because I haven't recorded one yet of using the Microsoft stuff. I don't have a Windows machine Anyways, but also before Microsoft did it There were some fellows over in Siberia in Russia who came up with a framework that did the same thing And it works with Windows 8 and Windows 8.1 and maybe even Windows 7 and Windows phone devices So if you want to check that out, here's the link to that. They're really cool guys It's a really useful framework, but Microsoft has taken this on which is great too You'll notice this is a very similar thing in terms of what the web project on Selenium Whereas we used to where Selenium used to write drivers for Different browsers now people like Microsoft and Google and Safari even have Apple people taking it on lately Which is really nice to see so I'll just show you a quick video of What a Windows test looks like I'll skip ahead so you can see it's just Selenium code Nothing terribly different than what you've seen before but what you'll notice is that It's going to be automating an app now on Windows phone And so you'll see there's a little Windows phone emulator up And it's just running a test just like any other device using Appium and this is a demo of the Winium project which is from the Russian people I mentioned earlier So cool, this is a test that's just going to go through and I believe it's an address book or calendar or something like that There you go Building out this form Just you know, you guys have seen all this before it's just test automation And now the same thing they've done on a desktop app, so I'm sure you have that works as well And once again, let's get ahead of it regular Selenium looking code And now You'll see Gonna wait for the calculator app to launch on Windows and we're going to run a sample calculation There you go, there's your calculator running some test automation all using Appium framework There's a bunch of other people jumping on board with this I didn't have time to put in this presentation But there's some chatter on the Appium discussion group that if you read it religiously as I don't You'll notice that there's some other cool things like UI TV and other people that are bringing stuff on board So maybe other kinds of apps in the future such as television apps, maybe even Apple TV I haven't looked into it, but I imagine it's possible Another project I always bring up so I'll just start off by saying that this project is sort of abandoned where for me I made it many years ago. It still works. There are a few people that use it I would love it if a community formed around it, but not that many people are making money with Mac applications these days So it doesn't have a whole lot of usage, but it does work And it's called Appium for Mac it runs separate from Appium But you can automate a Mac OS 10 or Mac OS as they call it now application I haven't tested it with Mac OS Sierra, but Shouldn't be that hard to work The way it works is it uses the accessibility there on OS 10 to find elements and interact with them the same way an Assisted device would for a person with some kind of disability Like vision impairment or not able to hold a mouse something like that So those APIs and theories still exist on Mac OS Sierra and theories just aren't able to use them to automate it So not too worried about it working going forward But here is the calculator test you just saw windows Only we're going to run it on Mac. That was pretty quick. I'll play it again So I'm going to launch the calculator app run a calculation. Make sure it's correct Same test using Appium for Mac Cool, let's move forward So now under some more advanced material One thing people always tell me is I can't get multiple devices working on Appium Well, I'm here to prove you wrong and hopefully the sound comes out But you can do that and I'll show you right here Jonathan of sauce labs But I don't think he's at the conference, but this is an old video of him from several years ago Having a backup band playing of Appium devices. So I can see just plugging his guitar in here And he's going to play and he has an Appium script that's going to send the score of his music to For Android emulators and I was simulator two of them moving drums to the keyboards and one of them will be giving him the vocals So you'll see here for Appium Instances at once for Android one iOS and the Johnson of course playing guitar. I won't make you watch the whole video but Not to be outdone Jonah from sauce labs wrote a mini sequence or mini Sequencer, I guess that will take a mini file and it will send one of each of the 16 channels to a different phone And he calls it Appium jukebox. I think it's Jonah And so here's a demo of the Appium jukebox playing I have the tiger using 16 devices I think they're all Android But let's go ahead and skip ahead to the You can see the music Server And pretty soon you'll see a lot of Android phones each one is playing a channel from the mini file So once again multiple servers doesn't work. It's quite simple to do I don't have a code sample for you, but you can Google for one You just make a different driver object for each device you want all the one two three four whatever you like And then you send commands to each one of them the only trip without you was you need to launch one Appium server instance for each Device so that are using a different port number for each and connecting to a different port number other than that It's just like a regular test Another cool topic I like to talk about and this is one of those open source conferences So I won't bring up the companies that do this sort of thing, but there are a few companies that do this sort of thing It's quite useful There are tools out there that let you visually validate webpages and apps and they're quite configurable So the nice thing is you can check for layout changes and things that aren't directly a yield to be sort of testable But are more subtle So they're nice little tools with their websites where you can go mark up the web page and say these areas can change These areas can't change So you can mark like the clock and things like that that you expect to be different every time I go to test But you can mark other things to detect changes and then it'll send back to you a result where you can see on an image The areas denoted that have unusual or unexpected content And then you can either approve it so that your future test expect that new content or you can deny it And you can log a bug and you can investigate it on your own So it's really neat you just use baselines you baseline it and then when things change you get a notification And you look through it if the notification is undesired Then you can go fix the app and you can mark the tests if it's desired And then it won't ever bug you about it again So there's some people at the conference. I won't name names, but they're out there. So I go look for them They work at companies that do this sort of thing And there's also some cloud providers that support find my image In appium, which is really neat for things like games where you don't have The whole level of DOM that you normally have so here's a blog post by a guy named Simon Who has done this and I think he uses a coolie in this so if you check this out This will let you use fine by image in your appium tests But if not this there's other providers cloud providers that have an implemented server side They haven't shared their code. I wish they would but they have it but you can do it So look at app for a happy a cloud provider that provides fine by image support. They're also probably there at the conference Another thing I want to show you guys which I'm sure at this conference you've seen before is that Appium supports what I'll deem mechanical testing There's a blog article I forgot to put a link into it, but just tweet me or something and I'll send it to you This shows how this works, but I'll show you this. This is something Jason Huggins and I did at Selenium conference in Boston a few years ago And it's just an appium test that sends a tweet Oh Yeah, so what's neat about this is your existing appium test already work with this robot once again This thing is free so I can actually tell you what it's called and that wouldn't be unethical It's called tapster and it's 3d printable and it's tapster bot or or something like that It's made by Jason Huggins who's creator of the original slay him Here's a company. I think that has some other stuff to sell you probably But I know there's an open hard version of this out there that you can check out and it's been at several of the slave conferences So it's probably old news to you guys, but how the appium integration works on top. There's actually quite neat The trick is you just need to map points in the physical world to points on the actual device And we do that by launching a calibration app with appium on the machine And we lower the robot until it makes contact with the app The app will get a new GUI element whenever it's touched that has the coordinates of what's being touched So once the robot sort of strikes gold We know where the screen is in the z-axis and we can pull the finger back And then we just take two more points and with those points We can build a translation matrix that will tell you where anything is on the app So when you enable the robot mode, which I'm sure many of you have noticed in the Appium Mac app All your touch actions will go to the robot instead of to the device Which is really neat and it just asks appium to find the screen coordinates of it finds the center and then tells the robot to push that They're quite simple no extra work Just some math, but the map's messed up by appium. So it's not so bad for you at one point I probably understood what all this meant But that was a long time ago, and I'm not going to try to explain it to you But I have a medium blog article on this if you want to know more about this I don't think it's actually working in 1.5 But if you go down to 1.4 on appium, you can use this kind of stuff at some point I'll probably get working in but it's not really like a high priority So grab bag of other cool things We have two new iOS back ends and this is really important to talk about So one is WebDriver Agent which is a separate automation framework written by other people at Facebook You can see the GitHub link to that Some cool things that it supports that haven't ever been supported in Appium before that it supports multiple simulators at once Which is really cool, and you can automate apps from which you don't have the source code So that's quite neat as well. Hopefully this is all still true My knowledge I've got data on this and I'm sure I know I asked Simon Simon Stewart for more information on this, but I'll just mention that Appium supports Sending commands to WebDriver Agent now and you just give automation in WebDriver Agent And I think in your Appium 1.5.3 or higher. So that's relatively new I think you do have to build it in separately. I don't think it ships with Appium But there will be instructions if you look around the Appium website for this XCUI test is another framework we support. It's the new one from Apple Apple at WWC two years ago announced they were using a new UI automation framework that's Has a Swift and an Objective-C front end to it It is integrated into the Xcode app for a change So they're going to replace UI automation JavaScript with this framework So at Appium we've gotten ahead of the curve and we've already implemented this Last time I checked it wasn't entirely working from the Apple end, but from the Appium end it was pretty good I know that this makes some progress in the meantime So in the future, don't worry even though we're using a deprecated framework in UI automation JavaScript Your Appium test will continue to work when IOS going forward We'll do the translation for you whenever iOS 10 comes out and UI automation JavaScript is no longer an option Then just to stay posted on that that'll probably happen in the next four or five months Now I'm going to move on to something cool that someone showed me I was in Portugal a few weeks ago and there's this group of people I work with down there that Always have the most interesting problems in Appium It's a sort of like a consultancy that builds mobile apps for different providers like Vodafone and whatnot And they had the problem where they were getting SMS validation codes And they couldn't read them in Appium and they always come up with the most interesting solutions So I'm going to show you what they did and I find this is really useful for many things So here we go All you need to do is go to your settings on your iPhone before you run the test and set up something called in the notification center Set your messages up to send notifications as alerts And the nice thing about alerts is alerts show up in your app without changing the app And you can read them in Appium and you have to dismiss them So whenever you have something like a validation code to register something like that If you have the setting enabled on your phone, you'll get an alert during your app with the validation code So it's pretty neat pretty simple not too happy There's probably a way to set this programmatically, but I'm the wrong person to ask about that So anyways, this is a really cool trick. They showed me beforehand They were doing other things like pulling down the notification tray and trying to read it and things like that I think they have an app open source I couldn't get the github link for it in time But they have an app you can still on your Android phone to provide this exact same behavior on Android So same exact thing when you get your SMS validation code, you can read it as an alert Another thing I constantly hear complaints about is that the iOS simulator is slow So in previous versions of Appium, we bundled the product called Instruments Without Delay, which is Invented or coded whatever by the people at Facebook And it would method swizzle out a slow method in UI animation JavaScript that Appium uses a whole lot And unfortunately with the way Xcode 7 and iOS 9 work, we're not able to do that automatically anymore But there are directions on how you can do it manually and it's really simple You just check out my github repository as you run a shell script and then pretty much everything's as it was before Unfortunately, we can no longer do it automatically Ask someone else there for the exact reasons. I don't time to explain in this video, but you can still get them fast again Don't worry I just wanted to put that to rest and so hopefully this will help a lot of people run tests a lot faster So another thing I wanted to talk about was capabilities some interesting ones that are newer people may not have heard of So there's one called Auto WebView, which is really useful for hybrid apps, Cordova apps and things like that So it just means you'll start the automation already inside the web view So if you're using Selenium Automation and using Appium to run it So you're just automating a web page hosted in an app container Use this print, use this capability and your test will just work and you won't have to write any hacky Well, if it's a phone gap out then switch the web view and switch out the kind of thing This will just start you right there. On Android, there's one called Ignore Unimportant Views Which will collapse your hierarchy. If you've ever looked at the Android UI hierarchy in depth It can be quite deep. You could have 40 or 50 levels. Most of that is organizational views that group things together So this will just collapse all those away and it'll make your app automation run a little bit faster from my experience And you won't lose any functionality There's also one called Native Web Screenshot. It will toggle Taking screenshots with the native layer so with Appium instead of with Chrome driver or whatever you're using So if you notice you're getting funny looking screenshots, I always hear these screenshots look weird They don't look like what's actually on the device. You can use this and it will use the other screenshot mechanism in its place So I hear that complain a lot. People don't want to fix it. So there's your answer iOS has a few more screens as well. So location services authorized This is mainly used to prevent the your app would like to use your current location pop-up that you always see at the beginning of your test and There's a bug I think in instruments where if that happens too soon, it can crash your tests So if you pre-authorize it using this flag That will prevent those two problems from happening and your application service authorized and you can use them There's also the auto accept and dismiss alerts capability. It's useful to prevent alerts from happening So you can either accept them or you can cancel them all whatever you want Native web tap will use a web tap from the Appium layer instead of the Selenium layer So it won't be a JavaScript click event. It will be an Appium tap event So that can be useful for certain kinds of UI components on the web That don't like it when you send a direct click using JavaScript Ignore fraud warning. It's as far as good if you have like about HTTPS certificates and things like that or cross-domain I think cross-domain stuff made me cover about this, but if not, there's a dock on cross-domain fixes in the Appium docks Also interkey delay you may notice that sometimes the keyboard isn't accurate because it's typing too quickly So you can add a delay between keystrokes. It also make it more realistic So I don't think most people type as fast as Appium can Appium can generally type probably several hundred words per minute, which even the best secretary I've ever seen couldn't come close to So there's this interkey delay and it's milliseconds So you can have a 50 milliseconds per key and I don't know how many words from it That gives you what you can take to the calculation yourself. Um, there's also the same key strategy So there's one by one grouped or set value. So there's one self-explanatory But you can have Appium chicken peck as it does now and type all your keys Or you can have it just set the value on the element and your tests around a lot quicker If you don't really care about testing the keyboard interaction But if you do have keyboard events that you want to test or if you want to test for things like how to spell check Interaction the things of that you would definitely want to keep it in the default mode, which is one by one Another cool thing on Android that I hope will come to Iowa soon is the network conditioning So in the Appium client drivers, you can set the network conditioning And so here's a table of all the different values So this is useful for toggling the airplane on and off Wi-Fi to sell those kind of things So this table will tell you what value to set and then you can set it to test Maybe someday someone write an enumeration for this in Appium make it a lot easier But for now, this is sort of the table. So it was zero one two four and six are your good values I think three and five exist, but they do weird things that don't really exist on the phone So anyways, that's some of the advanced topics I want to cover today. I want to leave a lot of time for questions I wish I was there to answer them. You don't know how much I wish I was in here right now It's flooding here in London. It's crazy. It's biblical weather But anyways, I'll go Skype me in or something at this point and we'll chat and then yeah, I'll answer your questions I think everyone can hear you. So first of all, thanks a lot for trying to be up at 6 a.m To be part of this conference. I know getting pushed out or deported from Dubai is not a pleasant thing But again appreciate you trying to be part of this conference. I think there are folks here who might have questions So we'll quickly do a few rounds of questions and then wrap up the talk So guys, if you have any questions, this is a good time to ask Dan Yeah, go ahead. I'll probably need him to repeat you, but I can kind of hear you Hi Dan, this is Vimal. I have a few questions. So one on the Yeah, one on the network conditioning So you talked about network conditioning for Android. So do we have any plans for Ios also? All right, well anyways, hopefully I was able to answer your questions if you asked any and so I just wanted to close with a takeaway This is what I've learned from this project And I like to always give the Steve Jobs quote at the end of my talks So anyway, Steve Jobs once said life can be much broader once you discover one simple fact Everything around you that you call it was made up by people that were no smarter than you and you can change it You can influence it. You can build your own things that other people can use and once you learn that Be the same again. And so I think this very accurately reflects my experience the Appian These days most of the work on Appian was done by people at several companies like Sauce Labs and other places And largely I do other things nowadays, but anyways I just wanted to share with all you sitting in this room today where I'm not that You two might have good ideas and you should share them with people This all started four or five years ago Whatever it was at the Selenium Conference in London when I got up and gave a lightning talk and back then no one knew who I was There's nothing special about me. You got no smarter than any of you So I'd encourage you off you have good ideas create open source projects and share them with people go to conferences give talks They're always looking for more people to do it and just get your ideas out there because Wow, you know, not every idea is brilliant Chances are one of you out there has something really cool that you've solved that none of us none of the rest of us Have and we would like that So it'd be very nice if you could build some cool stuff and I could use it and I encourage you to just go out there and share your ideas with people because The people that have the stuff out there right now are no better than you. They're no smarter than you Just because I'm an apium doesn't mean I know anything about what should be done with test automation And I would encourage you for the rest of the conference to view every other talk with a thorough dose of skepticism Because you are capable of doing just as cool stuff as these people So have no reverence for what came before you and come up with your own cool stuff and share with people I think that's really important and I'd like to encourage all of you to do that because well Most of my ideas are crap I had a good one once and this is it and now a bunch of people have made it even awesome or because I shared it with them I'd like all of you to do the same thing and with that I would like to say thank you India in the words of Alanis Morissette and hopefully I can come back Or actually come I guess I didn't go there next year. Thank you very much