Junit test report generation (#4214)

* Junit test report generation

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* Junit test report generation

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
This commit is contained in:
Anand Kumar Singh
2020-11-20 09:17:51 +05:30
committed by GitHub
parent 6eb43d0420
commit baa313049b
12 changed files with 25 additions and 29 deletions

View File

@@ -37,4 +37,6 @@ make test-operator-hub
# E2e tests
make test-e2e-all
cp -r reports $ARTIFACTS_DIR
odo logout

View File

@@ -59,4 +59,6 @@ else
make test-e2e-all
fi
cp -r reports $ARTIFACTS_DIR
odo logout

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestE2eScenarios(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "odo e2e scenarios")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
//RunSpecsWithDefaultAndCustomReporters(t, "odo e2e scenarios", []Reporter{reporter.JunitReport(t, "../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "odo e2e scenarios", []Reporter{reporter.JunitReport(t, "../../reports")})
}

View File

@@ -7,6 +7,7 @@ import (
"testing"
"time"
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/reporters"
)
@@ -16,8 +17,8 @@ func JunitReport(t *testing.T, filePath string) *reporters.JUnitReporter {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
_ = os.Mkdir(filePath, os.ModePerm)
}
xmlFileName := fmt.Sprintf(filepath.Join(filePath, "junit_%d-%d-%d_%02d-%02d-%02d.xml"), time.Year(), time.Month(),
time.Day(), time.Hour(), time.Minute(), time.Second())
xmlFileName := fmt.Sprintf(filepath.Join(filePath, "junit_%d-%d-%d_%02d-%02d-%02d_%d.xml"), time.Year(), time.Month(),
time.Day(), time.Hour(), time.Minute(), time.Second(), config.GinkgoConfig.ParallelNode)
junitReporter := reporters.NewJUnitReporter(xmlFileName)
return junitReporter
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestDebug(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Debug Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Debug Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestDebug(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Debug Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestDevfiles(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Devfile Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestDocker(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Docker Devfile Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}

View File

@@ -7,11 +7,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestIntegration(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Integration Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Integration Suite", []Reporter{reporter.JunitReport(t, "../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Integration Suite", []Reporter{reporter.JunitReport(t, "../../reports/")})
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestLoginlogout(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Loginlogout Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Loginlogout Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Loginlogout Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestProject(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Project Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Project Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}

View File

@@ -5,11 +5,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/odo/tests/helper/reporter"
)
func TestServicecatalog(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Servicecatalog Suite")
// Keep CustomReporters commented till https://github.com/onsi/ginkgo/issues/628 is fixed
// RunSpecsWithDefaultAndCustomReporters(t, "Servicecatalog Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
RunSpecsWithDefaultAndCustomReporters(t, "Servicecatalog Suite", []Reporter{reporter.JunitReport(t, "../../../reports")})
}