Search Unity

FluentAssertions Integration

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

  1. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    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: https://github.com/ManuelRauber/fluentassertions-unity

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

    upload_2019-10-22_14-11-54.png

    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?

    upload_2019-10-22_14-49-52.png

    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)

    Thanks!
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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.