@@ -346,11 +346,13 @@ func TestAggregateOutputs(t *testing.T) {
346346 TestRunCount : 1 ,
347347 Results : []TestResult {
348348 {
349- TestName : "TestOutput" ,
350- TestPackage : "pkg1" ,
351- Runs : 1 ,
352- Successes : 1 ,
353- Outputs : []string {"Output from report1 test run" },
349+ TestName : "TestOutput" ,
350+ TestPackage : "pkg1" ,
351+ Runs : 1 ,
352+ Successes : 1 ,
353+ PassedOutputs : map [string ][]string {
354+ "run1" : {"Output from report1 test run" },
355+ },
354356 PackageOutputs : []string {"Package output from report1" },
355357 },
356358 },
@@ -361,11 +363,13 @@ func TestAggregateOutputs(t *testing.T) {
361363 TestRunCount : 1 ,
362364 Results : []TestResult {
363365 {
364- TestName : "TestOutput" ,
365- TestPackage : "pkg1" ,
366- Runs : 1 ,
367- Successes : 1 ,
368- Outputs : []string {"Output from report2 test run" },
366+ TestName : "TestOutput" ,
367+ TestPackage : "pkg1" ,
368+ Runs : 1 ,
369+ Successes : 1 ,
370+ PassedOutputs : map [string ][]string {
371+ "run2" : {"Output from report2 test run" },
372+ },
369373 PackageOutputs : []string {"Package output from report2" },
370374 },
371375 },
@@ -382,18 +386,24 @@ func TestAggregateOutputs(t *testing.T) {
382386
383387 result := aggregatedReport .Results [0 ]
384388
385- // Expected outputs
386- expectedOutputs := []string {
387- "Output from report1 test run" ,
388- "Output from report2 test run" ,
389+ // Expected outputs after aggregation:
390+ // The aggregator should have merged both test runs' outputs under the same run key ("run1").
391+ expectedOutputs := map [string ][]string {
392+ "run1" : {
393+ "Output from report1 test run" ,
394+ },
395+ "run2" : {
396+ "Output from report2 test run" ,
397+ },
389398 }
399+
390400 expectedPackageOutputs := []string {
391401 "Package output from report1" ,
392402 "Package output from report2" ,
393403 }
394404
395- if ! reflect .DeepEqual (result .Outputs , expectedOutputs ) {
396- t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .Outputs )
405+ if ! reflect .DeepEqual (result .PassedOutputs , expectedOutputs ) {
406+ t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .PassedOutputs )
397407 }
398408
399409 if ! reflect .DeepEqual (result .PackageOutputs , expectedPackageOutputs ) {
@@ -407,11 +417,13 @@ func TestAggregateIdenticalOutputs(t *testing.T) {
407417 TestRunCount : 1 ,
408418 Results : []TestResult {
409419 {
410- TestName : "TestIdenticalOutput" ,
411- TestPackage : "pkg1" ,
412- Runs : 1 ,
413- Successes : 1 ,
414- Outputs : []string {"Identical output" },
420+ TestName : "TestIdenticalOutput" ,
421+ TestPackage : "pkg1" ,
422+ Runs : 1 ,
423+ Successes : 1 ,
424+ PassedOutputs : map [string ][]string {
425+ "run1" : {"Identical output" },
426+ },
415427 PackageOutputs : []string {"Identical package output" },
416428 },
417429 },
@@ -422,11 +434,13 @@ func TestAggregateIdenticalOutputs(t *testing.T) {
422434 TestRunCount : 1 ,
423435 Results : []TestResult {
424436 {
425- TestName : "TestIdenticalOutput" ,
426- TestPackage : "pkg1" ,
427- Runs : 1 ,
428- Successes : 1 ,
429- Outputs : []string {"Identical output" },
437+ TestName : "TestIdenticalOutput" ,
438+ TestPackage : "pkg1" ,
439+ Runs : 1 ,
440+ Successes : 1 ,
441+ PassedOutputs : map [string ][]string {
442+ "run1" : {"Identical output" },
443+ },
430444 PackageOutputs : []string {"Identical package output" },
431445 },
432446 },
@@ -443,80 +457,24 @@ func TestAggregateIdenticalOutputs(t *testing.T) {
443457
444458 result := aggregatedReport .Results [0 ]
445459
446- // Expected outputs
447- expectedOutputs := []string {
448- "Identical output" ,
449- "Identical output" ,
460+ expectedOutputs := map [string ][]string {
461+ "run1" : {"Identical output" , "Identical output" },
450462 }
463+
451464 expectedPackageOutputs := []string {
452465 "Identical package output" ,
453466 "Identical package output" ,
454467 }
455468
456- if ! reflect .DeepEqual (result .Outputs , expectedOutputs ) {
457- t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .Outputs )
469+ if ! reflect .DeepEqual (result .PassedOutputs , expectedOutputs ) {
470+ t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .PassedOutputs )
458471 }
459472
460473 if ! reflect .DeepEqual (result .PackageOutputs , expectedPackageOutputs ) {
461474 t .Errorf ("Expected PackageOutputs %v, got %v" , expectedPackageOutputs , result .PackageOutputs )
462475 }
463476}
464477
465- // TestMergeTestResults tests the mergeTestResults function.
466- func TestMergeTestResults (t * testing.T ) {
467- a := TestResult {
468- TestName : "TestA" ,
469- TestPackage : "pkg1" ,
470- Runs : 2 ,
471- Successes : 2 ,
472- Failures : 0 ,
473- Skips : 0 ,
474- Durations : []time.Duration {time .Second , time .Second },
475- Outputs : []string {"Output1" , "Output2" },
476- PackageOutputs : []string {"PkgOutput1" },
477- Panic : false ,
478- Race : false ,
479- Skipped : false ,
480- }
481-
482- b := TestResult {
483- TestName : "TestA" ,
484- TestPackage : "pkg1" ,
485- Runs : 3 ,
486- Successes : 2 ,
487- Failures : 1 ,
488- Skips : 0 ,
489- Durations : []time.Duration {2 * time .Second , 2 * time .Second , 2 * time .Second },
490- Outputs : []string {"Output3" , "Output4" , "Output5" },
491- PackageOutputs : []string {"PkgOutput2" },
492- Panic : true ,
493- Race : false ,
494- Skipped : false ,
495- }
496-
497- merged := mergeTestResults (a , b )
498-
499- expected := TestResult {
500- TestName : "TestA" ,
501- TestPackage : "pkg1" ,
502- Runs : 5 ,
503- Successes : 4 ,
504- Failures : 1 ,
505- Skips : 0 ,
506- Durations : []time.Duration {time .Second , time .Second , 2 * time .Second , 2 * time .Second , 2 * time .Second },
507- Outputs : []string {"Output1" , "Output2" , "Output3" , "Output4" , "Output5" },
508- PackageOutputs : []string {"PkgOutput1" , "PkgOutput2" },
509- Panic : true ,
510- Race : false ,
511- Skipped : false ,
512- PassRatio : 0.8 ,
513- }
514-
515- if ! reflect .DeepEqual (merged , expected ) {
516- t .Errorf ("Expected %+v, got %+v" , expected , merged )
517- }
518- }
519-
520478// TestAvgDuration tests the avgDuration function.
521479func TestAvgDuration (t * testing.T ) {
522480 durations := []time.Duration {
0 commit comments