# Test Driven Development (TDD)

<figure><img src="https://1920086362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfv51K0WXLZdwTryHQZc%2Fuploads%2FeyU0BLS6fgfXeDAZrUx6%2Fimage.png?alt=media&#x26;token=55e1dfcf-f109-47cf-9161-fcbacfe35db1" 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="https://1920086362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfv51K0WXLZdwTryHQZc%2Fuploads%2Fy8llcdTKZrqJgpxssfHz%2Fimage.png?alt=media&#x26;token=4d5a83c3-da5e-4159-b343-8882687802e1" 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

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.nomanaziz.me/development/testing/test-driven-development-tdd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
