Unit Testing with MURL
Hey there Smile

I am using CppUnit to perform unit testing in my projects. Though everything is quite straight forward most of the time, unit testing gets difficult or better say more complicated when it comes to classes that are initialized over xml.

Examples for this would be a classes inheriting from Logic::GraphPositionInstance or classes containing/being custom nodes (e.g. http://murlengine.com/forum/showthread.php?tid=36 ).

Another problem arises when I want to test methods that modify the UI in some way.

So far I helped myself by creating custom constructors to be used in test cases and initializing only the most necessary stuff in order for the tests to work.

When it comes to methods manipulating the UI, I used preprocessor commands to disable UI interactions.
void ToggleButton::OnSetToInactive()
    Notify(Button::GetButtonId(), ToggleButton::Messages::SET_TO_INACTIVE);
    TextTextureNode->SetBackgroundColor(Color(133.0f, 133.0f, 133.0f, 0.0f));

So much for explaining my approach...
Now to my questions.
  1. Is this is the correct/optimal way to perform unit testing with MURL?
  2. Would it be possible to also include methods that manipulate UI components into testing (e.g. SetBackgroundColor)?
  3. Are there any best practices or "dos and don'ts" you came across during your development?
As always, thank you!

Forum Jump:

Copyright © 2011-2017 Spraylight GmbH.