Merken

Intro to Mocking: Why unit testing doesn't have to be so hard

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
what about the end of the and the proof of the and and and the and the end of the IP colour rights as interim mocking why insisting doesn't have to be so hard I'm general Davis a little about me either suffer
developer about 8 years now but I'm assuming consultant excel consulting in Washington DC and went back to myself I recently well not recently in December I ran the gingerbread the Jingle all the way 5 K dressed as a giant gingerbread man man who was you that looks like this is a caricature of that
I was awesome I have some recommendations on things you should not wear when running a race up built as 1 of them so right out list of which survey crew here in the
room has ever been frustrated by experience writing unit tests show yet everybody in this room here of myself included I think you all for raising your hands on I think I can do this with the same you had I saw struggle to write unit tests for so many years it was very refreshing hard until I finally learned about marking in sort of that made the lights you know the light bulb go off my head everything for a click that they have a a rendering
of that and that was sort of however felt for me but my point is this I think a lot of us here in the room or are in the same
boat and we all kind of 1 right better
unit tests and we I talked a lot people here they say I really wish somebody would sit down and write presentation on this stuff and I just tell me what I need to know so I wrote this with that in mind and if that happens to be you in your particular situation hopefully this helps to so the family unit test but
hopefully you've seen this at some point not this is Martin Fowler's permanent testing the idea is that he tries to quantify how much of our testing should be unit test forces integration test versus like you wire manual testing that sort of thing so obviously the significant majority of it is unit testing just kind of ironic because many of us really bad unit testing we don't write lots of unit tests like we should I would ask people about this
stuff I get all kinds of stories about why they shouldn't for example they tell me like well you know it's really given the problems are easy but I wrote this problem when you know the find kinds of things at the test and I have try test for my tests in the code it's really complicated I call this the rabbit hole testing is kind of like going down different layers that becomes really really hard and so you know mocking doubles with that no no worries another thing here is that of people tell me I spent too much time writing these tests right I lots and lots of code and they have to write more tests for my code that's right test-retest suggests 2 big problems marking and help us solve that last we hear people tell me that that we can't really write tests for some things just this is so much stuff became unit test this sort half truth right I admit that there are things that we cannot covered simply by using unit tests but I think we way overestimate what that portion is it's actually very brave well known and small fraction of things that we cannot test in testing is incredibly powerful tool and mocking helps us make them more valuable and more of it helps us fill that space so mocking mixture testing easier so
were maps exactly what is that much on this sort of a strange but a subclass of thing called a testable and testing are the ideas we typically have a test of the test spies mock objects that sort of thing but you here we sort of use these i'll call these things marks interchangeably but understand that maybe in an academic setting this might be a more important distinction the purposes of this of this presentation no and the column so 1 of those things specifically well you have a
test and ideas that provides a canned response to a method call it spine which is a real objects that behaves like a real object until a certain condition is met that does something else I never mark which helps us to verify that something was called were you verify behavior right so
is thing does anybody in the room feel like after giving an explanation that they understand mocking significantly better in the radio test no of course not like for me I think what helps we talk about marking is understand the types of problems that mocking helps us to solve OK so let's talk about things that might help us solve 1st problem whenever the have a
dependency right so here I have this a simple method through everyone's favorite and depending upon the value get back from that the bar is the impact how the method behaves so this is a dependency we can write this down as tool that's you know is going to depend on board right the problem is is that in order to understand how food works I need also understand how or works in that creates a big problem if I could eliminate the dependency affected the figure out a way of making a dating certainty with bar then I could you know test that more effectively so mocking helps us with this 2nd problem what method has the return value so have is that your food and depending upon the value of X is either going to call Boris the call something else but I don't know what's called now sure we could write unit tests for this and they you test could say well depending upon the side effects the bar has you know we can sort of introspective figure out some right was a really bad we write tests really really cumbersome and painful right if I had so to say did Beauregard call I have much greater certainty and no better so mocking helps us with that lastly if I have a situation where would generate an error exception right but that exception is really hard to generate so not my like a type error or a file not found right so in this case maybe something that that's that would be very difficult to a memory error if I could technically generate this somehow like by adding load the server 1 know that is not a good way to test this very far if i is reliably call that make testing a lot easier so that's a much help to solve a couple of
things but so you happen to use a popular web framework that insist that you have you know database calls for all the mothers and spins of test database like gender does if you don't have to have a test database to test to be a lot faster in some cases knocking a model makes a lot of sense so this can be very helpful they're it also helps us to reduce complexity so by writing simple tests it's really easy understand what those tests do and it's really easy right them because it's quick and simple so marking helps with that 1 thing that I wanna point out is that but we don't think about this but if you have people who are working with your collaborating and hasn't written the method yet you can mark those methods have been written yet you can write unit tests for them this is way better than if you had to wait for all those things to be done you could just you know you have to wait for all the components we fish for start testing it just makes you more productive and efficient you can test things earlier and that so great result you
want to use my heart I actually do this but fortunately for us in Python we have
lots of options on the 1 we're going to focus on here is the mark the magic marker library but it's very popular it's extremely powerful and good news for everybody using Python 3 it's included in as part of the standard libraries possum but there are some other options that were tossed out there in fairness so if you ever have moved released Lexmark there's a Lexmark various easy mark Java there's marks and marker guess which is an incredible name for a framework on fudge if you never use much yellow line up with like the job space or if you're a big fan of doctests there is many mark OK but for the purposes of this and focus and doing this with mark I'm just know that many of the examples I do here we we probably do those no other frameworks as well at 1st use
sample problem like that's what I should put this in code do something with it and it really helps to think about this set a problems so let's create a little problem space for ourselves a real world situation let's say you want to build up a tender competitors OK that's a great example at right is the popular dating at where you to random picture of somebody and yet despite the writer left in the to indicate your preference but we we want to will clear the software development community of course right so like you get tenders are taken aback grinded let's let's think of maybe I don't like stopped OK so the
of the of the doctor dating act is or of any use that this is a great idea of self this since
the nominal minimum only them option yourself from OK so what's your building your doctor dating at and we couldn't method for this right where we get to the root of random user that is that I want you to grab a random user from the database and show that the estimates of the current user the only criteria here so I can't see the same person I etiquette assimilate already I've already swept up again so very simple we arrive at a settlement of implementation for that so something like this so the next person is going to call the method get random person and then we go through a loop and says that if we've already seen that person just keep grabbing random people and so you get at a somebody you haven't seen the return at 1st a fair enough OK now those of you who are astute Python he says but will probably know something interesting about this is above in this code of course we found in testing so of course surely no 1 could ever have seen everyone the database right so if you do see everyone and you get into an infinite but we're going to ignore that for now because it makes the problem more complicated and might makes the example was pretty so let's assume their database is sufficiently large out to do that so let's represent the relationship here so get next person is going to call get random person so we can write a test right very simple very easy to use my unit tests and scared is a general set right we have an arrangement that are preconditions you say that's a dictionary of people have seen is empty and then expected person that I was key that my actions and we call get next person I store the result of that and i compare the expected results to the actual results very simple and candidates this only
works if it works it's crazy that so something right except it also doesn't
work there sometimes it fails and that's not cool like six-episode time every
time so what's going on here like this is a problem so what happens is
that random person obviously picks a random person so that means that there is no way for us to really have any certainty to it and even if I knew the implementation of get random person I could not writing a test for this without market but whatever was some way we could fix the value of get random person but you make that serve so how we do that is the where a model of the balance these
yes that we're going to here's how we do
that I there is a very simple method here there's eversible decorated here I call patch and the idea is inside of patch we're going to pass in is this is the of module that actually so in this case by modules application and then the unbound method is get random person right when put that decorator on there's that passing arguments into my test method called Mark get random person but and then really gonna do here is to build on the do is call this thing called a return value 1 means that the value of that to be a fixed in this case the so what this does is that whenever that random person method gets called it's actually called a mock method instead as would return back that fixed value not that many have certainty method now we know how to get that by backing good news it
works every single time every single time it works you can call over and over again
even not surrender method we fix the value of it you can test a reliable such great so let's take a look for those to some variations on this right we we rarely work with unknown methods what about class you know so I have a
class again just restructured the so that's that method is inside of class called application how the not that same idea here we have a saying it's not every patch that object is the dispatch any person class name and then the method which 1 among everything else about this is exactly the same as the previous example so is very easy for using you know a class or for not using a class of but what if you're like I'm really kind of new to Python and scared by decorators I don't really like decorators a kind of magical and weird so now we have to have decorated we can get rid of that so here's another example I all we're doing here is we're going to make a direct assignments and this is awesome because Python allows this as you can literally overripe that method with a call to a new object you basically the setting that method to be a mark and then we just set the return value so after the idea here with this us but what if you're like OK you know I'm actually a bigger fan of context managers I really low context measures for good news content managers do
you can use with statement that's that's great but so as the general idea
behind sort of marking a for dependency but what happens if I wanna call this thing multiple times so here's our
here's our sample code but whatever the letters the while loop inside this so the while loop and get that you know that a new person each time sorry you test for
but the problem is is that when I said that returned by I don't really know who I should set the return value to lexicon and turned it into an infinite loop I do this where it's going to be in over and over and over again because they keep return the same value the same values in list blood scene just keeps going to how we fix that so there's a a
method called side effects and the idea here is to just make a slight change to our method I call this thing here called side effect and it will take in all in irritable or a list so by passing a list of the returned by sigh once each time that method gets called it will just return that you know the next the next thing in the list so 1st automatic Mary than 0 then the so if I'm testing that investigate called multiple times that those values then the so that's really all there is to like dependency of the dependency management here it's really not particularly complex let's recap
so we can use mocking patching to sort of brings certainty to all dependent methods so we can eliminate those dependencies in the code even if that even if the dependencies are unfinished those that I didn't point out how I get random person was was implemented it did not that could could not even work but I was it was solely by writing a test for this but also lots of different ways to do it that your favorite show hands in the room who likes to do it without the decorators anyone to a couple and but again a talking doll folks I find they're always like a handful of people who were like this makes more sense to me this is better and it's it's great there is in some cases it makes more sense to do it in that style and some user makes sense is the decorator I'm it's up to your personal preference at 2nd thing not with
marking to verify behavior OK so let's us of a problem space force again let's keep on with our with our doctor dating at but what like about the matching system here
so when like the right but if the other user has indicated they like them the on business and both of them are a message unison both message saying you're match game if the other user has indicated they dislike them then we're sort of looking down gently than no there's there's other fissions use other you know opportunities and they have evaluated yet then but we won't do is send the giver time message so that a standard general set up here are for how we react to someone who died in the actions white so simple implementation for this
very easy we could just you know have an evaluation method takes into people are person wasn't person to use likes then we send both people e-mail if person was in person to use dislikes that we call the let let down gently method and if person 1 is not in your likes or dislikes then we're going to call the given time simple enough but this sort of problem with this how I just as it has the return values handling no this is functioning properly we all agree this has logical and needs to be tested but how would I do that so let's focus on the middle section here and let's try writing a test for it but we can do behavior verification with
mocking and it's very simple story it's base the exact same worse that tweak it slightly I we have that patch decorator so again application that let down gently to give us a mark of the let down gently method but in management here just have person was in built and person to assist dictionary of you know the people they like and that the other person has like disliked of a coal mine action to evaluate it it is different here is in my assertion and call this method called call count what school of Marx's is that they actually will report every time they been called allowed to verify and say how many times you called and you can use that to verify the behavior so it was called 1 time we know it's functioning correctly it should have been called given the situation I've created here so that's nice but you might say well more robust way of doing this would be like what about checking the parameters and
that is how many times it was called right makes sense so we can do that to same exact set
up here the only difference is what I call this method called assert called once with just 1 among all the say but at all it's doing is it's checking to things called 1 time and checking that it was called i with the appropriate parameters in this case person 1 this will allow us to verify that method was called with exactly we expected no 1 variation of this is you might say well that's nice but should we also check the other methods take should there
not being called so for the for example those things right and we might have about their code somewhere that says you know that they were of that calling everything or 1 so how can we check against that so that's great that's a good idea the only problem is when to having to mark multiple things right so can we even do that for course in Python we have the ability
stack decorators so need patch multiple methods you can do that I just stack them 1 on top of the other and it works great 1 thing I do point out about this tho is that if you buy a stack the decorators because of how Python evaluates those you have to be very careful about how the order in which your arguments come in so that for example the the march give it time is the 1st but the 1st parameter as opposed to the 3rd because Python evaluates them from the bottom up as opposed to top down so people find this confined is kind of counterintuitive but just something to keep in mind so you don't end up getting those mixed up and call on the wrong box and everything else with this is pretty much the same so we basically have uh we bases if you look at the call count and make sure that it's said 0 for those other methods and verify arguments with the 1 we meant to call so if you're concerned about possibly mixing up the ordering on those those decorators you can try using multiple which gives a little bit more of a reader and structure to it I will make it a little easier to kind of article is and and then it comes in the order that you sort of expect so it is another variation of height can you this is another thing you can try it that uh that makes sense to you that like to do ever the hospital stays the same art
so what about testing things they've been called multiple times we talk about verifying the behavior being called once but what happens if we have a case like here at the top we call send e-mail twice really evaluate you know the parameter of the premise being passed in which will which call we talking so was eagerly had had a fix that problem so in this case we would do if
I were would have a thing called moving a method called words list and that's good basically the report every single time that the method was called in the parameters that were in returns back the list of core arguments are the ideas that I can assert that against the physical wrapper so the call of Paul is just a wrapper around the parameters of your of your method so we can evaluate that against you know uh against a person 1 person 2 so if we called twice so the 1st call will give person 1 2nd call a person to good mn with me so far should enhance a bit cool I
almost and I know this is the end the day for you guys if you need to take a brief break I've Gutkin for
you know if you guys are really not cat fans in your dog people I have some delightful
Cordy's to make you happy but OK to talk about 3 things that mocking helps us to solve right button helps us to solve a mug of Saul dependencies modern helps us to solar to verify behavior and smoking also helps
us to evaluate the exceptions being from so let's have a problem right let's say are also mn Dr. dating after that we want to have a payment system because of course adding a premium feature totally works every time it's great but and in this case a mystery you strike because it was convenient and easy but you could imagine doing any other number services so a great a
simple submit payment methods the idea here is it takes in a striped token of literally just copy and pasted this from the from the tutorial more or less on I have an API key sets and static simple charge in this case is going be 10 dollars but you can imagine this being in like your gender view coder rating where forms or something of that nature so even though I'm not necessarily pointing out you know gender-specific stuff I'm just sort of pulling these things out to keep this in the examples clean but this is very easily something that could be in your view so in the case of this so that the charge going through what is returned back the charge ends if it's and of failing those like so let's in the car gets declined well then you have a generative part and he wanted to catch that maybe in this case will love will just you know pull out the body of the year and will pass it back user some sort of default implementation here than happy particularly fancy but that's kind of our set up here so they would write a test for this I wanna go about doing it like the stripes documentation they have is really weird thing really suggests are putting in different part numbers of the ideas that I have different partner resort turn different values are different types of errors of different things went in test mode and so by pass in you know 2 4 2 4 2 4 2 4 10 dollars a both a payment find no exception that sort of thing so that the recommended way of of testing that's that's sort of ridiculous you know it's sort of crazy that that's how we have to test this thing it's crazy because it requires to make an external call to our API Loretta unit test so that could be problematic what happens is that it eyes down happens that they can doesn't work or what happens if we you know are just running all kinds of connectivity problems is can make middling is not not good it also super includes people were maintaining was what those numbers mean without them actually looking at the documentation so imagine 6 months down the road you're looking at this unit tests or someone else's looking at these unit tests was to those programmers was not mean wasn't do you know that make any sense then they have to go to the website and for those numbers in G 1 sure because maintainable and that's not the work for us also we run the problem the striped token this is the 1 with the bigger frustration for me it's not just a dictionary of credit card field sexual unencrypted token so far passes this thing in had to actually reverse-engineering can figure out what that value should be as some sort of like encrypted hash so I have to generate its made so talk was and it's like unmaintainable unreadable small token of some kind I don't know what that thing it's that's no good so clearly there's gotta be a better way to do this right we all know better now everybody in the room knows is a better way to do this right we tried knocking at church
you know are urged same idea here
were using pretty much the same general pattern recall that patch decorator and we're gonna actually patch the stripe charged that create method and new set up a sample that cart error and the idea here is what is passing whatever I once you can set I like to with whatever error messages and put in and then when the call good friend side effect the guys remember this rule in the presentation i said that advocates that takes a list but it actually kind as double duty side effect can take in an era of objects but can also taken an error on exceptions so in this case if you give an error what I will do is whenever that method gets called it will raise that exception so raise up and then we can catch so that's really nice because then you know I can call method and verify that actually has the correct behavior edge past that Carter and that's it this very simple very easy way for us to generate exceptions in our in our code and test all those branches so
what so let's talk about the takeaways here right so than easy just wrap this up for us it is nothing you guys are more this presentation it's that marking makes but
it falls 3 very specific cases for us we eliminate dependencies we verify behavior for things that have a return value and we can generate errors on the life you want the only thing it's kind of holding us back is we see in practice with this you know lots of examples hopefully guys that can make good use of that do I tried your own you got the redox very uh very good documentation there lots of lots of information appalled most the things from that but if you using Python 2 you can just pip install a using Python 3 it's already built in so it's party there just great on the way I learned was basically tritium adjustable test classes and trying it out in writing a test around it just to get practice of 1 right some
tests they do it the
questions who here thank you like the will the figure of the topic of the political will on the part the of the withdrawal of suppose that this really about what and especially because you were playing and I know of that but that so you but still at yeah and so whatever it is you because you think you know that was very proud of the things that aren't willing to do this until it is part of of model and so it's just I told or was the source the more samples for masters really kind need to be this you think that the properties were holding instance and was is at the end of the right to alter this so church so actually I thought was the last time thinking about this sort of problem that is a great question to to sort of like they were a lot of more dual developers missing like well where what when time is like in Jenga land or alike in sort of generic custom code and you know and I ask them you know what they need trying to test a trying test the integration of hedging of its together are you trying to test out some custom logic that you wrote on In some cases it makes sense to use like changes test runner and sometimes it makes sense you changes clients and other case it doesn't for like mocking out of models that have particular fields you can put in like that you can get give us back our new creature when you creature marked and that at least helps somewhat but in other cases it almost makes more sense to just use like changes test-fired a test flight and grab data from a picture so it's sort of like they're like little is saying these said only his marks ever you know as well the pragmatic right if I'm trying to test something when getting out a database and has a complex relationship but I want to test me 1 make good use of of that some sort a logic for States custom but we should be using a we could be using uh the stuff the Django has built on that it makes sense that area known and a sort of it's more murky area you know is not a good clear hard rule on like you need to just use this particular thing the only do in this case it's sort of if it makes sense it's pragmatic do it that way if it costs you a lot of pain and effort than you know don't do it that makes adventure question but it's sort of the where so this is my lack of knowledge of the house to you do this really I like that here and the service so that In the light of all around the world on this so it is on the right life so that was the framework that the worst forms that are almost the hybrid grids and some of right exactly so it's because it's making calls to the database because it's making calls to bits and pieces of Django various setting or whatever like you know it's something that isn't really unit tests more integration test and that in the day like on it's not it's not the end of the world like it's good to have integration tests and it's perfectly OK to do that you know it's I mean you're writing tests that's good no matter what you know you're making your code better on but it I I feel for you I have the same problem and I don't really have like a great solution for you know I know I know next next year that will work on this but but is a great question something I I've been thinking a lot about that 1 question I would ask is I've spent a lot of time recently dealing with a lot of so API as or very heavy external reliance on services that are always documented for how they're going to behave in certain instances and do you have any kind of tipster pointers on how to use mocking in order make some of that stuff easier who is this coming it's at like 1 of the things that's kind of tricky with marking to use that I with the money that 1 1 of the downsides using a mark is that it will is a light pole whatever on it just as they will say like lab that even if it's technically should exist a should not exist it'll say like 0 that's fine you call it I mean out of its they're not but is is it's a dynamic language I when working with something words it's a little more alike unknown nor sold that the confusing of where you know what things should be but the best the best advice I guess I can off from that is but it was uncertain then but make it something it's explicit your test so the ideas like I don't actually know the skills are there so I might as well with an API that I'll but it with other people who written API as like well a cow works as well but they don't have really strong documentation and I want my stuff to be both a velocity very very you know concrete well-defined what you want is your test to fail if that method or that thing doesn't exist right so hey this this method doesn't you know I was expecting that this thing would be there as that this method the available but it wasn't and then that forces a discussion between you and I the people who maintain the API for it raises a red flag for you and you go all cracked this thing was supposed to be there it you know is is an assumption that I've made that would be there but I I'm you know in a I now have to rewrite some things make sure that accommodate that then extends cool other questions at the go for his age create models that which were not and if they had exactly so yes thank you so much that the criollos that that will like the old figure out what the methods are supposed to be on there and then if you try and call 1 that doesn't belong to that class that it will it will not raise exceptions dead so yes excellent point thank you anyone else yep here's or somewhere in the under in the right of this I I tend to be honest I tend to write my code and there are the tests but this is sort of I was talking with this with the with the Virginia developer and use trial on trial on Django traveling Python and the challenge to bring into was that he would he would try and write a test 1st but he didn't really understand or know what the expected result should be so because you didn't really know or understand the expected thought should be it was hard for him to write a test because the more times renewing around figuring it and then what I wanted him to do was more experimentation in what happens when you call this what does this do arm and then verify assumptions with testing I like the approach I think that that makes a lot more sense since less lot less topsy-turvy you know it's it's uh easier for me cognitively to think about that like but that In the TDD vein I would say work on a small section of code stop and that tests for to verify that thing works and then move on vs. sort of play has 1st of you know and then try to write your code so it sort of it's not exactly TDD from not unknown evangelist forest but and if you're writing tests in any capacity I think you're least doing something better for yourself you're you're quantifiably making your code of high quality so I i the query word sort of getting close to to this question with with your last answer but when the challenges with this kind of approach is that it makes it it's very like you have to know about the implementation in order to know what to market right so you never having kind of brittle tests are associated with the implementation of right more than you might like to do you have any strategies that might recommend for avoiding the problem is still a brittle new clever well I mean you like you know that they get random person is being called by that right so you have to know exactly what to mark inside the implementation of new tested on not like I I thought about this a good bet on the it seems to me like about where when I write tests on some of it is at the end of the day I have to know how the method functions somewhat you know the the actual details of how it's implemented can shift but when I write a test and sort of like saying that sitting in stone what I want this to be in high I want to behave so it sort of upwards that way whether the release the road so don't think it's necessarily brittleness it's sort of like but OK I'm writing down encoded exactly what I think this method should do exactly how I think it should behave you know if I think it should call this method it's going to call this method and when so many changes it to not call them at the because they're affected that test will fail and that's good that forces that like 0 shoot I change something you know was is a valid test this is still a valid test that we need to go through so so this early you know obviously trying to capture some of the logic of you know so I and in the examples of you know I know these methods are being called but they fill in the logic of my decision tree you know the things I'm trying to test and the logical inference put it to sort of it's a gray area of sorts you know this is in regards to some the all problems something that I've divides the problem but a all of a fixture marker load a fixture that generated and I'll use a file to document how are generated literature but my question for you is Jerry experience with mocking daytime the i'm gonna toward a few times over like I always get to work the if you if you just use mark on the time it will work because it's a C. 3 right but there's a library the I've always managed work without resorting to and store on number the library is when we're personal strands snatch they haven't haven't work that surprisingly so they they fled have not been involved in like time zones and that sort of stuff so I unfortunately loudly wisdom there for you but at best of luck here that the if I feel I feel your pain you how right those error is that you can hold on to the cooperative that's so error for a freezing times who thank you thank you if my if I had my faith deepened my
NP-hartes Problem
Rechter Winkel
Beweistheorie
EDV-Beratung
Softwareentwickler
Metropolitan area network
Komponententest
Rendering
Schreiben <Datenverarbeitung>
Mailing-Liste
Sondierung
Quick-Sort
Schreib-Lese-Kopf
Softwaretest
Komponententest
Punkt
Familie <Mathematik>
Kombinatorische Gruppentheorie
Quick-Sort
Softwaretest
Bruchrechnung
Maschinencode
Punkt
Komponententest
Schreiben <Datenverarbeitung>
Raum-Zeit
Quick-Sort
Integral
Zusammengesetzte Verteilung
Forcing
Rechter Winkel
Permanente
Mapping <Computergraphik>
Objekt <Kategorie>
Softwaretest
Menge
Konditionszahl
Endogene Variable
Vererbungshierarchie
Systemaufruf
Kombinatorische Gruppentheorie
Quick-Sort
Softwaretest
Soundverarbeitung
Komponententest
Typprüfung
Schreiben <Datenverarbeitung>
Systemaufruf
Ausnahmebehandlung
Elektronische Publikation
Whiteboard
Lesezeichen <Internet>
Rechter Winkel
Last
Festspeicher
Datentyp
Server
Ordnung <Mathematik>
Figurierte Zahl
Hilfesystem
Fehlermeldung
Resultante
Softwaretest
Komponententest
Punkt
Datenhaltung
Schreiben <Datenverarbeitung>
Systemaufruf
Komplex <Algebra>
Framework <Informatik>
Benutzerbeteiligung
Informationsmodellierung
Geschlecht <Mathematik>
Zusammenhängender Graph
Maschinencode
Güte der Anpassung
Applet
Raum-Zeit
Framework <Informatik>
Konfiguration <Informatik>
Reelle Zahl
Prozess <Informatik>
Fächer <Mathematik>
Rechter Winkel
Mereologie
Stichprobenumfang
Randomisierung
Programmbibliothek
Softwareentwickler
Gerade
Resultante
Schätzwert
Softwaretest
Maschinencode
Komponententest
Extrempunkt
Datenhaltung
Präkonditionierung
Gebäude <Mathematik>
Gruppenoperation
Implementierung
Konfiguration <Informatik>
Data Dictionary
Loop
Menge
Rechter Winkel
Randomisierung
Wurzel <Mathematik>
Netiquette
Softwaretest
Summengleichung
Informationsmodellierung
Rechter Winkel
Randomisierung
Implementierung
Softwaretest
Parametersystem
Patch <Software>
Randomisierung
Systemaufruf
Kartesische Koordinaten
Modul
Patch <Software>
TVD-Verfahren
Datenmanagement
Fächer <Mathematik>
Rechter Winkel
Güte der Anpassung
Klasse <Mathematik>
Systemaufruf
Kartesische Koordinaten
Inhalt <Mathematik>
Kontextbezogenes System
Einflussgröße
Demoszene <Programmierung>
Loop
Maschinencode
Multiplikation
Befehl <Informatik>
Stichprobenumfang
Systemaufruf
Mailing-Liste
Quick-Sort
Softwaretest
Soundverarbeitung
Maschinencode
Subtraktion
Lesezeichen <Internet>
Punkt
Datenmanagement
Mathematisierung
Mailing-Liste
Quick-Sort
Matching <Graphentheorie>
Forcing
Spieltheorie
Gruppenoperation
Implementierung
Physikalisches System
Quick-Sort
Message-Passing
Raum-Zeit
Softwaretest
Patch <Software>
Datenmanagement
Gruppenoperation
Programmverifikation
Systemaufruf
Kartesische Koordinaten
Garbentheorie
Zählen
Fokalpunkt
Quick-Sort
Leistungsbewertung
TVD-Verfahren
Parametersystem
Subtraktion
Menge
Parametersystem
TVD-Verfahren
Maschinencode
Bit
Quader
Programmverifikation
Systemaufruf
Zählen
Quick-Sort
Patch <Software>
Multiplikation
Minimum
Stützpunkt <Mathematik>
Ordnung <Mathematik>
Datenstruktur
Softwaretest
Parametersystem
Bit
Wrapper <Programmierung>
Systemaufruf
Speicherabzug
Mailing-Liste
Wort <Informatik>
Verkehrsinformation
Sichtbarkeitsverfahren
Dienst <Informatik>
Rechter Winkel
Pay-TV
Fächer <Mathematik>
Programmverifikation
Zahlenbereich
Kontrollstruktur
Ausnahmebehandlung
Physikalisches System
Computerunterstützte Übersetzung
Programmiergerät
Subtraktion
Komponententest
Natürliche Zahl
Zahlenbereich
Implementierung
Hydrostatik
Bildschirmmaske
Einheit <Mathematik>
Geometrische Frustration
Reverse Engineering
Datentyp
Hash-Algorithmus
Default
Einfach zusammenhängender Raum
Softwaretest
ATM
Sichtenkonzept
Systemaufruf
Magnetkarte
Ausnahmebehandlung
Token-Ring
Bitrate
Quick-Sort
Chipkarte
Data Dictionary
Datenfeld
Menge
Geschlecht <Mathematik>
Rechter Winkel
Mereologie
Schlüsselverwaltung
Message-Passing
Fehlermeldung
Softwaretest
Soundverarbeitung
Maschinencode
Güte der Anpassung
Verzweigendes Programm
Magnetkarte
Systemaufruf
Ausnahmebehandlung
Schlussregel
Mailing-Liste
Kombinatorische Gruppentheorie
Objekt <Kategorie>
Patch <Software>
Mustersprache
Stichprobenumfang
Delisches Problem
Fehlermeldung
Softwaretest
Videospiel
Klasse <Mathematik>
Information
Fehlermeldung
Resultante
Bit
Punkt
Formale Sprache
Annulator
Schreiben <Datenverarbeitung>
Netzwerktopologie
Client
Mehrrechnersystem
Einheit <Mathematik>
Fahne <Mathematik>
Figurierte Zahl
Softwaretest
Lineares Funktional
Schießverfahren
Kategorie <Mathematik>
Datenhaltung
Abfrage
Systemaufruf
Ausnahmebehandlung
Quellcode
Zeitzone
Entscheidungstheorie
Dienst <Informatik>
Datenfeld
Forcing
Rechter Winkel
Strategisches Spiel
Garbentheorie
Ordnung <Mathematik>
Fehlermeldung
Instantiierung
Aggregatzustand
Geschwindigkeit
Maschinencode
Mathematisierung
Klasse <Mathematik>
Gefrieren
Implementierung
Zahlenbereich
Mathematische Logik
Framework <Informatik>
Abenteuerspiel
Informationsmodellierung
Bildschirmmaske
Stichprobenumfang
Programmbibliothek
Zeiger <Informatik>
Speicher <Informatik>
Softwareentwickler
Videospiel
Wald <Graphentheorie>
Programmverifikation
Kanalkapazität
Elektronische Publikation
Quick-Sort
Integral
Generizität
Schlussfolgern
Flächeninhalt
Last
Mereologie
Wort <Informatik>

Metadaten

Formale Metadaten

Titel Intro to Mocking: Why unit testing doesn't have to be so hard
Serientitel DjangoCon US 2015
Teil 29
Anzahl der Teile 46
Autor Davis, Daniel
Mitwirkende Confreaks, LLC
Lizenz CC-Namensnennung 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen 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.
DOI 10.5446/32772
Herausgeber DjangoCon US
Erscheinungsjahr 2015
Sprache Englisch

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract Many developers want to write better code, but simply don't know how to write units tests for: Code that calls other code (i.e. code with dependencies) Methods that have no return value Code that throws exceptions Mocking provides a valuable tool for solving these problems. In this talk, we'll discuss the scenarios in which Mocking is useful, the strategies for addressing each of the cases above and write simple, clean unit tests using the built-in Mock library.

Ähnliche Filme

Loading...