< prev 11 Dec 2014 to 22 Nov 2014 next >

Posts tagged 'testing'

  • Week 5 Day 1 - Making my peace

    Today's partner: Ben

    The project today was sort of forgettable, like the last couple days. It's been good to get so much practice with Rails, and today was fun - we used Capybara to write integration tests, then wrote code to build the appropriate elements and views to pass those tests, learning a lot about how Capybara and integration testing work in general - but it was another one of those days where ultimately I'll forget what, specifically, we did.

    Everything is just forming into a big ball of stuff in my head called "rails knowledge". It's kind of cool in one way, but in another: we're halfway through the curriculum, and a lot of it is a blur.

    Story time. When I was in AP Calculus, I had a hard time keeping up with the class, but the AP test was a solid wall in front of me that was a) well-defined, b) had plenty of information available and c) had important consequences. So, the week leading up to the test, I gathered as much practice material I could, and then in the two nights before the test, I cherry-picked the problems I was having the most trouble with and did them over and over until I could do them easily.

    The repetition drove the ideas into my memory, and to this day I can understand the concepts of calculus due largely to the intentional practice with a clear goal provided by that exam.

    In the past year or so, I've come to understand that my primary advantage compared to others is my memory. When I have sufficient context and sufficient reason, I can remember just about anything quickly. When I don't have reason, context, or practice, I'm just an average person, sort of.

    So with this rails stuff, I spent most of last night—the parts where I wasn't doing readings or tumblr posts or whatever—doing parts of the practice assessment, and came in this morning ready to graft more knowledge onto what I had been getting comfortable with. We were still slower than others today, but the difference is I didn't really care. We worked well together, our tests worked well, we wrote the auth model in under an hour (give or take), and we got a lot of knowledge, both core and ancillary, out of the lesson.

    Sure, I can look at the bonus work and look into "completing" this project perhaps over the weekend, but really what will I gain? If I am able to do the things that these projects ask in a more synthetic context - creating polymorphic associations, writing tests with good coverage, etc - then what am I really missing? It would be like going back to try to re-do the test you failed in the third grade… of course you'll be able to pass it now.

    This program, and TDD in general, really make me consider some things about how we educate in this country. You don't generally test every possible route through your application; instead, you perform unit tests on individual models, then you perform integration tests on inter-related structures. The former model would involve something like n^m tests, whereas the latter demands n+m tests - where n is the number of "objects" and m is the number of "relations".

    When educating, you don't need to test to see if someone knows how to multiply on a boat, how to multiply with a goat, how to multiply nine digit numbers and ten digit numbers and eleven digit numbers… you need to see if they know how to multiply digits, then to perform carry rules, then to do more complex operations… perhaps curricula should involve unit and integration testing, like TDD. It certainly feels like a/A is doing this with us.

    Tomorrow's another solo day, but more importantly it's the day of the assessment. I plan on doing it at least once end-to-end, and maybe focusing in on re-doing a couple hotspots before 9 am, but I'm feeling remarkably comfortable with myself at the moment. Let's see if it lasts.

    Two more days until the weekend, and more studying. :)

  • Week 2 Day 5 - Who Tests the Testmakers?

    Today's partner: Ron

    All the coffee in the world could barely get me through this week. It was fine, in the end; there's been a much more relaxed feeling on the two Fridays we've had so far. (We're 16% through the program already. What the hell.)

    Most of the day was about rspec, the main ruby testing framework. It's actually a really nice language: a language for pedantic testing, by pedantic testers. Tommy joked/not joking that they re-write major portions of the syntax every 3-4 months, and I can totally believe it. When you're as steeped in the mindset of testing software as they have to be, your inclination has got to be to make your domain-specific language as polished as you can.

    I do wonder what their internal unit tests look like, though.

    Other than endless coffee and jokes about writing a test that you yourself are going to be taking, the day/language were interesting. I really like the rspec syntax; once you get used to the grammar, it's actually quite clear to read. It took a mere two hours last night to be able to figure out all I needed to understand to complete the practice assessment. As hard as it was, I got the impression that I understood a bit more this morning than a lot of the other students, so maybe I'm primed to be thinking in the way that the rspec designers do.

    We skipped through the practice exercises, basically doing just enough coverage to make sure we were getting the point. We could tell how much clearer it makes problem solving: break something down into discrete parts, then figure out where those parts should live and how they should interact, and 90% of the hardest work is behind you. I really look forward to using the TDD methodology on a more robust project; it's quite clear that, like so many other student projects, the power of the tool we learned today far exceeds the significance of the work we were doing. It's basically like using a sledgehammer to drive a nail into drywall.

    A couple things I put together today:

    • No one I've worked with or talked to so far has nearly the level of paranoia about breaking things that I do. I think Bruce Schneier is right that the security mindset is probably something you mostly can't train.

    • As I've mentioned, this also makes me a bit overcautious. It might behoove me to look for employers than want careful, deliberate work done, or to force myself to make fast, dumb code, and refactor much faster than I do.

    • All of a sudden today, I understood what all the comments that I've read about "unit tests" and "integration tests" meant. There was a total "aha" moment when we were talking about mocks where I was like, duh, of course that's a thing, and now the difference between these other things makes perfect sense. Maybe I hadn't thought about it before?

    • It's ridiculously easy to write code when you are writing tests alongside.

    • There's a bit of weirdness to crashing your testing framework because of a syntax error. "Okay, which one crashed, and why? Oh, we messed up that syntax, lololol"

    • It's so much cheaper to make coffee at work, EVEN if you're making coffee for everyone else, too. If I leave the money in the can, I've still come out ahead.

< prev 11 Dec 2014 to 22 Nov 2014 next >