RubyConf 2014

Introducción a los "espías" de RSpec

Sam Phippen  · 

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

hi everyone thanks for coming this is my talk entitled an introduction to spies in r-spec and i think we'll get started so I'm Samphan I'm Sam flipping on Twitter and Samm flipping on github you can have a look at my various profiles on those sites

if you want to and if you do have a look at my github profile you'll probably notice that I spend most of my time on github working as a member of the r-spec core team and that's sort of why I'm here giving this talk today because to me it's

really important that our spec is sort of represented in community events like this and also that we give introductions to beginners that enable them to more powerfully and quickly use the testing framework so I hope that everyone goes away having learned

something about our spec today I work for a company called fun and plausible solutions we're sort of consulting agency for data science problems which means that we tend to work with companies that know how to build really great web and mobile applications

but don't necessarily know how to do things like machine learning or recommender systems or a be testing and things of this ilk and if you're trying to do those in your own work and you're struggling for whatever reason please do come and have

a chat with me after we're done because I love talking about this stuff um so I wanted to sort of preface this talk by saying that my sort of conceit for this talk is not for me to drop some grand position on software engineering or present my ideas for

what we should be doing ten years down the line but instead sort of present an interesting slice of facts about testing and how our spec works and I'd much rather everyone in the room learn something then I get to the end of my talk so if I say something

that you find confusing or you'd like me to expand upon I would ask you to interrupt me and ask a question because more likely than not if you have a question about something someone else in the room will as well so this talk is really about testing and

how we actually go about testing our software in Ruby and the tools that we use to do it and one thing that I find amazing when I work with people that use different programming languages like I work with a lot of people do Python and Java and build apps for

iOS and Android is that the Ruby community is the community that has just embraced testing they've really sort of engulfed it and accepted it into their everyday practice and that's not the case with many of the other programming languages and communities

and to me it's amazing that we do as much testing as we do even at the beginner level because even if those tests aren't perfect even if for whatever reason they have problems it still means that I can walk up to someone's app that I've never

seen before and begin confidently making changes without having to worry about what's going to happen as I do those changes and I'm going to break something and I wanted to sort of provide my thoughts on why writing tests why actually building automated

testing for software is a really useful thing to do or at least one perspective that you could take and to me this is really to do with mental models of how we write our software so in the beginning when you're working on an application I would argue that

it's entirely possible for you to hold nearly everything that your software is doing in your brain and that means that it's really easy for you to make changes with confidence and adapt to the software that you're writing but as time goes on and

our product managers and our users come to us with feature requests or bug reports and you know make changes and grow our software that becomes more and more complex and our software begins to get sort of bent out of shape and it becomes very difficult to

hold everything that your software is doing in your brain and to me this is where the tests come in they literally allow us to serialize knowledge about our application into an executable form I think this is one of the things that I often see beginners struggle

with is actually a good impetus for why writing tests is useful they understand sort of behavior verification and so on but that doesn't seem to be a long-term goal once you've got the behavior written that's it right well yes and no and i think

the just sort of test suites soaking up knowledge is really useful to have in the applications that we write and i think that that knowledge is it grows over time allows your team to expand and allows you to continue to work with your software it's also

true that when you're writing tests alongside software together so growing your software in your tests at the same time you're able to find bugs in new features as you're developing though and what that means is that you can build your feature

and deliver it knowing that more likely than not it's going to work when it's integrated with all of the others and also that all those bugs that you encountered whilst you are developing your software are less likely to actually be present ever again

in the future if you just refresh a web browser every time you make a change the software that you're writing it's more likely that those things are going to come back and perhaps more than this when a bug in our software does make it all the way from

us through our managers through our QA and all the way out to our users if you write a test that demonstrates that bug and fails when that bug is present and then you implement the fix to your software that allows you to actually verify that the bug is gone

you can be pretty certain that that bug is never going to come back and I think that that's a really useful property to have when writing software it's also true that we can write tests that actually help us improve the design of the software that

[ ... ]

Nota: se han omitido las otras 2.914 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.