Unit testing is a method that tests small parts of code in order to determine if they are fit for use
Unit is the smallest testable part of an application
No dependency between tests cases
Enables Well defined inputs, outputs and behavior
Characteristics of A good unit test
- Runs fast- If the tests run time is long, they will not run often
- Separates or simulates limited environmental dependencies
- Test one thing at a time
- Tests run in any machine
- Clear and Understandable to others
Benefits from using Unit Tests
- Unit testing enables refactoring with Safety measures
- Unit testing acts as a living documentation of the system
- Unit tests helps reduce effort on integration tests
Test Driven Development
- Tests are written to define the functionality before the code is written
- Tests are considered to be more reliable because the code coverage is better, and it runs constantly during development
- The developer discovers defects immediately upon making a change
Benefits of Automated testing
- Automated Software Testing Saves Time-Every time source code is modified software tests should be repeated, Once created, automated tests can be run over and over again at no additional cost.
- Automated Software Testing Improves Accuracy- Every man makes mistakes during testing.
- Automated Software Testing Increases Test Coverage- Automated testing increase the depth and scope of tests.
- Automated Software Testing Helps Developers and Testers- Shared automated tests can be used by developers to catch problems quickly before going live.