Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

FluentAssertions Integration

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

  1. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    81
    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,519
    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.
     
unityunity