Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

FluentAssertions Integration

Discussion in 'Testing & Automation' started by ManuelRauber, Oct 22, 2019.

  1. ManuelRauber


    Apr 3, 2015
    Hi Unity,

    I'm currently preparing an Asset Store Asset to use FluentAssertions in Unity, since I do not like the build in Assert that much, since the default messages of failing tests are not that good (e.g. "expected true to be false". "expected 2 to be 3"). I'm preparing the code here:

    However, I've noticed that with a custom assert library, the context menu with "Open Error Line" is not working correctly anymore:


    It does open the code of the FluentAssertion library instead of the test. I tried using [DebuggerHidden] and so on, but I was not able to get "Open Error Line" working again.

    Is this some kind of Unity magic it does behind the scenes or do we have the possibility to change that behavior?
    Alternative would be, if it would be possible to hook into that right click menu?


    In an ideal world, that with part FluentAssertions would not be visible in the Test Runner Window (or is visible, with a working Open Error Line)

  2. liortal


    Oct 17, 2012
    If you place your code (FluentAssertions) in a DLL (e.g: pre-compile it), it will navigate to the test code.
    At least that's how it behaved in the past.