Request: Format assertion failures for easier visual parsing

Issue #2344 resolved
Jason Clark created an issue

When a unit test fails, the IC2 Log view helpfully pulls out the assertion and re-displays it at the end of the log in an alternate color.

It would be very helpful if it would add a newline before “Expected:” and a newline before “, Actual:” to make it easier to visually parse the difference between the values.

As an example, here’s what I currently see:

System.AssertException: Assertion Failed: Expected: A long string with several, items, in, a, list., Actual: A long string with several, items, in, o, list.
(System Code)
Class.DSoql_Test.assertionExample: line 1101, column 1

And what I’d like to see:

System.AssertException: Assertion Failed: 
Expected: A long string with several, items, in, a, list.
, Actual: A long string with several, items, in, o, list.
(System Code)
Class.DSoql_Test.assertionExample: line 1101, column 1

Lining up the two values makes it very easy to spot any differences.

NOTE I don’t know why the code view is making one line italic. That’s not intentional formatting on my part.

Comments (8)

  1. Scott Wells repo owner

    Yeah, I like that idea quite a bit. Adding it to the list for next week’s build since it’s likely low-hanging fruit with high value.

  2. Scott Wells repo owner

    Implemented for the next build (currently slated for tomorrow):

    57.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;NBA,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WAVE,INFO;WORKFLOW,INFO
    09:58:02.11 (11650090)|EXECUTION_STARTED
    09:58:02.11 (11681722)|CODE_UNIT_STARTED|[EXTERNAL]|01pHu00000CQGbS|FailedAssertions.testFailedAssertions1()
    09:58:02.11 (15769014)|FATAL_ERROR|System.AssertException: Assertion Failed:
    Expected: It was a dark and stormy night...
    Actual:   It was a dark & stormy night...
    

  3. Log in to comment