I’m Done With Unit and Integration Tests

I've been writing developer tests for a very long time. Lately, I've been reflecting on the types of tests I write and why some are easier than others. When teaching and coaching others how to write tests, I almost always explain what I mean by "Unit Tests" and "Integration Tests": Unit Tests don't touch hardware, don't do I/O, etc. (This should sound familiar to some of you, as it's the same idea as the set of unit testing rules by Michael Feathers written in 2005), and test against a single object or group of objects (I use the terms Sociable and Solitary to differentiate between the different kinds of "unit" tests, as defined by Jay Fields). I'd then demonstrate what I meant like this:

Java
 
@Test
public void fullDeckHas52Cards() {
    Deck deck = new Deck();

    assertThat(deck.size())
            .isEqualTo(52);
}

@Test
public void drawCardFromDeckReducesDeckSizeByOne() {
    Deck deck = new Deck();

    deck.draw();

    assertThat(deck.size())
            .isEqualTo(51);
}


Collective #656









Web Browser Engineering

In this book Pavel Panchekha and Chris Harrelson explain how to build a basic but complete web browser, from networking to JavaScript, in a thousand lines of Python.

Check it out


An accessible toggle

Kitty Giraudel shares a HTML + CSS only implementation of an accessible toggle that you can copy in your own projects and tweak at your own convenience.

Read it












Deletion Day

Although it’s from April 4th, there’s lots of valuable information here: Deletion Day challenges the prevailing notion that “more is more”. In a culture that strives for permanence, we celebrate ephemerality, growth, and change.

Check it out



The post Collective #656 appeared first on Codrops.