Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Working Effectively with Unit TestsJay Fields

    Working Effectively with Unit Tests

    Jay Fields · 2016

    Software Engineering
    Open LibraryAmazon
    Stats for nerds
    3recommend
    3mentions
    3people
    2017–2020years
    100% recommend

    Mentions per year

    2017201820192020

    What Hacker News says

    1. waheooNov 2020
      I tend to disagree but this might be my biases at play.

      Refactoring starts from first principles, almost all examples include the reverse refactoring as often you need to undo optimisations a few steps before you can move forward in a different direction.

      I was recommended working effectively with legacy code by the same types of managers that expect forever returns off the same code. They like to point out how that book encourages small patching without refactoring as refactoring is often fruitless in short term money terms, whereas Fowler tends to advocate refactoring as a healthy and necessery part of software development.

      I can't say I hated working effectively. I found TDD by Beck more useful, and working effectively with unit tests to also be worthwhile.

      All of these books cover a lot of similar ground.

      If you're going to read only one or two I suggest TDD > refactoring and avoiding the others.

      (Just my opinion based on what I got out of them reading after 10 years on the job, I suspect juniors might have a different take)

      thread
    2. JCzynskiJun 2017
      Working Effectively With Unit Tests is quite useful. It's focused on Java but the advice given applies well beyond that.
      thread
    3. karmajunkieApr 2017
      Working Effectively with Unit Tests by Jay Fields[1] is a great book on the subject. There's tons of books out there that are also good, but this is one I like to recommend as a starting point.

      Another thing I'll do a lot of times when I'm trying to figure out how to test a weird situation is try to think of another API that works similarly and look to see if it has any tests that are instructive. And I habitually go through OSS projects I use to look at their tests and see what techniques I might not know about. This is really useful when you're picking up a new language or paradigm (e.g. when I started using functional languages over the OO languages I was used to.)

      The basic thing you need to remember about testing is the AAA approach[2]: Arrange (setup); Act(do the thing you're testing); Assert (measure the outcome to make sure it is what you were expecting). Just about everything you read on testing at a lower level is going to come down to that procedure. There's additional techniques like fuzz testing and property testing, but they're not common. At a junior level I'd just expect you to have a basic understanding of AAA and how to apply it to common situations with the toolkit of your choice (e.g. for a javascript dev, maybe jest).

      When you think about it, you already test your software, as you write it—its just that instead of writing down the steps in a way that your test framework can use, you're doing it manually. So really you just need to learn how to write down what you're doing in the browser (or whatever your interface is). Further refinement of that process is to use break your software up into pieces that can be more easily tested on their own.

      I really just meant to post the first link, but testing is one of those areas that's near and dear to my heart, so my apologies for the rambling :)

      [1] https://www.amazon.com/Working-Effectively-Unit-Tests-Fields...

      [2] http://wiki.c2.com/?ArrangeActAssert

      thread

    Related

    Cover of The art of unit testing
    2012–2026

    The art of unit testing

    Roy Osherove
    12 recommend · 18
    Unit TestingVladimir Khorikov
    2021–2024

    Unit Testing

    Vladimir Khorikov
    3 recommend · 8
    Cover of Growing object-oriented software, guided by tests
    2010–2026

    Growing object-oriented software, guided by tests

    Steve Freeman
    43 recommend · 64
    Cover of Debugging
    2009–2026

    Debugging

    David J. Agans
    17 recommend · 22
    Cover of Effective Software Testing
    2022–2023

    Effective Software Testing

    Mauricio Aniche
    2 recommend · 2
    Cover of Test-driven development
    2007–2026

    Test-driven development

    Kent Beck
    30 recommend · 62
    Cover of Designing Data-Intensive Applications
    2014–2026

    Designing Data-Intensive Applications

    Martin Kleppmann
    457 recommend · 846
    Cover of The art of software testing
    2008–2026

    The art of software testing

    Glenford J. Myers
    6 recommend · 14