Skip to content

proposal: testing: flag to continue testing after -failfast failure #61009

@sparr

Description

@sparr

Problem

After using go test -failfast to find the first failing test, then fixing the failure, there is no straightforward way to resume the tests from the point of failure. I have to either run all the earlier tests again, or enumerate the list of tests that come after the failing test.

Goal

Reduce the total time to resolve multiple bugs that each affect one or more tests but not most or all tests. Reduce the number of times each test is run.

Proposal

Add a flag such that -run TestFoo will not only run all tests matching TestFoo but all tests after the first such match.

Example

$ go test -failfast
--- PASS: TestA
--- PASS: TestB
--- FAIL: TestC
$ patch -i fix_test_c.patch
$ go test -run TestC
--- PASS: TestC
$ go test -failfast
--- PASS: TestA
--- PASS: TestB
--- PASS: TestC
--- PASS: TestD
--- FAIL: TestE

I didn't want to run TestA or TestB again here, or TestC an extra time. I would rather have done something like

go test -run TestC -andlatertests -failfast

(I acknowledge that's not a good name for the flag)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions