Bestand wählen

Faking It - The Art of Testing Using Verified Fakes

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Erkannte Entitäten
few few few on him at the bar of yes welcome that we all that you've made so much to for all the house of bondage wall a seated about above with plus storage you hiring system them I'm telling you I'm going to talk to you today about a technique we use of work for and testing our our software the software that I will uncle Walker and in particular technique that we use for ensuring that sound the API that we write in the implementation of those API are easily to Istanbul and uh technique we use to ensure that all of the implementations of the the API that the real implementations and the fact implementation are of take in the they behave so it starts out with a reduction and told his American priors so that it could get discussion of the problems that we're trying to solve using these and verified takes hopefully the it that the in-depth discussion of the solution that we come up with and then I hope that I have sometimes been to question but if anyone has been in question then just and I want to look it'll it'll be very nice to meet the interrupts I would have to speak OK so 1st of all the system was 1 of
the number the number of problems with testing um API using unverified phase so ad-hoc mocks so stocks in your text and these are these are things that I these are invited to to my i need the set being discussed previous icons for example by a couple of guys will all be the depressed all the factor and then you minister and they gave a great talk on entitled stopped and marketing and start testing and so they say well that I'm reading here from some sort of a transcript remind that actual everyone think that Google when they were make their own mock objects we had in different implementations of and when the real can change just to find all those marks and update more and this is a problem that I've seen twisted for
example not used to the so
I and I could quite interesting to the project so I did some work on the 20 names more agile last year and
so on and it this proliferation of unverified and mock objects that affects twisted and it does his twisted is about 12 or more years old so I correct for the the thank you for good cop thank classes in the across the twisted can and there are at least 7 implementations of the press twisted based protocols and so it's a fake reactors and know what I was signed probably most guilty of all responsible for is the 5 copies of the same result in the 1st names that have I'm not sure they may not they may not only the maybe degree since incident of this duplication I'm sure the some of these could be our are examples of states that could be replaced with a signal verified dense phase which could strategy so let's twist and it's it's guilty of having these numbers by the next problem with unverified vague locks is that they don't say that it's easy to write them out whole last which behaves just about the same as the AP on your Trent the trouble is that there are often they often inaccurate from the race starts and then they grow more accurate is the actual really API developed the sort of looking while writing this sort of frantically over the last couple days for a time but this and so I mentioned to him stand and that that that's a library which I'm quite interested in called anova Doc which it's age by OpenStack which allowed you to break so nobody instances has dogged containers so I want to how do they how do they test that the new drives with the docket driving the again it behaves properly with the the real with a real doctor demon which is slowing down management and expensive to run the 1st is an in-memory version of the doctrine that that they have have actually implemented they don't and it suffers from these problems that are just prior to that the at the lake has got out of sync with the written down it may always be enough to sink it may it may have been because they don't run the the test them against the bottom the fate and the real they may be they may never be dancing so here's an example the walking you're wrong sorry so we within reported here both the mock trial from murder dock and within policy real-time from Dr. Paul and we instantiate them and we see how the real life case when we creates a new topic so all you have to supply when you create a new dump containing using don't talk is the image upon which the containers place and it returns a dictionary containing the 60 digit idea about container and a list all or uh a summary of any warnings that have occurred while I containers being created when thinking creating that contain and that's not the greatest API it's pretty ugly it should really be exciting something something like a class or a record of some sort of take that information rather than just a dictionary but it is what it is a number of the there no we're
talking the face implementation of fire and we can see that the 1st thing I tried to do is to supply the same keyword argument and it there was a major because it is they have a standard use the same argument and then this is just 1 example I went on I tried tried and tried to break the phase containing using the API on it doesn't return the same results they should raise the same exceptions it doesn't have the same optional or arguments that rely on some of the some of this may be because they based their income and earlier versions of the points that I think actually does not there are some real problems which means that I can't use this state in my which I want to do OK so can we do any better well let's think about what we the idea of the ideal for a verified ideally we we want something that's provides the same the faces the real maybe I we want to be able to run the same tests against the phase is we run against the the real and ideally ideally we would like the face to be maintained by the same author wrote the real implementation that's quite rare said they hoped certain that that will become more common and I'll show you an example of a minute of someone requesting just that so that which
I haven't explained that I haven't really expect occupy I think probably most of you familiar with it's a it's a library that wraps the the doctor demons rest API in Python and it is something that we use of what what the loss of the same that seemed something something try familiar with its in an easy the target in this there's lots of examples like this so don't they think I'm thinking about this in particular OK so I wanted when I started my tools there were no that thinking the same thing that I and funnily enough there is an issue on dark plant occupies if someone is telling us is there any way to make a statement that any relationship Dr. higher requires units as the latter requires a fake trial does not require adopted deemed to be providing a mock implementation will avoid every single user having to reimplement so not he says this is a nice to have well it is a nice help but but it's probably the ideally at the library would come with such a place so that we old and have to reimplement are touching on the side effect so what unusually now my um crude attempts to right so that they can verify the just on any questions about the got current so when you involved in this project but you want where the rest the year authoritative documentation what exactly the trial was what exactly what they don't provide ideally I was supposed to be like find something the color specified don't apply has got all of these documentation with which is a good thing that separate the topic for the for of the time being the advantages of using a well-defined interface Starting with the and this and this is the that's not they the the talk so that was something I think about looking at the improvement in my life yeah and so yes so that's that's the 1st thing I wrote was some of you beautiful with this it is something I really want from which on the alternatives on used the abstract base classes we use this on the right side of the line so so we start with the an instrument so I don't know what we inherited from its we divide research being done I described in this case we the model of the magnitude of the function itself and we might decide to start with the 3 things many you by like that anomaly having you added all of the the argument all the the optional if you want to just just what's necessary for me to make we will use the real part so the
next thing I these great tests to verify the implementation of that and there it's very easy so that they provide you with tools you we you remember text and the 1st thing you verify object which checks the the instances in the past to provide all of them In the case of foreigners checking the argument was that that's something which I think be might have a the that I was right so then without testing test test is defined in what not actually dividing I'll show you how this works in a mode without text written we can run against real and they don't want and having decorated classes a lot of quality of life that and think wanted to have we have the interface implements decorated with the value of of the implementations have part the concert again useful to show you some of the results were going to the
details of how this so structure in order to get this resolved by running trial which you yeah tests of the radiation we'll talk about I'm also going text the units of the task don't test they don't so we have used to the the integration so that would be exercised real got the central module from the beginning which operates on a plate in memory agent that's that's a nice way toward that's the way we organize and what maybe we would like what was reported as well as making use of some existing integration testing existing the last 2 2 sides of and the things that you do we have the we organized the code and the way that the the media test the test makes in the source and the state implementation of of within public knowledge of layer which means that not even they can be imported by the libraries that consume this and it means that we can we can we can use that we can use the tools of greater than and other libraries to verify the years after verified their software will make implementation and real have already said that we a test so that makes it this means that the texts are all defined in 1 class but that class is the this is the test case gets discovered by the federal the way the test run and together with for the way the actual test cases of use of why we have this battery of of so what this this is a function was because you don't this is a function which takes something like that of time batteries the functional form of the degree of structural adjustment last which led instantiated provides a thank then we find find that that where we see the sensitive of moment with the with the unit test test it's we define a set of which the politicians location and then the last by hold on constant all this and this and that that it was this is just a lot the and to put it all together use that 1 generated dynamically based on what happens you here we see how we of dynamically generated test and the real 1 possibility most of the time that you of the real of life we the are current in the sense that by around this state of rules which allows us to have these tests to run against many many version of the of that may not be what want against this discovery where I got the part of the and then we have a
similar case in the test data this time the state government and again we're inherited you will inherit from the class which is being used by the fact what noting also that this that and the test classes and it is quite lot of the purpose of this I and with that it was we can start now question at the interface with the so called always got to test the the interface the interface to the usual lower method and the methods have right about we start adding that so it's not anywhere really it's called describing it as some of the problems with when you buy a stock with a test for us the topic of status we very few the show that people table on the real get about and and without having the greatest and then we have well this is what this quantized on this list that the latest version there we can then we get a lot of things we can do is just enough to make sense see we've got the memory a dictionary of the we thank you for returning the the idea you can be the starting point that might not want to by the long wait the week so this is probably 1 of the main so we've got inflation as the result of that of slightly longer we now have the best passing again we'll In both cases we can use the the person so that we continue the process right test right that's picture of passes factors we go along with his own life operating in the same way that the same parameters wanting to we talked about use of destroyed containers 1 of the we I mean actually right more more or be in a phase of life by the fact that and get this
is this part of of this thing implementation of the listing of containers selection of the text of the great regional and removal of when it was it was probably a problem at so you have hinted at some complications while quality writing this 1st complications this is what want the this complication is with your you'll also have tried to write tests which only exercise public public so you trying to creating you need to create a data and then ensure that terrorism is this all you want to we don't have to you want to test the all the containers that are available are listed in order to test that integrates so you can't quite implemented the method by and then you have to you have to do practical implementation just another problem I encountered in which I we always have doing this stuff is that you you want to start with the 1st on your running this test to get a real job what you need to be aware of the meaning of pain rate of test so that that you already have your you to only use public you know have to implement the removed and take the car test review contain method until you've got away with being created so again you have be practical when the the that's just and this is what I we try to work those tests public API tempting when you're trying to overcome the problems of just described annotation the test so the implementation you might find it helpful lifestyle trying to write test that usually not what you just think of testing only public parts be the parts the class to being defined enough so that so that's that's all that's as far as I'm going to go with that showing you the the the annotation and they governed by that I wanted to briefly describe some of the examples not maybe not all of them some of them are not quite same right the 1st 1 is the 1 that was by which which was work with we had we would talk with great area this is the process of where time which creates an attempt to destroy all of the those things that you need a view of the gas volume that but we don't have to run our test again later what did we don't have to run tests to get to but what we do have to be very slow tests to run what we really want to run out run our tests this despite what made by the guy against the right of simulation of there's a lot what devices you can have a look at how we can have all of these slides will of code and you see that we've implemented a link back simulation of these what devices because implementation of I device which creates a batch of files and that captures the to 1 or more so it's a long process it's actually attached to the person why did not have a way of testing running our tests is this area much faster than we would we have to remember that the real I was and Rackspace another example Chinese I'm interested in how get from developed by a guy who was developed by mark to those interested developers from this matrix and this is a system which allows you um creates fake version of the news that the rest of your life and this is something we don't like to use of trouble is it doesn't get implement the during that's some again something which I like to try and do and what this what this is is where web service which can be primed with the successful and error cases and it's a web service which you can make rest API requests to travel the state but that's that's the requests come so you can say crater known for instance and then you can ask us to take API for a list of them over instances in which they just details of the even simulates the keystone augmentation we really you know world from my colleague at small develops a library code which is what go structured log structured logging library and from the start built into the various features which make it easy for us to test code that uses of studies implemented and they have memory loss and a he has to be aware but interfacial biological memory loss which is and he's got is something that is actually in in the public Elliott packages provide tools testing your code lobster correct messages launched the correct errors so that's really has a really good example of this technique and finally I thought worth mentioning is very recent what spite about going even further right your face in such a way that you don't believe that the face with with the attributes that are actually present in the real world the the firm that achieving that separation which again I haven't yet so I haven't done that we might have this is the reason for talk that them as the next day to so I think we're about out of time ready to summarize we've seen some of the other the problem with a very wide makes involved have we look at some of the some examples of problems we the creation of what we show how we might go about writing and verified from scratch and we've seen some examples of other In other from Python examples of this type and that's really the that's the of talks about sort of the the thank you with the leave donor of any template you 8 so you're free to go to lunch but if you'd like to say a mass assertions than you free to do them and does anybody have questions
Statistischer Test
Faktor <Algebra>
Trennschärfe <Statistik>
Befehl <Informatik>
REST <Informatik>
Einheit <Mathematik>
Rechter Winkel
Ordnung <Mathematik>
Lesen <Datenverarbeitung>
Tabelle <Informatik>
Objekt <Kategorie>
Klasse <Mathematik>
Interrupt <Informatik>
Reelle Zahl
Äußere Algebra eines Moduls
Spezifisches Volumen
Attributierte Grammatik
Protokoll <Datenverarbeitungssystem>
Elektronische Publikation
Binder <Informatik>
Data Dictionary
Komplexe Ebene
Dämon <Informatik>
Prozess <Physik>
Statistischer Test
Web Services
Einheit <Mathematik>
Prozess <Informatik>
Lineares Funktional
Nichtlinearer Operator
Ideal <Mathematik>
Arithmetisches Mittel
Erweiterte Realität <Informatik>
Strategisches Spiel
Projektive Ebene
Speicher <Informatik>
Bildgebendes Verfahren
Dämon <Informatik>
Physikalisches System
Objekt <Kategorie>


Formale Metadaten

Titel Faking It - The Art of Testing Using Verified Fakes
Serientitel EuroPython 2015
Teil 140
Anzahl der Teile 173
Autor Wall, Richard
Lizenz CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
DOI 10.5446/20194
Herausgeber EuroPython
Erscheinungsjahr 2015
Sprache Englisch
Produktionsort Bilbao, Euskadi, Spain

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract Richard Wall - Faking It - The Art of Testing Using Verified Fakes Have you ever worried that your tests aren't as good because they're running against a fake or mock instead of the real thing? Verified fakes solve this problem. Verified fakes allow for simplified testing using fakes while still providing the assurance that code tested using a fake implementation will behave the same way when used with a real implementation. The talk will begin with a case-study, demonstrating what it means to write a "verified fake" implementation of a public API. I will show how to write tests that verify a fake implementation of a well defined API and I will show how those same tests can be re-used to verify and test real implementations of the same API. The talk will end with a proposal that more libraries should include verified fakes. I will show, with real-world examples, how verified fakes can be used by integrators and discuss how they are superior to ad-hoc, unverified, mocking. During the talk I will refer to various real world, Open Source examples. Including: * Flocker's Pluggable "Block Device Backend" This API allows Flocker to manipulate file systems on OpenStack Cinder Blocks and AWS EBS devices. It also makes it easy for third parties to implement their own Flocker block device backends. * Eliot's Memory Logger - and its use in testing and verifying logged messages. * LibCloud's DummyNodeDriver - and its limitations. * Boto - as an example of a library that could benefit from a verified, introspectable fake. * Docker-py - as an example of a library for which we have written a verified fake. There will be at least 5 minutes for discussion at the end of the talk.
Schlagwörter EuroPython Conference
EP 2015
EuroPython 2015

Ähnliche Filme