7 months ago
Wed Sep 11, 2024 9:20am PST
Ask HN: Being Concrete in Tests
I remember reading in a book that in tests, you generally want to be concrete, not abstract. For example, you'd like to do:

    assert(response.status == 401)
    assert(error == "param 'foo' is invalid")
    
instead of:

    assert(response.status == Http.StatusUnauthorized)
    assert(error == HttpError.InvalidParameter("foo"))
Can anyone point me to resources (books, posts, tweets, whatever) that better illustrate this and justify it?
comments:
add comment
loading comments...