@@ -225,22 +225,29 @@ let getNUnitResults () =
225225 " alwaysArray" ==> true
226226 ]
227227 let rec collectTestCases o =
228+
228229 let current = if !! o?`` test-case `` <> Utils.undefined then unbox< obj[]>( o?`` test-case `` ) else [||]
230+ let results = if !! o?`` results `` <> Utils.undefined then unbox< obj[]>( o?`` results `` ) else [||]
229231 let testSuites = if !! o?`` test-suite `` <> Utils.undefined then unbox< obj[]>( o?`` test-suite `` ) else [||]
230- Array.append current ( testSuites |> Array.collect collectTestCases)
232+ let suites = Array.append results testSuites
233+ Array.append current ( suites |> Array.collect collectTestCases)
231234
232235 let res = convert?xml2js( xmlCnt, opts)
233- let res = unbox< obj[]>( res?`` test-run `` ).[ 0 ]
236+ let res =
237+ try
238+ unbox< obj[]>( res?`` test-run `` ).[ 0 ]
239+ with
240+ | _ -> unbox< obj[]>( res?`` test-results `` ).[ 0 ]
234241 collectTestCases res
235242
236243let nUnitOldResultToTestResult obj =
237- let name = !! obj?_ attributes?fullname
238- let timer = !! obj?_ attributes?duration
244+ let name = if !! obj?_ attributes?fullname <> undefined then !! obj ?_ attributes?fullname else !! obj ?_ attributes?name
245+ let timer = if !! obj?_ attributes?duration <> undefined then !! obj ?_ attributes?duration else !! obj ?_ attributes?time
239246 let result = !! obj?_ attributes?result
240247 let state =
241248 match result with
242- | " Passed" -> TestState.Passed
243- | " Failed" | " Inconclusive" -> TestState.Failed
249+ | " Passed" | " Success " -> TestState.Passed
250+ | " Failed" | " Failure " | " Inconclusive" -> TestState.Failed
244251 | " Skipped" -> TestState.Ignored
245252 | _ -> TestState.NotRun
246253 let error =
@@ -255,14 +262,16 @@ let nUnitOldResultToTestResult obj =
255262let log = createConfiguredLoggers " NEPTUNE" " Neptune (F# - Classic Runners Adapter)"
256263
257264let runAllTestsWithOldRunner ( proj : Project ) initial =
265+
258266 match findOldRunner proj with
259267 | None -> Promise.lift initial
260268 | Some ( isNUnit, runner) ->
261269 let args =
262270 if isNUnit then " \" " + proj.Output + " \" "
263271 else
272+ let p = Path.join( workspace.rootPath, " TestResult.xml" )
264273 " \" " + proj.Output + " \" "
265- + " -nunit"
274+ + " -nunit " + p
266275 Process.spawn runner " mono" args
267276 |> Process.onOutput ( fun buffer ->
268277 let outputString = buffer.toString()
0 commit comments