# Slow unit tests: objects mocking

DevFeed: [Slow unit tests: objects mocking](<https://devfeed.tech/articles/slow-unit-tests-objects-mocking-26139.md>)

Original publisher: [Read original article](<https://vadzimv.dev/2022/06/03/slow-unit-tests-part-1-objects-mocking.html>)

Author: Vadzimv Dev Blog

Published: 2022-06-03T09:00:00Z

Content type: article

Language: en

Sources: [vadzimv Dev Blog](<https://devfeed.tech/sources/vadzimv-dev-blog.md>)

Topics: [Mocking](<https://devfeed.tech/topics/mocking.md>), [unit test](<https://devfeed.tech/topics/unit-test.md>)

Tags: [junit](<https://devfeed.tech/tags/junit.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

## AI overview

This article measures factors that affect unit-test execution time, focusing on object mocking. It compares a baseline with real objects, manually written test doubles, and mocking libraries such as Mockito and Mockk. In the reported measurements, Mockito significantly increased execution time when creating the first mock, while repeated mocks and behavior verification had little additional cost.

## Source excerpt

What does make unit tests slow? Is it objects mocking?