Unit testing an AudioProcessor class

Hi,

I’m using the native Xcode unit test target in a project generated by Projucer. I want to instantiate my AudioProcessor class in a unit test, but the class also inherits from juce::Timer and the test crashes on an internal juce assert, JUCE_ASSERT_MESSAGE_MANAGER_EXISTS. This makes sense since I am attempting to instantiate the class directly. I’m guessing my approach is too naive here and I need to do more to be able to instantiate and test an AudioProcessor class but I haven’t found any good tutorial material on setting up for unit testing. Can someone help get me started?

Thanks!

M.

I think adding the juce::ScopedInitialiser_GUI somewhere before the audio processor might solve this?
https://docs.juce.com/develop/classScopedJuceInitialiser__GUI.html

Thanks! It worked to add the line

auto x = juce::ScopedJuceInitialiser_GUI();

just prior to instantiating my Audio Processor class.

1 Like