Skip to main content

Introduction

Automock optimizes the unit testing process within dependency injection frameworks by providing a virtual, isolated environment and automated mock generation, enabling developers to create efficient test suites and enhance their overall testing experience.

🚀 Zero-Setup Mocking

-

Dive straight into testing without the hassle. Automatically generate mock objects, eliminate manual setup and reduce boilerplate code.

🔍 Type-Safe Mocks

-

Leverage TypeScript's power with mocks that retain the same type information as real objects. Write tests with confidence, knowing that type mismatches will be caught.

⚡ Optimized Performance

-

By bypassing the DI container load, Automock's design ensures your unit tests run significantly faster. This lets you focus on development without unnecessary waits.

📄 Consistent Tests Structure

-

Achieve a uniform approach to unit testing. Test suites will follow a consistent syntax and structure, making them easier to read and maintain.

🌐 Community & Support

-

Join a growing community of developers. Regular updates, comprehensive documentation, and responsive support to ensure you get the most out of Automock.

Automock and Unit Testing

Software development essentials like unit testing are sometimes disputed, especially when it comes to what is and isn't unit testing. Unit testing within the framework of Automock is consistent with the idea of "Solitary Unit Tests," a term that was coined by Jay Fields and found in writings by Martin Fowler. In order to maintain code integrity, solitary tests place a strong emphasis on isolating each unit during testing and ensuring independent validation of code behavior.

In particular, Automock streamlines the unit testing process by automating the creation of mock objects, thereby addressing the challenges associated with it. Important advantages of Automock for unit testing consist of:

  • Automatic creation of mock objects for class dependencies, which drastically cuts down on setup time and complexity.

  • Make test suites more consistent and manageable by enforcing standard syntax across frameworks.

  • Uses virtual DI containers to expedite the testing process, which is important in Continuous Integration (CI) pipelines because tests should run quickly enough to not deter repeated execution.

Embracing a Spectrum of Testing and DI Frameworks

Automock works with a variety of testing and DI frameworks. It currently supports Jest and Sinon, with adapters for NestJS, InversifyJS, and TSyringe in the works. The goal is to provide a standardized testing experience across frameworks and testing libraries.

DI Framework AdapterJest (@automock/jest)Sinon (@automock/sinon)
NestJS Adapter (@automock/adapters.nestjs)
Inversify Adapter (@automock/adapters.inversify)✅ (Beta)✅ (Beta)
TSyringe Adapter (@automock/adapters.tsyringe)SoonSoon
info

Automock is a community-driven project, and we're always looking to expand our horizons and provide support for a wider range of Dependency Injection frameworks. If you're interested in contributing to Automock's adapters, see the contributing section for more details.