Closed mingqishao closed 8 months ago
Adding more detail. The screenshot below shows a "traditional" test approach using t.Run()
for sub-tests, and an equivalent table-driven approach. In the traditional approach, individual sub-tests can be executed directly from vscode by clicking the "run test" label that appears. It would be amazing if the same thing were possible in the table driven approach, i.e. if vscode could recognise that each entry in the slice being ranged represents a sub-test, and provided a separate "run test" label for it by the struct definition.
Clearly it wouldn't be possible to support arbitrarily complex non-constant arguments for t.Run
, or arbitrarily complex table-driven test implementations, but I'd have thought that it should be possible to support tests with a single t.Run
call, where the name references a struct field in a slice which is being ranged? Being able to do this would be incredibly useful!
I think this is a duplicate of #2445.
Is your feature request related to a problem? Please describe. We usually use table driven in unit test. Here is a simple example. Our problem is I can't run single test case. If one test failed and I want to run it again. I have to comment out all other test case, then run the whole xxx_Test() function.
Describe the solution you'd like Support run the single test case in table driven unit test like subtest today.