6

As most Salesforce test runners report a stack trace that points to the failed test line (and usefully the calling lines that is helpful when more complex test classes are used) we generally do not include a failure message in assertions as that would violate the DRY principle e.g.:

System.assertEquals(relationships[3].Id, relatedContacts[2].relationshipSob.Id);

Just noticed that:

sfdx force:apex:test:run --classnames WizControllerTest --resultformat human

doesn't output the failing line yet alone the stack trace making it hard to understand exactly what failed when multiple similar assertions are present in a test method:

TEST NAME                                 OUTCOME  MESSAGE                                                                                               RUNTIME (MS)
────────────────────────────────────────  ───────  ────────────────────────────────────────────────────────────────────────────────────────────────────  ────────────
WizControllerTest..readRecord             Pass                                                                                                           93
WizControllerTest..readRelatedRecords     Fail     "System.AssertException: Assertion Failed: Expected: a0356000000GohBAAS, Actual: a0356000000Goh9AAC"  382

(Yes you can change to --resultformat json but then it is not easy to spot the "StackTrace" output.)

If you know of a channel to Salesforce where I can raise this issue, please let me know.

  • Maybe you could post an Idea? I do remember seeing on here someone mentioning a place where the developers of sfdx are really active so hopefully someone can post on here where that is. – Zack Walton Feb 6 '18 at 15:57
  • 1
    There is a lot of activity, including the developers, on the Salesforce DX group in the success community. – David Reed Feb 6 '18 at 16:04
  • Thanks both. My experience of posting ideas is that developer ones rarely get any traction. I'll take a look at the Salesforce DX group. – Keith C Feb 6 '18 at 16:05
  • I would say thats the answer David. Post it as an answer so it can be accepted. – Zack Walton Feb 6 '18 at 16:06
3

There is a lot of activity, including the developers, on the Salesforce DX group in the success community. The team on the Salesforce side is very responsive and engaged with issue reports and ideas.

| improve this answer | |
  • No Salesforce response day 1. – Keith C Feb 7 '18 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.