Skip to content

Add filename and line no. as context in failed test runs for feature files #7

Open
@wgwz

Description

@wgwz

Summary

This issue is a proposal to add context to test failure output for feature files, i.e. filename and line no. of the failed scenario.

Problem Definition

This would improve the dev UX while debugging failed tests. Knowing the failed test you could more easily search for the file, and find the scenario you need to debug. I'm not sure if this is even possible, it is just an idea.

Proposal

Output at present:

        --- FAIL: TestMsgBridgeReceive/MsgBridgeReceive/an_error_is_returned_if_class_id_is_not_formatted (0.00s)
            msg_bridge_receive_test.go:60: 
                        Error Trace:    msg_bridge_receive_test.go:60
                                                                value.go:556
                                                                value.go:339
                                                                run_step.go:98
                                                                run_scenario.go:112
                                                                run_scenario.go:65
                                                                run_doc.go:33
                        Error:          Error message not equal:
                                        expected: "class ID didn't match the format: expected A00, got foo: parse error"
                                        actual  : "class ID didn't match the format: expected A00, got foo: invalid request"
                        Test:           TestMsgBridgeReceive/MsgBridgeReceive/an_error_is_returned_if_class_id_is_not_formatted

Example Desired output:

        --- FAIL: TestMsgBridgeReceive/MsgBridgeReceive/an_error_is_returned_if_class_id_is_not_formatted (0.00s)
            msg_bridge_receive_test.go:60: 
                        Error Trace:    msg_bridge_receive_test.go:60
                                                                value.go:556
                                                                value.go:339
                                                                run_step.go:98
                                                                run_scenario.go:112
                                                                run_scenario.go:65
                                                                run_doc.go:33
                        Error:          Error message not equal:
                                        expected: "class ID didn't match the format: expected A00, got foo: parse error"
                                        actual  : "class ID didn't match the format: expected A00, got foo: invalid request"
                        Test:           TestMsgBridgeReceive/MsgBridgeReceive/an_error_is_returned_if_class_id_is_not_formatted
                        Location:       x/ecocredit/core/features/msg_bridge_receive.feature:59

Note the added Location where x/ecocredit/core/features/msg_bridge_receive.feature:59 leads to:

 59   Scenario: an error is returned if class id is not formatted
 60     Given the message
 61     """
 62     {
 63       "issuer": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
 64       "class_id": "foo"
 65     }
 66     """
 67     When the message is validated
 68     Then expect the error "class ID didn't match the format: expected A00, got foo: invalid request"

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions