> For the complete documentation index, see [llms.txt](https://docs.nujan.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nujan.io/2.-getting-started-with-ide/2.7-unit-testing.md).

# 2.7 Unit Testing

Unit testing is a systematic and automated validation approach aimed at verifying the accuracy and dependability of discrete components or units within a smart contract. By crafting specialized test cases, developers can isolate these individual units and meticulously assess their behavior under controlled input scenarios. This rigorous and well-structured testing process aids in early defect detection, promotes code modularity, and fosters the creation of a robust and secure blockchain application, all while seamlessly integrating with continuous integration and deployment practices.  

**Where to Write Test Cases and Run Tests:**

**Step 1:** Write unit tests in “.spec.ts”  extension files.

<figure><img src="https://2267424779-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxT0ysqQIv3R1A632By8%2Fuploads%2FzccAZQT6tPDWZ2D9jR3j%2F15-1%60.png?alt=media&amp;token=e1a46505-db77-449c-8047-1cbdc76b2313" alt="" width="556"><figcaption></figcaption></figure>

**Step 2 :** Go to “Unit Test” from the   Icon Panel

<figure><img src="https://2267424779-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxT0ysqQIv3R1A632By8%2Fuploads%2F3TTHeaLmClb0VwLSUVBO%2F15-2.png?alt=media&amp;token=c20218dd-50d5-4491-85ff-7a0754561109" alt="" width="556"><figcaption></figcaption></figure>

**Step 3 :** Click on Run to Execute   Test cases and ensure   Complaince

<figure><img src="https://2267424779-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxT0ysqQIv3R1A632By8%2Fuploads%2Ff3Gbm8PFU8R808D5k4GL%2F15-3.png?alt=media&amp;token=2e2f5fa3-cd96-4cd9-affa-333f1f15f6aa" alt="" width="556"><figcaption></figcaption></figure>
