Skip to content

Commit

Permalink
fix:count of fail,test & total (#1556)
Browse files Browse the repository at this point in the history
Signed-off-by: shivamsouravjha <shivamsouravjha@gmail.com>
  • Loading branch information
shivamsouravjha committed Feb 11, 2024
1 parent b12d23c commit 433e9c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions pkg/service/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ type TestOptions struct {
}

var (
totalTests int
totalTestPassed int
totalTestFailed int
totalTests int
totalTestPassed int
totalTestFailed int
)

var completeTestReport = make(map[string]TestReportVerdict)
Expand Down Expand Up @@ -265,15 +265,15 @@ func (t *tester) Test(path string, testReportPath string, appCmd string, options
break
}
}

// Sorting completeTestReport map according to testSuiteName (Keys)
testSuiteNames := make([]string, 0, len(completeTestReport))

for testSuiteName := range completeTestReport {
testSuiteNames = append(testSuiteNames, testSuiteName)
}
for testSuiteName := range completeTestReport {
testSuiteNames = append(testSuiteNames, testSuiteName)
}

sort.Strings(testSuiteNames)
sort.Strings(testSuiteNames)

pp.Printf("\n <=========================================> \n COMPLETE TESTRUN SUMMARY. \n\tTotal tests: %s\n"+"\tTotal test passed: %s\n"+"\tTotal test failed: %s\n", totalTests, totalTestPassed, totalTestFailed)

Expand Down Expand Up @@ -384,7 +384,7 @@ func (t *tester) InitialiseRunTestSet(cfg *RunTestSetConfig) InitialiseRunTestSe
}
sortedConfigMocks := SortMocks(&fakeTestCase, readConfigMocks, t.logger)
t.logger.Debug(fmt.Sprintf("the oss config mocks for %s are: %v\n", cfg.TestSet, readConfigMocks))

cfg.LoadedHooks.SetConfigMocks(sortedConfigMocks)
sort.SliceStable(readTcsMocks, func(i, j int) bool {
return readTcsMocks[i].Spec.ReqTimestampMock.Before(readTcsMocks[j].Spec.ReqTimestampMock)
Expand Down Expand Up @@ -578,7 +578,7 @@ func (t *tester) FetchTestResults(cfg *FetchTestResultsConfig) models.TestRunSta
totalTestPassed += cfg.TestReport.Success
totalTestFailed += cfg.TestReport.Failure

verdict := TestReportVerdict{cfg.TestReport.Success, cfg.TestReport.Failure, cfg.TestReport.Total}
verdict := TestReportVerdict{total: cfg.TestReport.Total, failed: cfg.TestReport.Failure, passed: cfg.TestReport.Success}

completeTestReport[cfg.TestReport.TestSet] = verdict

Expand Down
6 changes: 3 additions & 3 deletions pkg/service/test/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ type FetchTestResultsConfig struct {
}

type TestReportVerdict struct {
total int
passed int
failed int
total int
passed int
failed int
}

func FlattenHttpResponse(h http.Header, body string) (map[string][]string, error) {
Expand Down

0 comments on commit 433e9c9

Please sign in to comment.