# How to mock out the world in C++ unit tests?

**URL:** <https://forums.unrealengine.com/t/how-to-mock-out-the-world-in-c-unit-tests/1977455>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [August 15, 2024, 8:20pm UTC](https://forums.unrealengine.com/t/how-to-mock-out-the-world-in-c-unit-tests/1977455 "2024-08-15T20:20:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FBryant87](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FBryant87](https://forums.unrealengine.com/u/FBryant87)\
**Post date:** [August 15, 2024, 8:20pm UTC](https://forums.unrealengine.com/t/how-to-mock-out-the-world-in-c-unit-tests/1977455/1 "2024-08-15T20:20:26Z")

</div>

I can write a test in C++ with “IMPLEMENT\_SIMPLE\_AUTOMATION\_TEST”, and this works great for anything simple.

But as soon as I test a class which has dependencies, or calls out to the world like with SpawnActor\<\>, my test of course blows up because the world does not exist.

How do most people get around this type of problem, given concepts like IOC are not strongly support?
