This series of articles is a compilation of the notes I gathered during my programming bootcamp at Green Fox Academy, last year.
You can read the other articles here:
Why should you write tests to your software?
1. Software testing saves money
2. Security
3. Product quality
4. Customer satisfaction
There are different types of tests:

Unit Test
Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. Unit testing involves only those characteristics that are vital to the performance of the unit under test.
Integration Test
Integration testing is a level of software testing where individual units are combined and tested as a group. The purpose of this level of testing is to expose faults in the interaction between integrated units. Test drivers and test stubs are used to assist in Integration Testing.
System Test
System testing is a level of software testing where a complete and integrated software is tested. The purpose of this test is to evaluate the system’s compliance with the specified requirements.
Acceptance Testing
Acceptance testing is a level of software testing where a system is tested for acceptability. The purpose of this test is to evaluate the system’s compliance with the business requirements and assess whether it is acceptable for delivery.
End to end Test
End-to-end testing is a methodology used to test whether the flow of an application is performing as designed from start to finish. The purpose of carrying out end-to-end tests is to identify system dependencies and to ensure that the right information is passed between various system components.
For example, a simplified end-to-end testing of an email application might involve:
· Logging in to the application
· Accessing the inbox
· Opening and closing the mailbox
· Composing, forwarding or replying to email
· Checking the sent items
· Logging out of the application
Assertions
An assertion is a boolean expression at a specific point in a program which will be true unless there is a bug in the program. A test assertion is defined as an expression, which encapsulates some testable logic specified about a target under test.
Benefits of Assertions:
· Used to detect subtle errors which might go unnoticed
· Used to detect errors sooner after they occur
· Make a statement about the effects of the code that is guaranteed to be true
Types of assertions
assertTrue
assertFalse
assertNull
assertNotNull
assertEqual
assertNotEqual
assertIdentical
assertNotIdentical
Mocking
Mocking is creating an object that mimics the behavior of another object. It’s a strategy for isolating an object to test it and verify its behavior.
Spock — a Java testing framework capable of handling the full life cycle of a computer program.
Stub — it simulates specific behavior
Mock — it stands in for a real object, providing no-op answers for all method calls
Spy — always wraps a real object and by default routes all method calls to the original object, also passing through the original results
