File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,23 @@ func TestFailInParentBeforeSubTests(t *testing.T) {
102102 })
103103}
104104
105+ func TestDeeplyNestedSubTests (t * testing.T ) {
106+ t .Parallel ()
107+
108+ t .Run ("Level1" , func (t * testing.T ) {
109+ t .Run ("Level2" , func (t * testing.T ) {
110+ t .Run ("Level3" , func (t * testing.T ) {
111+ t .Run ("Pass" , func (t * testing.T ) {
112+ t .Log ("This deeply nested subtest always passes" )
113+ })
114+ t .Run ("Fail" , func (t * testing.T ) {
115+ t .Fatal ("This deeply nested subtest always fails" )
116+ })
117+ })
118+ })
119+ })
120+ }
121+
105122// This test should have a 50% pass ratio
106123func TestFlaky (t * testing.T ) {
107124 t .Parallel ()
Original file line number Diff line number Diff line change @@ -155,6 +155,30 @@ func TestRun(t *testing.T) {
155155 exactRuns : & defaultTestRunCount ,
156156 allFailures : true ,
157157 },
158+ "TestDeeplyNestedSubTests" : {
159+ exactRuns : & defaultTestRunCount ,
160+ allFailures : true ,
161+ },
162+ "TestDeeplyNestedSubTests/Level1" : {
163+ exactRuns : & defaultTestRunCount ,
164+ allFailures : true ,
165+ },
166+ "TestDeeplyNestedSubTests/Level1/Level2" : {
167+ exactRuns : & defaultTestRunCount ,
168+ allFailures : true ,
169+ },
170+ "TestDeeplyNestedSubTests/Level1/Level2/Level3" : {
171+ exactRuns : & defaultTestRunCount ,
172+ allFailures : true ,
173+ },
174+ "TestDeeplyNestedSubTests/Level1/Level2/Level3/Pass" : {
175+ exactRuns : & defaultTestRunCount ,
176+ allSuccesses : true ,
177+ },
178+ "TestDeeplyNestedSubTests/Level1/Level2/Level3/Fail" : {
179+ exactRuns : & defaultTestRunCount ,
180+ allFailures : true ,
181+ },
158182 },
159183 },
160184 {
You can’t perform that action at this time.
0 commit comments