2.10.1.1 Types of Testing
Python Programming
- Unit Testing: Tests individual parts of the code (like functions or classes) in isolation. Python's unittest module is commonly used for this.
- Integration Testing: Checks how different parts of the code work together.
- Functional Testing: Validates that the software behaves as expected from the user's perspective.
- Regression Testing: Ensures that new changes don't break existing functionality. Example: In this example, we use the unittest module to test the add function. This ensures that the function returns the correct results by checking various input values.
python
import unittest
def add (a , b) :
return a + b
class TestMathOperations(unittest.TestCase):
def test_add(self