Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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.