> For the complete documentation index, see [llms.txt](https://notes.nomanaziz.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.nomanaziz.me/development/testing/test-driven-development-tdd.md).

# Test Driven Development (TDD)

<figure><img src="/files/Z6M3C7tFihwrnHUSIAfa" alt=""><figcaption></figcaption></figure>

### Common Testing Mantra

#### 1. Red

We write a failing test first

#### 2. Green

We write some code to get it passing

#### 3. Refactor

Then we go back and optimize or refactor the code

***

### Types of Testing

1. Functional Testing
   1. Unit Testing
      * Validate behaviour of individual functions, methods or units of code
   2. Integration Testing
      * Testing multiple units of code together
   3. End to End Testing
      * Run our app in a simulated environment and emulate actual user behaviour
   4. Acceptance Testing
      * Make sure that software meets all of clients requirements
   5. System Testing
      * Make sure everything works on actual server or hardware
   6. Smoke/Sanity Testing
      \*

      ```
      <figure><img src="/files/9ucdaLDGDJk8GUwqt3Oj" alt=""><figcaption></figcaption></figure>
      ```

      * On large scale app, it takes time to run all the tests, smoke test runs few of the important tests first to make sure app is not crashing before running all of other test suite
2. Non Functional Testing
   * Tests for Performance, Usability and Security.
   * Stress / Failover Testing

***
