There are many different types of testing, and unfortunately, there isn’t a clean line between the different definitions. Often, on forums like StackOverflow, there are questions asking something like, “What makes a test a unit test vs integration test?”

The short answer to these questions is usually, “Well, it depends on where exactly you draw the line between different types of testing.” The important thing is that within your team or organization, you have a clear definition that avoids any potential confusion or conflict.

With that said, here are the characteristics that generally describe different types of testing:

Unit Testing

This is testing the smallest testable part of the code base. In Java, you could consider a standalone method within a class as a unit, or you could consider the class itself as the unit. There certainly should not be any interaction with services outside of the product (e.g. Databases, Kafka, Web Servers). These would typically be stubbed or mocked.

Unit tests often have a huge overlap with component testing.

Component Testing

This is testing a single component of the solution. Typically, in Java, a module would be considered a component. The focus is on whether the component delivers the required functionality for the rest of the solution. It should not rely on other modules, as these would typically be mocked or stubbed.

Integration Testing

Testing the interaction between two or more components in the product. One of the key parts of an integration test is that it is testing, or relying on, the actual behavior of an interface between two components. Essentially, unlike component or unit testing, a change in either component can cause the test to fail.

End-to-end Testing

This is testing the entire solution as the user is expected to use the system. The testing should be done via the user interface. This will most likely involve the use of specific automation tools, such as Selenium, for interacting with a Web UI. 

Acceptance Testing

Typically used by a client or a stakeholder, acceptance testing is a set of tests that prove the product is suitable for its intended use. Acceptance tests are often also end-to-end tests, but with the specific purpose of preventing the release or handover of a solution if they fail.

Check out our Definitive Guide to Unit Testing: