Search Unity

LogAssertEx and Unity test extensions

Discussion in 'Testing & Automation' started by liortal, Oct 25, 2019.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I started working on a library of extensions and helpers on top of the Unity test framework.

    Throwing out this simple helper class (LogAssertEx), to see if this even has any interest from the community.
    Basically, this augments the built-in LogAssert class by allowing you to ignore any log message (instead of just 1).

    Usage is very simple:
    Code (CSharp):
    1.         // Ignore error logs with message - "test"
    2.         LogAssertEx.IgnoreMessage(LogType.Error, "test");
    3.  
    4.         // None of these logs will fail the test
    5.         Debug.LogError("test");
    6.         Debug.LogError("test");
    7.         Debug.LogError("test");
    8.         Debug.LogError("test");

    You can grab the code here >> https://gist.github.com/liortal53/f2e8c7c33679a1620a9b938eacc07988

    * I realize the implementation is a bit of an overkill, but i did not want to modify the existing UTF code (since there's no way to share it with others at the moment).

    ** In case you have any other feedbacks or feature suggestions, i'd love to hear them! ping me here or shoot out an email.

    CC: @Baste (since you also ranted about LogAssert here) and @Warnecke :)