@@ -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,22 @@ 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+ expectedOutputs := map [string ][]string {
390+ "run1" : {
391+ "Output from report1 test run" ,
392+ },
393+ "run2" : {
394+ "Output from report2 test run" ,
395+ },
389396 }
397+
390398 expectedPackageOutputs := []string {
391399 "Package output from report1" ,
392400 "Package output from report2" ,
393401 }
394402
395- if ! reflect .DeepEqual (result .Outputs , expectedOutputs ) {
396- t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .Outputs )
403+ if ! reflect .DeepEqual (result .PassedOutputs , expectedOutputs ) {
404+ t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .PassedOutputs )
397405 }
398406
399407 if ! reflect .DeepEqual (result .PackageOutputs , expectedPackageOutputs ) {
@@ -407,11 +415,13 @@ func TestAggregateIdenticalOutputs(t *testing.T) {
407415 TestRunCount : 1 ,
408416 Results : []TestResult {
409417 {
410- TestName : "TestIdenticalOutput" ,
411- TestPackage : "pkg1" ,
412- Runs : 1 ,
413- Successes : 1 ,
414- Outputs : []string {"Identical output" },
418+ TestName : "TestIdenticalOutput" ,
419+ TestPackage : "pkg1" ,
420+ Runs : 1 ,
421+ Successes : 1 ,
422+ PassedOutputs : map [string ][]string {
423+ "run1" : {"Identical output" },
424+ },
415425 PackageOutputs : []string {"Identical package output" },
416426 },
417427 },
@@ -422,11 +432,13 @@ func TestAggregateIdenticalOutputs(t *testing.T) {
422432 TestRunCount : 1 ,
423433 Results : []TestResult {
424434 {
425- TestName : "TestIdenticalOutput" ,
426- TestPackage : "pkg1" ,
427- Runs : 1 ,
428- Successes : 1 ,
429- Outputs : []string {"Identical output" },
435+ TestName : "TestIdenticalOutput" ,
436+ TestPackage : "pkg1" ,
437+ Runs : 1 ,
438+ Successes : 1 ,
439+ PassedOutputs : map [string ][]string {
440+ "run1" : {"Identical output" },
441+ },
430442 PackageOutputs : []string {"Identical package output" },
431443 },
432444 },
@@ -443,80 +455,24 @@ func TestAggregateIdenticalOutputs(t *testing.T) {
443455
444456 result := aggregatedReport .Results [0 ]
445457
446- // Expected outputs
447- expectedOutputs := []string {
448- "Identical output" ,
449- "Identical output" ,
458+ expectedOutputs := map [string ][]string {
459+ "run1" : {"Identical output" , "Identical output" },
450460 }
461+
451462 expectedPackageOutputs := []string {
452463 "Identical package output" ,
453464 "Identical package output" ,
454465 }
455466
456- if ! reflect .DeepEqual (result .Outputs , expectedOutputs ) {
457- t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .Outputs )
467+ if ! reflect .DeepEqual (result .PassedOutputs , expectedOutputs ) {
468+ t .Errorf ("Expected Outputs %v, got %v" , expectedOutputs , result .PassedOutputs )
458469 }
459470
460471 if ! reflect .DeepEqual (result .PackageOutputs , expectedPackageOutputs ) {
461472 t .Errorf ("Expected PackageOutputs %v, got %v" , expectedPackageOutputs , result .PackageOutputs )
462473 }
463474}
464475
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-
520476// TestAvgDuration tests the avgDuration function.
521477func TestAvgDuration (t * testing.T ) {
522478 durations := []time.Duration {
0 commit comments