Googel Developers Day US – Testing Distributed Systems
Dec 21, 2008 API Tutorials
Attention! API Garbage (might be unreadable):
Google test checkout
10 yes this is a testing history systems with Ajax XML lessons learned from Google check out hundred hundreds and they ll be presenting out today with Mario Mentor from the checkout team and nosedive in your so mutable love to do everything automatically empty lunch I seem to want to run automated function tests to first of all why automated tests well manual testing is too labor-intensive and error-prone and automation this is better than 1 million civilians injured in also by functional testing was a great quote from Cedric bust of a pronunciation are accusing Google her and she s also the author of test NG framework and erode our little quote on his blog a little bit ago single unit tests have been receiving a lot of exposure these pastors optional tests are ultimately the only way to guarantee that your application works the way your customers expect so unit tests I see agile and XP are methodologies about lots of attention but don t forget your function tests as us with your customers is a great and wonderful contest will promise to check out Hitler like many except requires workflow to be done in the browser involves both synchronous and asynchronous AGP posts back and forth the server so Ajax hopefully everyone knows what Ajax is here adjusted how we tested the end I will the solution is to uprising on a test server that can simulate user going that browser and do both of those interesting post response requests in the Ajax in so what existing tool could possibly simulate a user so I am of course ends the affair disclosure on in the personal author of swimming critics working ruler but I guess my opinions here are my so what does selenium do that defines what it isn t is so first of all a definition framework… about 20% project at Google it might be Sunday as a paid internship doesn t test automation framework ends slanted for a couple things in particular Ajax this is a time when those canonical example examples when people say Adelaide test Google well Google.com is a non-Ajax at the Google suggest is a rising Google suggests is a webpage that reference I said okay one bathroom so as you type in your text as you see America as a type in a phrase there is Ajax calls back sister retrofitting each key trying to suggests a what you re actually searching for so when time is money and you might be looking for select comfort or Lena Eriksson but it s lame in his honor at the cool thing to know is that if we get slammed to test this thing in a state building us lame is useful for testing and an worthless this is like your classic functional test this is an example from Google docs and spreadsheets and a slutty on a scenario where you want to login created document sharing with your best friends Larry and Sergei click invite collaborators button verify that they can collaborate editing the document in the long up that kind of a scenario is great for the best was canceling this was great for Ajax and spend an worthless and also in particular testing is about before) and all the browser smaller platforms so we created it in the measure that part of the web application s testing could run in Safari and Mozilla at the time Firefox now and Internet Explorer all platforms and since lame as just testing that the browser is just HTML and JavaScript versus concern so does matter with server-side augmentation is that generates the code whether it s PHP array to read rails python.net Java does matter console H. ~so it s its browser gnostic platform agnostic and server-side to discuss selling off reliever for the demo of slain strengths actually drives a real browser and the baggage benefits first next to test real user scenarios and Yossi contest browser specific bugs that was actually the driving reason why slain was created because both are showing up in Firefox or Mozilla and not i.e. we fix it and then it would swap is very frustrating trying to hammer out to browser compatibility issues also swim offers one API for all the testing browsers so been used since lame script relatively to test in Firefox I i.e. multiple browsers ends a nice benefits of using selenium remote control for British OEMs is that there s one API for any language so you can write your tests using test turns in Java seizure PHP Perl python ruby and bustling run your tests also we offer for the people who are cool with her full of purring syntax Africa in an HTML table syntax for the tests and what an Excel spreadsheet that analysts like also to other benefits of slain that s low-cost actually free to cost a thing and is open source are you the freedom to tweak it and that it s fixed that there s anything wrong with so let s show a couple demos Arezzo got four little movies to show you all recorded and ready to go to first election show you one piece of technology selenium family called the selenium IDE extension for Firefox that you can get from open QA.org but that s your business assist watched it on the sidebar here to print and on the go and report civil test of going to Google.com typing hello world and verify herself this is not an injection test but to us lame ID is actually good for testing non-Ajax interactions so to playback recorder is to call it a generic term for so there I am just typing hello world into the search box eras are as a movie of it CC that it it s recorded the actions right here at click and wait for the page and and then actually another nice cool feature of slain ID of the context will pop up window I can do will help increase in circles this actually makes real test don t pass the joint verify research anything with us there I am just playing it back for you and that went pretty fast once you go slower and you can step through each action and when it asserts those passes because green if it s on deposits are of ended if the test goes if it doesn t have to be different still a section shows a slightly different but actually doing Ajax contests income to employ this something assuring a pre-canned scripts I have been wanting to know us lame idea such a great for recording non-injection test for Ajax and the things you don t always know that the recorder is not a genius so you watch the 60s together such that kind of this is lame ID is useful for Princess but in this case by hand splits and discreetly show what this test is this a good example of a bad test actually go to Google suggests-SEL B. reversal in a show up and then I have 5 feet/40 is the ASCII code for the down arrow saga go down six times in and verify on the root the next page that the open QA site were slain posted comes back to this is a very brittle tests because it s lame moves up or down in that pop up the testing break and that s probably not something that you really care about celeb show you a better example of that this same contest company is just better example maximizes indiscreetly reducing that they open a typing keys here s one thing that animates us lame very special for accessing is this week for commands its there s a whole family of wheat for Weaver commission report special kind of awakened users to actually in this case is waiting for the slam the text when you show up on screen but you can also do the job freshness would pull for Ajax interactions don t care what it is but you want something to show country as labels wait around for that thing to happen also further on down wife change the key downs through mouse move announced down and wait command and also you ll see that I use an ex-pat expression to find were slain was in that that pop down for a list as of going to a specific number of spots suspicious test less fertile than the previous one I had to Encode these figure out by hand is run separately briefly step three is wanted is to fast serves mouse move will highlight that actually mousedown and verifies the text element show you one more cool demo is lame is not just the IDE also pointed to this literal control some do one more different contests will you look for the phrase Ajax testing and see what comes up as the top hit in Google so exceeds the very source of the previous test figure Google suggests-Ajax test in without the G8 ends in and wait for the tax Ajax testing, as the suggestion animated a similar 02 ethical link that we verify that actually Ajax testing of slain shows up on resulted celebs shows this test running interest live up to what the nice thing about this is there your CSS in sluts Ajax testing it goes and surprise surprise post about selenium is the topic per page access of what s cooler actually is in this us lame ID we have this in their reason was that of the other cool thing about of slain the IDE is that it lets you translate these will recall Celanese or cable tests a simple syntax into a classical Java or Python or Ruby tested than more easily integrate into your build or severe am but are the options menu and format slick python now has translated this into valid python test using the python unit test framework so you could copy and paste this code into a shallow area of running and my other desktop verse will start the slain room full server that s just a Java server is down with that website again assert that no soliciting is related and it s really a proxy between your python and and the web browsers in the subject of France in the python script and watch browsers send commands to the knowledge you bring up an interactive prompt of Python and paste in that test list of slain IDE and office click enter one more time and see what happens sizzling a remote control has launched Firefox and the fiddle player and your maximizes window and there goes than do the same test this summer for a pickup in the Ajax testing the sluts Ajax testing and verify that s the top posts will this liberal control says how to tear down the browser quit the owners repair the very ends out okay as a valid unit testing up on me this where we want such the Tiananmen will demonstrate certain breakfast lecture aren t suitable lessons learned when using slain it is very easy to write protests especially views the recorder you want to spend the time to make them less fertile and unfortunate that the manual effort off also it s good to write more unit tests and functions us us lame school and it s what your users see however biggest benefits of the iceberg literally and metaphorically to Casey was underwater with one of social test fails you really can t tell what broke you know that your application broke and that would be good signal to stop shipping deploying a secure customers but doesn t tell you exactly which people like him is all so that s what unit tester for this we have developers who want to know how we fix the application you want more unit test coverage of the Arkansas beverages were protests over instances of different spin on a broken slain test is often a symptom of the missing percolate to the top usually don t want to see usually a unit test should have caught that before God… Roger and last point is the IDE for prototyping use liberal control for real testing real testing automation route repeated often a remote control because it lets you record us in Java running this for language is gives you absolute conditionals are little attraction salability retractor functions political libraries all those things that you can t get in a simple tables and and remote control makes easy to integrate with any before in a test of custody and can so Martin will be continually passing Conyers Martin Billy telling you a little bit outside should check out team and how they did their Ajax testing and little disclaimer goal that thank you Jason London was walking home under my digital is to help large merchants integrate with Google checkout select hope that none of my large merchants of homes which brought them to America how many of you use Google checkout their headquarters are so Google checkout why Google checkout for still give you a little background will online commerce is hustling to some some pretty serious problems are all those merchants out there that that the lawyers don t know which merchants are trustworthy and have always let the buyer he always accounts out there always accounts the usernames and passwords to remember different for different merchants you have a great abandonment rates of courts out there fortunes would be doable to get this done and made a bundle of courts down from the current 63% of its hundred courts created 60s and checkout started 63 and up north be much order for various reasons because it s over repetitive process possibly so rebuilt Google checkout to help and to improve this process make it better both former chunks and for users for customers who live in inner and of actually going by something with Google checkout sore research shows that about 37% of all online purchases start with a search so we ll pretend we were in that 37% would say we want to buy a Canon Digital rebel camera, you can do to Thomas O. research resealed the organic search results of in the middle there we see control pods out to the right receiver example out here there is and then had up here to the right-center right candidate who reveled by the call I have a vital former towns have I ever bought something from them before I don t remember a book so from so many merchants don t want to give the trust by the foam I don t know maybe I m heard about these guys before you want to give them my credit card number but because you see the check of logo on this particular doctor you know that if you don t buy from these guys you don t need to give them all the information you re building shipping address and e-mail the great Cardinal began to send being in the product search uses a type of different search of the front row of two Web search you can actually see prices of products on the signatures although and right now I m in a mode where only merchants of Google checkout are displayed there is another one $599.88 while that sounds really good look cheaper than the other guys Jim Farrer music and computers them over I don t know I m never heard of them before but I will check out well it s a risk-free 30 okay $1500 goal and that the IC $900 there my friends at J&R 7900 so glad this to court okay so now time to check out something like that you place the order so I can go through the normal check out the J&R house and accounted last night is a 21 text field and then probably created yet another username and password to remember and it is because my credit card number and my e-mail address which they may or may not sell to someone else so looked it up back here and to check out will try that instead so now we re on the Google website unless you re into my Google account so you will monger to comb for password snow we have my courts here and here is the camera I can choose it looks like Jay North providing me with three different shipping of goods to choose wrong I previously want to trade in my third will checkout account up with my American express card in there I can have more cards in my checking account right now I ll looks like a mighty business address their 1650 theater portray the photo of my home address in here I cannot do addresses and benefit to place order of them done daughter goes off to J&R Google basically telling Jim Jorge Martin bought this camera for readership it then will Google is not giving J&R of my credit card number but instead just giving J&R B. $614 also located to the left rather keep my e-mail is confidential so there won t keep it confidential until once J&R.my real e-mail address and in that case they would get simple things that the e-mail address that it ll be something like Morton 1 to 3 outs check up with Google to call the send e-mail spare and then will forward those e-mails to my real e-mail address moment with Google doodles is okay in oral doubtful promotional e-mails from so it makes less risky I have more control as a consumer but what s actually happening here in the transaction but is also a gusto so for me other buyers convenience rather didn t have to fill in those 21 text fields are protected against fraud because the Google of the credit card number stays with Google doesn t go up to what comes merchants out there on the web of security merchants are giving us a little bit of control as we saw here 1/10 horseshoe into subscribing to their e-mails they may not even just a really mala is so what are merchants getting while they re getting more leads because when… those cards where the checkout outward display tend to get fixed on moral as people trust that they know they don t have to give up a greater number more commercials he was instead of going through three pages of filling out a bunch of text fields it was one or two pages in all my addresses were on there already so they re more of us is that fewer people falling off and abandoning the checkout in the middle of the process oh I m preprocessing so job out words you get free credit reports is a and the also do get 10 X. for your other words found in free credit reports also we saw the odd words on the checkout work well together so the thinking is that you have most most merchants or Edwards users of customers today you will have your other words as they drive more traffic to get more commercials more leads but it s more commercials… into getting more traffic to the imagination to promotions as well for you developers there are bonuses for for you if you integrate your merchants with Google checkout is we wanted to do also rigorous whether you re not worth customer walks for the rest of this year credit for processing history so you got $100 100 or order someone was thought than the merchandise you get exactly hundred dollars no hundred dollars minus a couple of percent up to the processing solo will be for marketing overview of the checkout now I look it up to the nitty-gritty of the technology how to integrate this with my website so couple of auctions easy way to be pasted snippet of JavaScript that lets it gives you a very primitive checkout integration with no one item becomes the one item at a time but it s easy to do using the course provider like me virtually gorgeous and red with checkout so predictable \xb7 EJB is not one of Charlotte was later integrated up with a bunch of these were orchestrated for the developer or the merchant is not very tech savvy read the HTML name value pair is to create a hidden form on your site enough for the more across merchants with XML is not to find most savvy merchants is because with this you can automate the whole office Sofia XML API is Google and the merchant posting XML to each other over it should be its relevant and XML schema for the synchronous and asynchronous calls so it s the signals of Michigan schools would also have a sample code for what you different environments Job Perl PHP etc. so what would an actual transaction looks like first off we have the merchants is the author to the left is hosting the court to Google so this is an XML document is formatted according to mix no schema but we published this contains the cards X. amount contains what items were and are sold my Canon Digital rebel, wasn t there what special restrictions there are taxes will checkout and then makes real-time callbacks while the user is still on the Google labs site Google can make real-time callbacks saying that he user just type in enough theater portray us as address what s your surtax for Mt. this affects Mountain View to afford or what s your would shipping methods to from a California than in the merchant can return calls in real-time and they will show up in a Gypsy and the way in the user interface with vessel so once the orders placed them there would be cool with some modifications to the merchant every time you order something about the order changes like its Council or of the undone the merchant would send commands to Google about the orders like Council disorder for a shift disorder please notify the customer should or I am shifted I don t want you to actually George dual-boot uses credit card credit for and roll developers for most of us how many developers are all right. Let s look at some code is encoded using him as a personal flip it back up and say that XML sending young parsing XML is messy if you have to do it yourself so we built sample code that sort of structure wail about XML messiness so here we have the merchant who wants to post the court first off he reuses the merchant ID and keys from from a file or example of typically merchants keep it on file then you would create a checkup shopping cart request that the object that is a request that s ready to go to to Google business so when we re in the process nowhere among the J&R s website to recall I just clicked the Google checkout button and then this is the chemical that would execute the merchant then adds the number of items with the calling to add item method on this court object this case or the name of the producer s biscuit yummy biscuits is the description = 99 quantity to the J&R use coal probably call the add item method of them put my time and Digital rebel camera to the court object such that say I would have shipping method USPS ground that only goes to California we were traitors shipping restrictions on object say that this is only good for California either love Safeco and that we can say that the card without a flat-rate shipping of its called this the its 399 and report the should restrictions object in their just so that the Google now knows that the Justice Brown is only good for California customers then we have Texas that say this merchants whose biscuit merchants is in California so he was charged April 3 South percent sales tax in California but no tax the rest of the US would create a text area object at the state code CA to it for California and not a tax rule to the court object saying that it s a .3% for this text area to see the true there are I think means the shipping should be taxed so merchants put charset of the tax and shipping others don t then there appears automatic happening here with the one you actually book to send method remote will the merchant server is invoking the sentimental court object all of this is serialized into huge global XML household with business rules would put in about six attacks shipping the middle of items and actually sends the XML Google and processes the response the complex which is another Jewish global XML and seaweed at the RNC response hairtrigger response in that object will redirect your edits so Google is now saying okay we understand we go to court about the items about the business of rules for the court know please redirect the user to this URL and this is where the user will now want up on the checkout page so Greg and postcards within their similar code for processing the call like pseudocode for processing for sending commands to rule please charged disorder please cancel this order but they bought a use for the tricky to test because here he did you serve us to click through a browser to do certain things done your calls made to Google responses can come back from Google asynchronously you may want to if you want to test the complete lifecycle of an order you probably want to simulate on your site that the order is fulfilled and then you will determine who will say was charged disorder and mature Google charges that you ll mature the response permission you get back that it is charged as process on your side as well throughout synchronous calls a signals calls and user interaction which means that usually suggests this difficult it is usually applied to this is approval of insurance box is this not really scalable as we found out and it certainly not killed for fur merchants who mail rooms and rooms full of insurance so we built a test server that we: does the that help us test a checkup so whenever we roll out new portion we can run through a couple hundred test cases functional test cases and dentist visits to make sure that we didn t break anything objective as it happens this is really physical abuse useful for people outside once while merchants yourself helping merchants integrate with Google checkout so we making it open-source and putting it out there hoping that merchants will use it will see good rocksolid at checkout integrations so what is right it is in the proxy that sits between you do the merchant and us checked up on it intercepts all the messages sent back and forth and verify for semantics and syntax going both ways so if you send badly formatted XML Google will know if Google doesn t respond with what s expected if of no and the thinking is that you should be able to record days worth of coding should be able to hit the test key go home and come back the next morning all your hundred test cases have wrong and you ll know exactly which ones your broker which ones are still working since you since last person you has user interaction so that sources and comes in to lend him as no court of Mendoza Mendoza uses sore order flow with this test server Windows is a little bit different the merchant still post the cards bought the Mendoza sits there in the middle were supposed to Mendoza notes to the Google customer and then Mendoza just forwards the request after validating its okay for us to Google same thing all the callbacks going back they go through Mendoza and if there is any tricky medium bowl don t feel you want to test the user enter an amount of Puerto Rico address in the ownership to the lower 48 states for example you can have it and tell Mendoza the script that sort of into the to pretend it s a user simulator user enter a correct return address so long let s take a look with those okay so Mendoza s enjoyable server that were starting here run test server since a processing restored if you re merchant you wouldn t have your own server where you downloaded your and you run the windowsill in the voters in this UFO was former spouse open-source pursued if you ve heard about it whenever it was commerce of the so for those of you haven t its own open-source web storefront and were doing here is we are testing or open the Oracle was commerce integration with Google checkout so we re going into the Google checkout module of post-homers we are saying through it for telling it to post it instead of posting it to the Google Google Google sandbox environment and will test, where telling the dose of the retailing open both homers to post to Mendoza another URL there are with a test server Mendoza the test server has a UI although typically you would only use this for setting up your test of a future that works the first time because the whole point of this is not a chapter through another bunch of tests but should just be able to script this leave it overnight and it runs the 200 test overnight but that would be a really boring dull if the object one button which impacted floors later to bring so is directly going through the URL of Mendoza here we are of pseudo-amounts of going through Mendoza s landlord yet Roberts is between Alzheimer s and the merchant so now were a career back in those commerce are going to place an order the court will actually go off now to Mendoza notes to their length and notes to Google checkout in the hope that we ll see some refreshed status here so there is the courts they encoded cards of the tall and the bottom is the flame torch the unencoded part eczema that business again those congressmen sent this to Mendoza and also will diminish forwarded to Google checkout unless the response to message also XML you want to compose a book using normal strength of mentions would like to Mendoza were telling them though so that you should login us whatever this username and password are up here we this is where telling those of us say you should use the when you pretend to be a user please use address with this ID this is the idea that business might be the Puerto Rican actress would take place order of Mendoza was not placed the order or I should say Mendoza will start placing the order but also will tell solemnity to pay please don t pretend to be user and the Solano R. Prosser worth noting by the way the functional tests are typically pretty slow but sincere zoo wouldn t run this like unit tests to run after every billed part but these social things are more strict about and go home sleep come back next morning see that the test of these thinking about driving the browser or so here s the synonym window here is where Solano pretends to be user hitting some books with Google s coma sissy. Their two environments for Google checkout one is the sandbox environment when you place orders there no money changes hands okay so now this is the slender driving right now pretending to be user see that replying to his list of Java programming language okay once thought Lennon will know fill-in e-mail password protected login so that it was within another lender would get the Place order button here and will devote this for a little time here but then the old magicians go back and forth between now check out on the merchant Celinda sits there in the middle and approves everything so some things we re working on now and that you can work on because his open-source everybody s welcome is the real was limited to improve the UI of its ears was fairly broad broth we need to incorporate those who together with other testing harnesses so that you actually can do what I just talked about button go home and I wants a strong overnight test suites performance testing is also something working on a shooting okay so if you only remember three things or Woodward talked about here want them to be these three things one Solano is great for Ajax testing is hard to test a justice of the century will to Mendoza is great for checkout integration testing could read merchants see if you can not use Mendoza will cut down on the number of rooms full of interns who is a country integrate with Google checkout increased shtick to include Christopher rates more traffic of the merchant for processing their incentive programs for you developers sample code and the web quite a few people doing this for thousands of merchants millions of customers using Google checkout a real soul beginning to see the whole checkout echo system build up which is really exciting for sample and not in the old world of integrating systems you would buy this was software code and downloads your machine and put it on there and tried out the if you re merchant done and you would for example need to calculate Texas of hard to do right but received a part of this together with checkout use other parts of echo system restaurant aren t both called which is a collection of thousands of Web services in once bought a justice search for last night for sales tax on a paperwork for different web services showed up Web day care could you set up some people know we are and please come and talk to David you re interested in Web services through a couple of your expressions and the Johnson partner is right now the really cool thing we ve seen recently a part of this echo system is the E. junkie don t call a band really like this this allows you to do something that would not be personal possible today with only checkout just copy and paste JavaScript into your page injured normal HTML page and boom you have a checkout enabled part of the program here eighth so what felt was with all rights so that I great we want more things during this echo system start are in a junkie very cool things that help you build your petitions would build up this echo system more morbid easier and easier to build applications on the best that I deferred to as as as as as as as as as as as as as as as I have I have a letter that is what I have found that I have not is as good as they are as bad as is









































Leave a Reply