File tree Expand file tree Collapse file tree 3 files changed +48
-3
lines changed
test/converters/xcresult3 Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change 55steps-deploy-to-bitrise-io
66/.idea /
77.env
8+ .DS_Store
Original file line number Diff line number Diff line change @@ -204,6 +204,30 @@ func TestConverter_XML(t *testing.T) {
204204 },
205205 }, junitXML .TestSuites )
206206 })
207+
208+ t .Run ("xcresult3-multiple-test-plan-configurations.xcresult" , func (t * testing.T ) {
209+ fileName := "xcresult3-multiple-test-plan-configurations.xcresult"
210+ rootDir , xcresultPath , err := setupTestData (fileName )
211+ require .NoError (t , err )
212+ require .NotEmpty (t , rootDir )
213+ require .NotEmpty (t , xcresultPath )
214+
215+ t .Log ("tempTestdataDir: " , rootDir )
216+
217+ c := Converter {xcresultPth : xcresultPath }
218+ junitXML , err := c .Convert ()
219+ require .NoError (t , err )
220+ require .NotNil (t , junitXML )
221+
222+ require .EqualValues (
223+ t ,
224+ junitXML .TestSuites [0 ].TestCases [0 ].Failure .Value ,
225+ `English: swift_testingTests.swift:20: Expectation failed: true == false - // This test is intended to fail to demonstrate test failure reporting.
226+ German: swift_testingTests.swift:20: Expectation failed: true == false - // This test is intended to fail to demonstrate test failure reporting.
227+ ` ,
228+ )
229+
230+ })
207231}
208232
209233func BenchmarkConverter_XML (b * testing.B ) {
Original file line number Diff line number Diff line change @@ -112,15 +112,35 @@ func extractDuration(text string) time.Duration {
112112 return duration
113113}
114114
115+ func extractFailureMessageFromTestPlanConfigs (testPlanConfigNodes []TestNode ) (string , []string ) {
116+ var warnings []string
117+ failureMessage := ""
118+
119+ for _ , testPlanConfigNode := range testPlanConfigNodes {
120+ msg , wrns := extractFailureMessage (testPlanConfigNode )
121+ if msg != "" {
122+ failureMessage += fmt .Sprintf ("%s: %s\n " , testPlanConfigNode .Name , msg )
123+ }
124+ if wrns != nil {
125+ warnings = append (warnings , wrns ... )
126+ }
127+ }
128+
129+ return failureMessage , warnings
130+ }
131+
115132func extractFailureMessage (testNode TestNode ) (string , []string ) {
116133 childrenCount := len (testNode .Children )
117134 if childrenCount == 0 {
118135 return "" , nil
119136 }
120137
121- lastNode := testNode .Children [childrenCount - 1 ]
122- if lastNode .Type == TestNodeTypeRepetition {
123- return extractFailureMessage (lastNode )
138+ lastChild := testNode .Children [childrenCount - 1 ]
139+ if lastChild .Type == TestNodeTypeRepetition {
140+ return extractFailureMessage (lastChild )
141+ }
142+ if lastChild .Type == TestNodeTypeTestPlanConfig {
143+ return extractFailureMessageFromTestPlanConfigs (testNode .Children )
124144 }
125145
126146 var warnings []string
You can’t perform that action at this time.
0 commit comments