# \#mocks

**URL:** https://forum.elixirforum.com/tag/mocks/1302.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Repatch - Everything you need for mocking and patching](https://forum.elixirforum.com/t/repatch-everything-you-need-for-mocking-and-patching/66937)

<div class="topic-metadata">

**Author:** [@Asd](https://forum.elixirforum.com/u/Asd)\
**Replies:** 18\
**Last updated:** [June 11, 2026, 7:25pm UTC](https://forum.elixirforum.com/t/repatch-everything-you-need-for-mocking-and-patching/66937 "2026-06-11T19:25:05Z")

</div>

Hi, I am happy to release the Repatch library for mocking and patching implementation in tests and anywhere else. It brings new possibilities which make it possible to make literally any test async. You can install it a…

---

## [Mocks Are Your Friends, Not Your Servants](https://forum.elixirforum.com/t/mocks-are-your-friends-not-your-servants/75400)

<div class="topic-metadata">

**Author:** [@mudasobwa](https://forum.elixirforum.com/u/mudasobwa)\
**Replies:** 2\
**Last updated:** [May 18, 2026, 7:49am UTC](https://forum.elixirforum.com/t/mocks-are-your-friends-not-your-servants/75400 "2026-05-18T07:49:29Z")

</div>

Łukasz wrote a great article, 'guiding not ruling’ the way of writing tests. I agree with everything, short of his attitude to mocks. The furter discussion revealed that we treat mocks in an absolutely different manner. …

---

## [Beyond Mocks Messing with Our Preconceptions of Testing](https://forum.elixirforum.com/t/beyond-mocks-messing-with-our-preconceptions-of-testing/71256)

<div class="topic-metadata">

**Author:** [@ElixirConf](https://forum.elixirforum.com/u/ElixirConf)\
**Replies:** 0\
**Last updated:** [June 12, 2025, 1:00pm UTC](https://forum.elixirforum.com/t/beyond-mocks-messing-with-our-preconceptions-of-testing/71256 "2025-06-12T13:00:03Z")

</div>

Beyond Mocks Messing with Our Preconceptions of Testing Comments welcome! View the elixirconf tag for more ElixirConf talks!

---

## [Cannot mock Process module with Mock.with\_mocks macro](https://forum.elixirforum.com/t/cannot-mock-process-module-with-mock-with-mocks-macro/56737)

<div class="topic-metadata">

**Author:** [@noelHan](https://forum.elixirforum.com/u/noelHan)\
**Replies:** 12\
**Last updated:** [June 30, 2023, 7:28am UTC](https://forum.elixirforum.com/t/cannot-mock-process-module-with-mock-with-mocks-macro/56737 "2023-06-30T07:28:12Z")

</div>

I try mock library for my tests. But I cannot mock function with it This is my test code test "test" do with\_mock Process, send\_after: fn \_, \_, \_ -\> :ok end do assert Process.send\_after(self(), :message, 5\_000) …

---

## [EXQ Mocking for testing fails](https://forum.elixirforum.com/t/exq-mocking-for-testing-fails/50887)

<div class="topic-metadata">

**Author:** [@Sumitforyou](https://forum.elixirforum.com/u/Sumitforyou)\
**Replies:** 1\
**Last updated:** [October 10, 2022, 1:52pm UTC](https://forum.elixirforum.com/t/exq-mocking-for-testing-fails/50887 "2022-10-10T13:52:12Z")

</div>

Using Exq as below test.exs config :exq, name: Exq.Mock, # adapter: Exq.Mock, queue\_adapter: Exq.Adapters.Queue.Mock, start\_on\_application: false test\_helper.exs Exq.Mock.start\_link(mode: :fake) MyApp Exq.e…

---

## [Promox - Protocol-based mocks](https://forum.elixirforum.com/t/promox-protocol-based-mocks/41100)

<div class="topic-metadata">

**Author:** [@dsdshcym](https://forum.elixirforum.com/u/dsdshcym)\
**Replies:** 2\
**Last updated:** [July 18, 2021, 3:07pm UTC](https://forum.elixirforum.com/t/promox-protocol-based-mocks/41100 "2021-07-18T15:07:13Z")

</div>

https://github.com/dsdshcym/promox Why would you choose Protocol/Promox over Behaviour/Mox? See this blog post for when to use Protocol and when to use Behaviour:

---

## [Mocking during one test or one test module only](https://forum.elixirforum.com/t/mocking-during-one-test-or-one-test-module-only/29804)

<div class="topic-metadata">

**Author:** [@doodloo](https://forum.elixirforum.com/u/doodloo)\
**Replies:** 4\
**Last updated:** [September 1, 2020, 2:29pm UTC](https://forum.elixirforum.com/t/mocking-during-one-test-or-one-test-module-only/29804 "2020-09-01T14:29:10Z")

</div>

Consider the following scenario: A Normalizer behaviour with a normalize\_email function. A User module, with a changeset function that should normalize the email param. The User.changeset function calls a default imple…

---

## [Race condition when mocking concurrent API calls](https://forum.elixirforum.com/t/race-condition-when-mocking-concurrent-api-calls/30382)

<div class="topic-metadata">

**Author:** [@Odysseus](https://forum.elixirforum.com/u/Odysseus)\
**Replies:** 4\
**Last updated:** [April 6, 2020, 4:04am UTC](https://forum.elixirforum.com/t/race-condition-when-mocking-concurrent-api-calls/30382 "2020-04-06T04:04:01Z")

</div>

Hello, I’m trying to test some code that fires off multiple external API calls in parallel using Task.async\_stream(). I’m using Mox to mock these external api calls like you see below. They work 95% of the time, but some…

---

## [Testing an elixir function using Mock](https://forum.elixirforum.com/t/testing-an-elixir-function-using-mock/19429)

<div class="topic-metadata">

**Author:** [@jyotigautam](https://forum.elixirforum.com/u/jyotigautam)\
**Replies:** 3\
**Last updated:** [January 17, 2019, 6:57pm UTC](https://forum.elixirforum.com/t/testing-an-elixir-function-using-mock/19429 "2019-01-17T18:57:55Z")

</div>

I have a Product schema which has a UPI(unique product identifier) eg. A985748BNG6784C . This is an autogenerated unique product identifier. I have a function upi\_generate() which calls another external function …

---

## [Why avoid mocks](https://forum.elixirforum.com/t/why-avoid-mocks/1396)

<div class="topic-metadata">

**Author:** [@kostonstyle](https://forum.elixirforum.com/u/kostonstyle)\
**Replies:** 25\
**Last updated:** [January 15, 2019, 10:17am UTC](https://forum.elixirforum.com/t/why-avoid-mocks/1396 "2019-01-15T10:17:34Z")

</div>

Hi all I am reading the phoenixframework book and says in the testing section, that we should avoid mocks for testing why? Thanks
