Test-Driven Development on Android with the Android Testing Support Library (Google I/O ’17)

[Music] hi there each person welcome to this morning’s session on experiment-pushed progress for the Android platform my name is Jonathan garish and i am a part of the cell ninjas we’re a small group within Google who’re program testing and am i able to get a rapid exhibit of palms in the audience how many of you are virtually writing checks as a part of your normal software progress observe that’s first rate ok so if you’ve written checks for Android earlier than you often use a few of our tools we developed the Android checking out support library which includes the J unit for scan run own principles the espresso UI checking out framework and had been also energetic contributors to robolectric the open-source Android unit checking out framework so every body’s telling you to write checks however why should you really do it it can be proper that tests take time to put in writing they’re including code to your codebase and possibly you could have been in a problem before the place your manager or patron has been telling you that they may be slowing you down but there’s so many compelling motives to write down exams assessments provide you with speedy suggestions on screw ups so disasters which are spotted previous on in the development cycle a a long way less complicated to repair than once they’ve gone are living secondly tests offer you a defense web you’re free with a just right suite of tests you’re free to refactor easy up and optimize your code reliable within the advantage that you are not going to break current behavior assessments are quite the spine of sustainable software progress you can be in a position to hold a stable speed in the course of the lifetime of your challenge and you are going to restrict the increase-bust cycles of crunch function time and the aggregation of technical debt so in software trying out there exists the suggestion of the pyramid the checking out pyramid and this is made from a number of layers and each layer brings with it its own trade-offs that you’re going to ought to weigh on the lowest layer is the small tests or the unit checks and these need to be very quick and incredibly centered that is why we recommended you these sort of checks is what is known as regional unit assessments and these are going to run for your nearby laptop machine and the trade-off you’re making with these variety of assessments is infidelity due to the fact that you are no longer going for walks on a sensible environment and you’re often substituting in a bunch of marks and fakes as we move up the pyramid we’re now into the geographical regions of integration trying out and finish-to-finish trying out and the important thing with these kind of assessments is to bring in constancy that’s why we propose that you simply run these form of exams on a real device or an emulator these are the kind of exams which might be going to let you know that your program actually works nonetheless they are less targeted so a failure in one of these sort of assessments would take a bit of longer to monitor down that it will in a unit test and one of the huge trade-offs you’re making is in test execution speed on the grounds that you are assembling a couple of accessories all of them have got to be constructed after which package deal shipped to a device the place the tests are run and the results elected back that’s going to take additional time so there isn’t any single layer in this trying out pyramid that may suffice so what you have got to do is to blend in tests at each specific tier leveraging the strengths of 1 class to way off the alternate-offs in one other there isn’t a real difficult and quick rule here but Google’s own interior checking out gurus suggest the 70-20-10 rule of thumb because the ratio between small medium and tremendous exams let’s take a seem at our workflow so and with test-driven development the notion is that you by way of writing your exams then you put in force a code to make those exams move and then when your exams a green that you would be able to publish again a rapid show of palms who available in the market has test-pushed their code tried experiment-driven development prior to now ok cool so we like scan-pushed progress in view that it makes you to think in regards to the design of your utility up entrance it gives you consideration to api’s and the constitution of your code with experiment-pushed progress you are additionally going to be writing less code due to the fact you only write the code indispensable to meet your checks this may permit you to release and typically as you continuously inexperienced you’ll be ready to install a working application at a moment’s realize if we’re following the test pyramid the workflow is going to seem anything like this first of all we’ve got a larger outer new release that’s concerned with function progress and here is began it is pushed by means of a UI experiment and the mantra with test-pushed development is purple inexperienced refactor we begin off with a failing test we put into effect the code to make that test move and then we refactor throughout the higher iteration are a series of smaller iterations and these are concerned with the unit checks here that you’re assembling the building the units required to make the feature move and once more you use the identical mantra here red green refactor crimson inexperienced refactor so let’s take a look an instance software so the characteristic going to put into effect today is the add notes go with the flow to a sample notice taking software if we take a seem at our mock-americawe can see that we begin on a notes record reveal filled with some existing notes there is a floating motion button down at the bottom and the user will click this taking them on to the brand new add notes display right here they are able to enter a title and a description for their word earlier than clicking keep the node will be continued after which never turned again to the notes list reveal the place they can see their newly added word together with some other notes that earlier existed so coming again to our workflow for a second recall that we start with a failing UI scan so let’s take a look at how this test would look like making use of espresso the UI checking out framework the first step is to click on on the add node button then we enter the title and description and click save earlier than returning to the notes list display and here we will verify that the be aware that we simply added without a doubt suggests up now bear in mind with experiment-pushed progress we’re no longer put in force the code simply yet and all we have got to do is enforce ample of the application to fulfill the specification of our checks so an empty exercise and just the resources that we’d like will fyz once we have that we can run our experiment and we will see it is going to fail now we have got to put in force this option so purposes are constructed up of many small units these are small highly targeted specialised accessories that do one factor they usually do it well collections these small units are then assembled collectively so that they’re collaborations will fulfill our feature let’s take a moment to summarize the key traits of make up a just right unit scan as good because the ordinary conditions you looking to you wanting to scan your failure stipulations invalid inputs and boundary stipulations that you could turn out to be writing plenty of unit exams unit assessments have to perpetually give you the same effect every time so prevent depending on matters that would trade for illustration an external server or the present time of date due to the fact this is going to carry flakiness into your unit assessments unit assessments must undertaking one specified facet of your code at a time you trying to see that a failure in a unit experiment will lead you very quickly to an genuine bug to your code and when you write unit assessments avert making too many assumptions on the specific implementation of your code you wish to have your unit has to scan conduct that way you preclude rewriting your tests when your implementations changing and some of the primary features of unit test is they’ve obtained to be rapid specifically on the grounds that you are writing so many of them and you are in TDD workflow jogging them speedily and it might it will be terrible if they were you were discouraged from writing exams or refactoring your code considering that of the anguish within the execution time of those exams and eventually unit tests are an nice source of documentation and the best way that is regularly evolving along with your code because it alterations in contrast to static documents a good way to stagnate over time let’s write a unit scan for our add notes pastime this undertaking goes to absorb person input and then we’re going to persist it to local storage on the device k so we’ll create the add notice undertaking type and the pick stand recreation which is an android framework type it has a view which goes to be inflated with a layout and the consumer will enter their information right here after which we’ll persist that observe into Android shared preferences mechanism so it can be imaginable that as our application evolves so does our requirement and might be our storage requisites evolve to persist the notes on to cloud storage and we ought to construct some variety of synchronization mechanism for local storage for the offline use case and in these instances we see possibilities for abstraction we might on this instance see that we will extract a notes repository and however one of the key facets of experiment-pushed development is that we simplest by using writing the easiest case first and then we iterate so we’re going to withstand the temptation to do that early let’s take a seem at a pattern of what an idealized unit test would appear like they’re often constructed up into three phases so the primary stage is you’re environment the stipulations for the experiment and this entails making ready the environment developing your dependencies with a required state and getting ready an enter information subsequent we will pastime the code under test before subsequently making assertions on the results or the state so I wish to evidently separate every of those three levels of the tests and deliver the pertinent aspects of each test like entrance and center to make for really readable test so up except now with the Android platform you are writing your unit assessments utilising the mockable jar at the side of a marking library corresponding to mojito and let’s take a look at an illustration of our test written with mojito k wow that is various code k so considering that of we’ve got so many interactions with the android framework and we’re going to must provide stubbing habits for all of them so as just to make just to fulfill the execution paths of our assessments and moreover on the grounds that Android makes use of a variety of static methods we’re forced to introduce a second mocking library energy mark so as to control this designated case for us and there are also some pretty bad code smells here let’s take a appear you see we’re pressured to secret agent on the pastime underneath scan and we’re desiring to do this to change its conduct and stubbing it out and offering some no ops so we’re relocating out of the nation-states of blackbox trying out right here and sooner or later at the end we’re making assertions concerning the implementation details and if these change our assessments will need to change too so remembering the characteristics of a just right unit experiment let’s take a moment to attain this detailed experiment good it is very focused we’re simply trying out the joyful direction of our add notes float and it is obviously rapid because it’s running on the regional JVM nonetheless we had been making alternatively quite a few assumptions about the implementation in that experiment and and with this if any of our implementation changes it can be likely we will have got to rewrite that experiment notably and sooner or later all that excess boilerplate stubbing is relatively distracting it is distracting away from the key aspects of the experiment the conditions the tests that you are trying to file good fortunately there is a software that helps handle some of these issues so introducing Robo electric robolectric is an Android unit testing software that is open supply that we’re actively contributing to and to tell you more about how one can write quality exams with robolectric i’m going to hand you over to christian williams the fashioned writer of robolectric thanks Jonathan it’s tremendous to look so many folks who are into Android checking out and TDD so yeah rub electrical is this a scrappy little open-supply challenge that I began hacking on again within the early days of Android testing because I was once simply tremendous annoyed at how lengthy it took to to deploy and run checks on an emulator and it is style of been a aspect undertaking of a bunch of exclusive humans except last yr when I had the privilege of joining my pal Jonathan at Google the place he used to be already engaged on improving robolectric for Google’s of inner experiment Suites and when you consider that then we have been we have been particularly beefing up for electrical and contributing back to the open supply challenge in these days robolectric isn’t an formally supported part of the android plus testing platform but we determined that after it can be used appropriately it may be a fairly priceless part of your trying out process and i’ll exhibit you a little bit bit about how you can how you can do that too so let’s go back to our word student test and spot how we would process it with robolectric so considering that rubb electric runs as a local unit scan it is going to still be going for walks to your pc alternatively than an emulator however robolectric presents kind of slightly Android sandbox subsequent to your scan where the exact SDK code is running you can have access to your pursuits your layouts and views and resources and you can most likely simply call most Android ways and they’ll type of labor like you’d anticipate there are components of the android framework that rely on on native code or name it hardware or have interaction with external approach offerings so for that robolectric provides a sort of experiment double that we call shadows and people provide replacement barriers of that code that is proper for unit trying out so remember that that scan that we simply saw if it had like 20 traces of code of like mock mounted code let’s have a look at how that appears in robolectric so that’s a lot much less we’ve got gotten rid of all the boilerplate the scan is ready half the size and way more concise we’re now not pressured to believe concerning the implementation important points as we’re writing the test which is really first-rate Reb logic is going to installed your software in line with your occur and here we’re asking it to installed our pastime it runs it through the right life cycle to get it into the proper state inflates views all that stuff it that we expect from on a device so one can simply engage with it as if you’re on the gadget so we add some texts and fields click on it and assert that it adds the word to the repository now detect that we’re no longer clearly going as far as the UI test that we noticed that we wrote at the very commencing we’re not maintaining that the new note seems on a view monitor that would be the job of another unit test now I acknowledged robolectric shadows they truely give extended checking out api’s to a couple Android classes that allow us allow us to query inside state and repeatedly change your behavior on this illustration we’re asking the applying if any of our pursuits requested that an intent be launched for the duration of the scan we might use that twister that after saving a observe to the repository we’ll go to the to the view notes endeavor equivalent trying out api’s exists for simulating Hardware responses or external services matters like that so at this point we’ve got a failing unit scan and now we get to we’re competent for the convenient phase writing the creation code in the spirit of TDD we’re most effective going to write precisely as a lot as as is needed to make the test go no extra no speculative coding so we inflate a design at acetic Handler and when the press happens we like so that you can be aware an editor repository so now we will run the test see a pass if there’s some growth we are able to make to the code we’ll return and refactor after which we repeat this is where you get the thoroughness and Rev electrical is super helpful for this given that it gives you adore satisfactory fast test runs you can get into a secure cycle so we wish to now not talk about the comfortable direction here we will scan the entire distinctive cases we will there are codes likely to come across so for illustration input validation and outside conditions like the network being down stuff like that Rob let which you could also aid with simulating device conditions that you can come upon for instance that you could specify qualifiers on the notes or that the scan must run with right here we’re announcing like a special reveal size and orientation which would change the design somewhat which you could ask your lecturer to run your test beneath a exact SDK so we will say jelly bean here and it truly makes use of the SDK code from that variant and that you could also inform Rob electric I need to run this test below every SDK that you just support or some some variety of them that you are considering and we aid jelly bean by way of oh proper now so at Google we rely fairly closely on robolectric and we’re investing making it better we have now got dozens of apps including these which have 1000s of 1000s of unit tests walking internally so it’s good combat validated and now we have additionally recently started going for walks the Android CTS which is a dandy legitimate Android experiment suite once more strobe electric and we’re about 70 percent passing proper now getting higher with each release so when you’ve used our electrical previously and found that it can be come up brief or if you’re caught in an old variation absolutely suggest that you just you get up to the ultra-modern due to the fact that it is been a ways we have been working on decreasing friction and then in integrating Rev electric with Android toolchain it really works now very good with with Android studio with Gradle and we’ve bought help for Basile Google’s into Google’s possess open-supply construct process coming soon so robolectric is not a one-size-fits-all testing device it is speedy but it’s not 100 percentage equal to Android in each method so you need to make use of it judiciously as we stated earlier than avert writing unit checks that hyperlink multiple routine together that’s no longer so much a unit test that is a lot better for espresso if you find yourself coping with a couple of threads synchronization disorders stuff like that you’re also mostly no longer writing a unit experiment so no longer excellent for electric and primarily restrict utilizing robolectric to test reintegration with with android api s and things like Google Play offerings you quite must have higher level exams to give you confidence that that is working so now that we have now bought some passing unit tests i’ll have you over to my colleague Stephan to speak about our level checking out thanks Christian so let’s go back to our developer workflow diagram and so at this factor we hopefully have a ton of unit tests and so they completely scan all our industry logic however let’s change gears and check out to look how we can truely write some integration assessments to see how these units integrate and how they honestly integrate with Android and the way they run in a real atmosphere so on Android these checks are on the whole referred to as instrumentation exams and i’m pretty definite most of you will have written an instrumentation experiment before and even though they appear super easy on the outside there may be actually lots happening beneath the hood should you feel about it you have got to bring together the code you have got to procedure your assets you ought to carry up a full approach photograph and then run your exams and there is quite a lot of matters that go on on various levels of the Android stack so these checks provide you with excessive constancy however as John was once mentioning they come at a fee which is they’re slower and sometimes they are more flaky than unit exams so let’s honestly see how this works for your every day development drift so let’s assume you are in Android studio you have simply written your you realize new espresso test and you hit the Run button to run the scan so the very first thing that Android studio goes to do is it will install two apks for you the test apk and the app underneath test so now the test APK involves Android JUnit runner it comprises the scan circumstances and your experiment show up and then in an effort to run the scan Android studio calls below the hood adb shell am instrument after which Android Jade runner will use instrumentation to manipulate your app below experiment so what is instrumentation and i believe you guys will have you guys will have observed this it is a top-level tag for your happen and why is that instrumentation is absolutely something that you simply are aware of it’s used deeply inside the android framework and it can be used to manipulate the lifestyles cycle of your events for finish so for those who think about it it can be a best interception point that we are able to use to inject the test runner and that’s why Android drainage runner shouldn’t be nothing kind of than an instrumentation so let’s go somewhat bit deeper and notice what occurs when Android studio surely runs your tests so it runs adb shell am instrument so that they can end up calling out to recreation manager undertaking supervisor will then call at one point on create on your instrumentation so now that we know that Android Jayne Runner is our instrumentation at this factor it is going to name on create on the on the runner after which the runner is gonna do just a few matters for you it’s going to collect all your duties then it will run all these checks sequentially and then it’s reporting back the outcome one factor to note here is that Android JUnit runner and you could have observed this runs within the same approach than your application and more importantly for those who usually use Android join runner it runs all of the tests in a single single instrumentation invocation Android join each and every runner is closely used within Google we run billions of exams each and every month using Android JUnit runner and while doing so we noticed some challenges that might that we face than if we had to resolve one factor that we see so much is shared state and i am not talking about the form of like shared state that you manage and you that you just code in your app i’m speakme in regards to the shared state that builds up on memory builds up on disk and makes you it has fail for you already know no intent or unpredictable stipulations and this among different matters good at one factor result in crashes however in the previous model that I just confirmed you if if considered one of your tests crashes your instrumentation it will take the whole instrument the whole app process with it and all of the subsequent exams won’t run anymore and this is definitely a crisis for colossal test suites in a similar way in the event you consider about debugging for those who run a couple of thousand tests in one invocation think about what your Lochhead will appear like and whilst you must go for it for debugging so that’s why inside of Google we now have taken a different process so inside of Google each scan runs in each scan approach runs in its possess instrumentation invocation so now you can do this at present right that you can make a couple of adb calls you should utilize a runner arc and preserve your custom script but the hindrance is it might no longer relatively integrate good together with your development environment so that’s why at present i’m completely satisfied to announce the Android experiment Orchestrator and the Android experiment Orchestrator is a method that allows you to run assessments like we do in Google it can be a provider ivk that runs in a background and runs every experiment in a single instrumentation invocation and this without doubt has advantages correct there’s no shirt slate anymore and actually the Android experiment Orchestrator runs p.M.Clear earlier than it runs its scan more so crashes are now wholly isolated on account that we have now single instrumentation invocations if a crash occurs the entire subsequent exams will still run and similarly for debugging the entire debugging expertise that you just acquire and pull off the gadget is now scoped to a specific test and this is satisfactory and that is satisfactory and we benefit rather a lot from it within Google so let’s have a look at how it in reality works so on top of installing the test apk and upon our experiment what we do now’s we set up a 3rd apk on the device and it’s a provider apk jogging in the heritage containing the orchestrator after which instead of running a couple of adb commands we run a single ATB command but we do not instrument the app underneath experiment we instrument the orchestrator straight after which the orchestrator is going to do all its work on the device so it will use android exchange runner to collect your assessments however then it will run each and every of these assessments in its possess invocation and it can be robust and i am lovely certain you are going to you will like this so much and it’ll be available in the subsequent Android trying out support library unlock and extra importantly we will have integration with Android studio it will be to be had in Gradle and we can even have integration with firebase experiment lab coming later this year so now that we all know methods to run our exams let’s truely look at how we will write these integration assessments and normally should you write a UI experiment on Android you’re utilizing the espresso checking out framework and as you can see espresso has this like high-quality and simple API and it truly works pretty simple what it does is you supply us a view matcher and we find a view within the hierarchy that matches that matcher after which we either participate in a view action or check a view statement and considering the fact that this API is so simple it can be the excellent software to for speedy TDD prototyping of UI checks but in an effort to provide you this sort of simple API there’s quite a lot of things that need to go on underneath the hood so let’s without a doubt appear how espresso let’s appear at how spresso works so while you name on view and give us your matcher the very first thing that we’ll do is we’re going to create a view interaction for you after which the subsequent thing is we be certain that your app is in an idle insane state earlier than we are competent to interact with it and this is you could consider of it this is on the core of espresso and espresso is well-known for it like synchronization ensures and the way we do it’s we loop the message queue unless there are not any messages for a reasonable period of time we seem at all your Eiling assets and make certain they are idle and we additionally look at async tasks to be certain there’s no background work going for walks and provided that we know that your app is in a sane and steady State and we’re in a position to have interaction we’re going to transfer on and then we’re going to traverse the view hierarchy and to find the view that suits your matcher and once we’ve the view we then going to perform a view action or a view certian and that is first-class so now let’s circle again to the experiment that we confirmed you in the beginning and have a closer look now that we know how its strain works so in the first line as you can also bear in mind we try to click on the add node button and here we just going to make use of a width id matter which is a straightforward topic that’s matching a view within the view hierarchy in step with its id and next thing we need to do is we need to click on on the view and we use a click on view action for this so now where it will get intriguing is the following line considering the fact that on this line we want to form the title and description and we need to use a type textual content motion for that but right here all of the espresso synchronisation ensures will kick in and only if we all know that we’re ready to interact with your implication we will invoke the sort scan motion and that is first-class since it frees you from including you understand further boilerplate code and additional slipping code to your scan so in a similar fashion we’re going to keep the node and then we’ll verify that it can be displayed on display and this is pleasant now we know how espresso works and we all know the way it’s a great device to do experiment-pushed progress and now i’ll hand over to Nick to talk somewhat bit extra on how you can make stronger your UI test and toughen your significant and medium checking out process thanks so fun so one just right attribute of a UI test is a test that not ever sleeps so let’s go back to our example to illustrate this factor a bit bit additional so in our examples you consider we have now a observe that we retailer into memory which is pretty fast and beautiful riskless nonetheless reliably reality as your app grows you probably need to lengthen this performance and shop your note to the cloud or Google force for example so when going for walks our massive end-to-end experiment we need to use a real atmosphere the place we hit the real server and depending to your community connection this may occasionally take a long time so that you often need to do is in the heritage now the predicament is now could be that espresso synchronization is just not aware of any of your long-jogging tasks so that is somewhere that some where builders will in general do whatever as ugly as hanging a thread sleep in their code however what this presser will not be sincerely required seeing that you could write an idling resource where an idling useful resource is a straightforward interface for you as a developer to implement to instruct espresso synchronization of any of your custom long going for walks tasks of your app so with this ionic resource we made our tremendous finish-to-finish test more safe so let’s have a look at how we will add some more medium-sized stats to your scan suite so for a medium-sized test we want to maintain them small and all in favour of a single UI factor whereas single UI element may be like a certain view fragment or an endeavor so let’s return to our example to look how we are able to isolate our massive end-to-end experiment to extra isolated add-ons so here in this illustration once more you could have seen that there are two movements the list pastime on the left and the add node exercise on the right so until now we wrote a massive end-to-end experiment that offers us a lot of self belief on the grounds that it touches upon various your code for your app which is first-rate for massive intent experiment but it surely’s no longer so satisfactory for an iterative experiment-pushed progress cycle so so let’s examine how we are able to isolate these and have remoted checks for each and every pastime in isolation to isolate the left-hand aspect the list undertaking we will use espresso intense we’re espresso excessive is a straightforward API that allows for you to intercept any of you are going a disturbing verify their content and provide again a mock endeavor result excellent so let’s see how that API simply looks like in order one can find it’s very easy you might have an intent matcher a good way to suit your going intent and that you can provide a version of your pastime outcome back to the caller k so let’s use this API to write our first isolated experiment so in this scan you will find on the primary line we do exactly that we intercept our intent and we provide a stub variant of our pastime effect now on the 2d line once we perform click on as an alternative of opening a brand new activity espresso will intercept this intent and furnish a subjective effect which we can then use on the final line to confirm that our UI was up to date for that reason now we have an isolated scan k so let’s go back to our example and notice how we can isolate the second section correct so when you write when frequently write assessments you come to be ready where you’ll have some outside dependencies in play that can assess that are outside of your manage so in our example right as I showed before we have now i do know that we save and it hits the actual server now despite the fact that we’ve an auditing useful resource now that makes it more trustworthy your tests can still fail because your server could crash for some rationale so your experiment will fail so would not be higher if we totally isolate ourselves from these conditions and run our tests in a airtight environment this will not handiest make your test run much rapid but it’s going to also eliminate any flakiness and beyond this detailed example you extra wish to isolate your self from any outside dependencies so for illustration you do not want to scan any Android approach UI or another UI add-ons that you do not possess due to the fact that they as a rule already proven and they are able to also alternate with out your figuring out so your checks will truly fail so let’s see how our 2d isolated experiment will look like in code so right here we see the important point here is that we now not use the true server and as an alternative you realize we mounted a airtight repository now there is many distinct ways of you to try this and this is just one way so then you need to use this harmonic repository with a purpose to confirm that your observe is actually saved with out ever leaving the context of your app or hitting the network so at this factor should you feel about it you may have two smaller exams that run way more they’re far more nontoxic and run much turbo however while you keep the identical amount of scan protection as your colossal finish-to-finish scan and because of this we need to have more of those smaller remoted assessments in comparison with the giant end-to-finish exams we confirmed earlier than k so at this factor we iterated through our developer cycle once or twice and we should see all of our exams start turning green and we must be optimistic to free up our feature nevertheless earlier than we conclude let’s soar into the long run for a 2d as your app grows and your workforce grows you proceed including more and more features to your app and you can also to find yourself ready where you may have UI strolling in a couple of processes which is precisely what happened at Google so if you happen to go to our notes illustration this may occasionally look anything like this you’ve got a first pastime that runs on your principal system on the left-hand part and now the 2d exercise will run in us in a private approach and on this case we’ll name it add notes so how can we test that good earlier than Android oh it was once not possible to scan but with Android oh there’s a new instrumentation attribute that you need to use in order to outline which system you need to instrument at the same time instrumenting and going for walks assessments against each and every process in isolation is a nice notion and also you should do it you may also to find your self ready the place you wish to have to cross process boundaries within one experiment so you could typically need to write an espresso scan like looks like this even as this was not only viable in a framework level earlier than Android oh this was once also unattainable on this primary degree due to the fact on this certain instance express isn’t even aware of your secondary procedure nor can it keep any of the synchronization guarantees everyone knows and love so at present i am pleased to announce multi-system espresso aid with out changing any of your test code or your app code this will likely enable you to seamlessly engage with UI move system even as retaining all people presto synchronization guarantees and it will be capable on hand within the subsequent variant of Android test support library free up so let’s have a fast overview of how it actually works so most likely as in our instance we begin in one approach where we’ve got an example of an normal runner and espresso in this case now for those who bear in mind from our instance while you click the add node button there might be a brand new recreation and now now we have a brand new procedure so the situation now’s that we have two processes with two specific instances of an customary runner and espresso and so they’re now not aware of every different so the very first thing that we wish to do is we wish to establish communique between the 2 and regenerate runner and now that we’ve got this verbal exchange we are able to use it to establish the communique video to espresso instances and the best way we do that is by having an potential in hydrogen as runner to register any checking out frameworks like espresso with an usual runner and then the runner will then facilitate the entire handshaking required in order to establish communique between the 2 espresso instances now that the 2 inspiration situations can talk to each other it may then use it as a way to allow pass procedure trying out and retaining the entire synchronization guarantees that we had earlier than ok so with that we’re accomplishing the tip of our developer workflow and we showed you the entire tools that you can use across every step of the way as a way to make TDD happen and on Android and with that said although you do not follow this drift precisely confidently you understand how to use every single device and easy methods to write just right checks to be able to bring your app fine to the next stage so if you happen to like to write exams and you wish to have to write an on test like we do at Google here are some resources to get you began but I want to thank you and i feel now we have a while for questions and if no longer we we have now workplace hours at 3:30 in these days so confidently you see that thanks [Applause] [Music]

As found on YouTube zxczxcz

Add Comment