onsi / ginkgo

A Modern Testing Framework for Go
http://onsi.github.io/ginkgo/
MIT License
8.08k stars 643 forks source link

Feeding report back for focusing on failed test-cases #1386

Open koct9i opened 2 months ago

koct9i commented 2 months ago

It would be nice to have built-in option for feeding json-report back into loop and use it as natural data source for focusing on failed test-cases. (Probably it's already there but I don't see anything similar)

Unlike to "go test" caching this will work explicitly for the end user.

Generally, there's a lot useful features which could be implemented in testing suites if core framework could provide standard way to fetch previous results.

onsi commented 2 months ago

hey sorry for the delay - I've been out of pocket for a few weeks. This is a great idea and one that's popped into my head a few times - but not something I've ever prioritized or built.

There are certainly some edge cases (e.g. what if the test suite changes and you try running with an old report) and connecting a spec in the report with a spec in the suite is surprisingly non-trivial (there are no truly unique identifiers - you have to do it on the basis of a combination of file line/number and test text.

But this would be a great addition. The v0 for this could be something like --focus-failures=report.json which would just rerun failures. If you're interested in working on this I could point out at the places in the code, documentation, and test suites where the necessary changes would need to occur. I think it'll be a relatively straightforward change modulo those edge cases above.