@@ -380,4 +380,129 @@ final class ParsingTests: XCTestCase {
380380 XCTAssertEqual ( result. errors [ 0 ] . line, 15 )
381381 XCTAssertEqual ( result. errors [ 0 ] . message, " use of undeclared identifier 'unknown' " )
382382 }
383+
384+ // MARK: - Swift Test Parallel Tests
385+
386+ func testSwiftTestParallelAllPassed( ) {
387+ let parser = OutputParser ( )
388+ let input = """
389+ Building for debugging...
390+ Build complete! (5.00s)
391+ [1/20] Testing ModuleA.TestClassA/testMethod1
392+ [2/20] Testing ModuleA.TestClassA/testMethod2
393+ [3/20] Testing ModuleA.TestClassA/testMethod3
394+ [4/20] Testing ModuleA.TestClassB/testMethod1
395+ [5/20] Testing ModuleA.TestClassB/testMethod2
396+ [6/20] Testing ModuleB.TestClassC/testMethod1
397+ [7/20] Testing ModuleB.TestClassC/testMethod2
398+ [8/20] Testing ModuleB.TestClassC/testMethod3
399+ [9/20] Testing ModuleB.TestClassD/testMethod1
400+ [10/20] Testing ModuleB.TestClassD/testMethod2
401+ [11/20] Testing ModuleC.TestClassE/testMethod1
402+ [12/20] Testing ModuleC.TestClassE/testMethod2
403+ [13/20] Testing ModuleC.TestClassE/testMethod3
404+ [14/20] Testing ModuleC.TestClassE/testMethod4
405+ [15/20] Testing ModuleC.TestClassF/testMethod1
406+ [16/20] Testing ModuleC.TestClassF/testMethod2
407+ [17/20] Testing ModuleD.TestClassG/testMethod1
408+ [18/20] Testing ModuleD.TestClassG/testMethod2
409+ [19/20] Testing ModuleD.TestClassG/testMethod3
410+ [20/20] Testing ModuleD.TestClassH/testMethod1
411+ ◇ Test run started.
412+ ↳ Testing Library Version: 6.0.3
413+ ◇ Suite " TestClassG " started.
414+ ✔ Test " testMethod1 " passed after 0.005 seconds.
415+ ✔ Test " testMethod2 " passed after 0.004 seconds.
416+ ✔ Test " testMethod3 " passed after 0.003 seconds.
417+ ✔ Suite " TestClassG " passed after 0.010 seconds.
418+ ✔ Test run with 4 tests passed after 0.015 seconds.
419+ """
420+
421+ let result = parser. parse ( input: input)
422+
423+ XCTAssertEqual ( result. status, " success " )
424+ XCTAssertEqual ( result. summary. passedTests, 20 )
425+ XCTAssertEqual ( result. summary. failedTests, 0 )
426+ }
427+
428+ func testSwiftTestParallelWithFailure( ) {
429+ let parser = OutputParser ( )
430+ let input = """
431+ Building for debugging...
432+ Build complete! (5.00s)
433+ [1/10] Testing ModuleA.TestClassA/testMethod1
434+ [2/10] Testing ModuleA.TestClassA/testMethod2
435+ [3/10] Testing ModuleA.TestClassA/testMethod3
436+ [4/10] Testing ModuleA.TestClassB/testMethod1
437+ [5/10] Testing ModuleA.TestClassB/testMethod2
438+ [6/10] Testing ModuleB.TestClassC/testMethod1
439+ [7/10] Testing ModuleB.TestClassC/testMethod2
440+ [8/10] Testing ModuleB.TestClassC/testMethod3
441+ [9/10] Testing ModuleB.TestClassD/testMethod1
442+ [10/10] Testing ModuleB.TestClassD/testMethod2
443+ ◇ Test run started.
444+ ↳ Testing Library Version: 6.0.3
445+ ◇ Suite " TestClassD " started.
446+ ✔ Test " testMethod1 " passed after 0.005 seconds.
447+ ✘ Test " testMethod2 " failed after 0.010 seconds.
448+ ✘ Test run with 1 test failed, 1 test passed after 0.020 seconds.
449+ """
450+
451+ let result = parser. parse ( input: input)
452+
453+ XCTAssertEqual ( result. status, " failed " )
454+ XCTAssertEqual ( result. summary. passedTests, 9 )
455+ XCTAssertEqual ( result. summary. buildTime, " 0.020 " )
456+ }
457+
458+ func testSwiftTestParallelLargeCount( ) {
459+ let parser = OutputParser ( )
460+ // Simulate a large test run with 1306 tests
461+ var input = " Building for debugging... \n Build complete! (5.00s) \n "
462+ for i in 1 ... 1306 {
463+ input += " [ \( i) /1306] Testing Module.TestClass/testMethod \( i) \n "
464+ }
465+ input += " ◇ Test run started. \n "
466+ input += " ✔ Test run with 82 tests passed after 0.170 seconds. \n "
467+
468+ let result = parser. parse ( input: input)
469+
470+ XCTAssertEqual ( result. status, " success " )
471+ XCTAssertEqual ( result. summary. passedTests, 1306 )
472+ XCTAssertEqual ( result. summary. failedTests, 0 )
473+ }
474+
475+ func testSwiftTestParallelPrioritizesSchedulingCount( ) {
476+ let parser = OutputParser ( )
477+ // When both [N/TOTAL] and "Test run with X tests passed" are present,
478+ // the [N/TOTAL] count should take priority
479+ let input = """
480+ [1/100] Testing Module.TestClass/testMethod1
481+ [100/100] Testing Module.TestClass/testMethod100
482+ ◇ Test run started.
483+ ✔ Test run with 5 tests passed after 0.015 seconds.
484+ """
485+
486+ let result = parser. parse ( input: input)
487+
488+ // Should use 100 from [N/TOTAL], not 5 from summary
489+ XCTAssertEqual ( result. summary. passedTests, 100 )
490+ }
491+
492+ func testSwiftTestingFailureSummaryParsing( ) {
493+ let parser = OutputParser ( )
494+ let input = """
495+ ◇ Test run started.
496+ ✘ Test " testMethod " failed after 0.010 seconds.
497+ ✘ Test run with 3 tests failed, 7 tests passed after 0.050 seconds.
498+ """
499+
500+ let result = parser. parse ( input: input)
501+
502+ XCTAssertEqual ( result. status, " failed " )
503+ // Without [N/TOTAL] lines, should use summary: 3 failed + 7 passed = 10 total
504+ // passed = 10 - 3 = 7
505+ XCTAssertEqual ( result. summary. passedTests, 7 )
506+ XCTAssertEqual ( result. summary. buildTime, " 0.050 " )
507+ }
383508}
0 commit comments