Hello : )
I'm trying to improve my code and started to implement unit-testing. There are some parts that are still a bit confusing to me, especially mocks/stubs/...
Testing code that requires external libraries, e.g. a wrapper for my Lua-binding. How to test wrapper-classes? Should the Lua-binding be replaced by a mock? But then, what to test when the wrapper is depending on the functionality of the underlying API and is pretty much useless without it. Is testing a class together with a dependency an integration-test already?
One of my classes requires other classes to register for its use (event-bus). Now, how to handle this? Shall mocks register?
Another thing is a level-loader. It surely requires a dependency as a file-system-logic and my scripting-language to process through given level-file upon construction. My level-loader has a Load()-function that takes an empty level-field and populates it. Now, I want to improve the testability of this code. But as it requires other components upon construction, should I just inject real components or mocks? Since I want it to work and it will operate on the file-system, it seems weird to inject a mock that will only simulate the file-system.
This raises quite some confusion for me, but I'm confident it will go away after a bit more testing : ) And especially improve my code.
I hope this is somewhat understandable and would be really thankful if someone could help me out. Thanks for your time!