Check yourself – writing integration tests

Try answering the following questions to check about integration tests yourself:

  1. Which integration tests do you write first?

    Answer: The ones in the smallest circles, especially if they don't have any lines pointing from themselves to other circles. Put another way, write the most independent tests first.

  2. What happens when you have a large chunk of integrated code, but the next section you need to pull in doesn't have any integration tests at all?

    Answer: Start from the smallest circles involving that code, and build up step-by-step until you're ready to integrate it with your earlier code.

  3. What's the point of writing tests that check the integration of a chunk of code with itself?

    Answer: When we were doing unit testing, even other instances of the same class were mocked, as were other methods of the same instance when it was reasonable to do so; we were concerned that this code did what it was supposed to, without involving anything else. Now that we're doing integration testing, we need to test the instances of the same class that interact correctly with each other, or with themselves when they're allowed to retain a state from one operation to the next. The two kinds of tests cover different things, so it makes sense that we would need both.

  4. What is a system test and how do system tests relate to integration tests?

    Answer: A system test is the final stage of integration testing. It's a test that involves the whole code base.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.170.223