Previously, I talked a little bit about testing, but now I will give you an overview. There are many kinds of tests, such as:
Are tests that check the application behavior (features, business rules, etc.) and they are:
Are tests that verify attributes of a system component that does not relate to the feature (reliability, efficiency, usability, maintainability, and portability).
Overview: Functional Tests
- It’s intended to test the smallest testable part of the system, usually a method.
- Don’t use database, but can have mocks¹.
¹ – Mocks: are “fake” objects that simulate the behavior of a class or real object.
- It’s intended to test the interaction between software components, usually two pieces of software. It’s the process of verifying that the system components, together, work as expected.
- Can use database and mocks.
- Usually test the integration between classes, WebServices calls (usually with mocks), among other things.
- It’s intended to ensure that the system works as a whole. If the integration testing tests database access, webservices calls, etc. individually, the system testing tests the system as a whole.
- They are commonly called black-box testing, because the system is tested with all connected and on: database, Web services, batch jobs, and etc.
- Using the example of a Web application, system tests would be responsible for making the steps that a user could do, so a system test could open a browser, login on the application and check if everything was successful, just as you can check how the application screen reacts if you type an invalid data.
- It aims to verify that it was implemented correctly compared to what the customer expected, or validate the system according to the customer’s point of view. Typically, this is done through system testing.
- The ideal model of tests would be:
- Unit tests testing practically all application methods.
- Integration tests testing only the small integrations parts.
- System tests (and acceptance) testing the system in general.
So, there would be more unit tests than integration tests, and more integration tests than system tests, that, in the pyramid of TDD would be:
Overview: Non-Functional Tests
They are divided into many types, but here are the main or most used:
- It aims to test the system by simulating multiple users accessing at the same time to see how the system behaves and handles it. It’s directly associated with the next two tests.
- It aims to test speed: response time. May be on conditions which would be close to real to verify system performance.
- It aims to test the application limits. The idea is to overload the system with many users to see how far the system can go until it breaks and how (and if) it recovers.
- In Java, tools for functional testing often used: JUnit, used with Selenium (for system testing) and the use of Mockito for creating and using Mocks.
- For non-functional tests, language independent, the best known is JMeter but have others as httperf (for performance tests) and locust (for all types).