Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Tomek Kaczanowski - Practical Unit Testing with JUnit and Mockito - 2013.pdf
Скачиваний:
224
Добавлен:
07.03.2016
Размер:
6.59 Mб
Скачать

Chapter 1. On Tests and Tools

This introductory chapter presents the main categories of test. It will enable us to understand the role of each of them, and also to see the place and purpose of unit tests.

Naming Chaos

If you start digging into the topic of tests, you will be amazed at how many names show up. Unit tests, integration tests, smoke tests, stress tests, end-to-end tests, exploratory tests, system tests, performance tests, user tests, automated tests, acceptance tests, etc. You may well feel perplexed by the sheer number of them, and by the variety of existing classifications. You will get even more perplexed if you start looking for a definition for each of them. Soon you will come across a good few definitions of the same term that differ substantially1. This terminological chaos makes testing subjects much harder to follow than they should be.

In this book I follow what I regard as being the most widely used set of test-related terms. I think, that the chosen names describe their purpose well. I can only hope that they do so for you too.

1.1. An Object-Oriented System

We will right away discuss three kinds of tests that are essential for developers: unit tests (which are the main topic of this book), integration tests and end-to-end tests. Because the object-oriented (OO) programming paradigm2 is dominant in the Java world, we will learn what role each of these tests plays in the testing of an OO system. Figure 1.1 presents a very simple abstraction of such a system. (We will get on to the meaning of "workers" and "managers" very soon.)

Figure 1.1. An OO system abstraction

Yes, that is it! A bunch of circles and arrows. Circles are objects, arrows are messages being passed between them. As you can see, we also have a client in this picture, and his action (his request) has initiated a great deal of activity in our OO system. Why so many objects, and so many messages, out

1Alas, even though some terms seem to have a well-established meaning, they still often get to be misused. 2See http://en.wikipedia.org/wiki/Object-oriented_programming for more information.

2

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]