theappbusiness/TABTestKit

Add failed step and scenario information to failure messages

Closed this issue · 6 comments

When steps fail it can be difficult to understand exactly where in the test function things failed, especially on CI.

TTK already tries to help with this by adding a text attachment with lots of info when a failure occurs, but the log in the CI output can still be really unhelpful and just say something like "assert true failed".

I think we can improve this, since the most recently executed Scenario and Step are stored, including the line and file. We can add custom failure messages to XCTAssertTrue etc, and also potentially pass in the file and line from the most recent step (if there is one).

This would be an amazing next enhancement. Is this utilising the file: file, line: line feature?

Yeppers! I think it's even easier to solve than I thought, since we already intercept the recordFailure call in TABTestCase, we can just check the latest step from Step.current and then change the file / line that is recorded when calling super.recordFailure

Oh nice, are you currently working on this or is this something you'd not be able to get to for a while? Just so I know not to step on toes!

Already got a POC working so I'll try and get it into PR asap :)

Oh amazing 😍