diff --git a/pkg/ginkgo-reporters/README.md b/pkg/ginkgo-reporters/README.md index f04fb75..6045491 100644 --- a/pkg/ginkgo-reporters/README.md +++ b/pkg/ginkgo-reporters/README.md @@ -15,6 +15,8 @@ This reporter fills in the xunit file the needed fields in order to upload it in - --polarion-report-file the output file will be generated under working directory, the default is polarion_results.xml - --test-suite-params="OS=EL8 Storage=NFS Arch=x86" will be set under 'properties' and the values will get concatenated to the test run name - --test-id-prefix="PREFIX" will set "PREFIX" for each test ID in test properties, if this parameter is not passed, the project ID parameter is set to be that prefix by default +- --test-run-template="Existing template name" will create the test run from an existing template +- --test-run-title="Title" will set the test run title ### Usage diff --git a/pkg/ginkgo-reporters/polarion_reporter.go b/pkg/ginkgo-reporters/polarion_reporter.go index 1103188..9a514cc 100644 --- a/pkg/ginkgo-reporters/polarion_reporter.go +++ b/pkg/ginkgo-reporters/polarion_reporter.go @@ -42,6 +42,8 @@ func init() { flag.StringVar(&Polarion.LookupMethod, "polarion-lookup-method", "id", "Set Polarion lookup method - id or name") flag.StringVar(&Polarion.TestSuiteParams, "test-suite-params", "", "Set test suite params in space seperated name=value structure. Note that the values will be appended to the test run ID") flag.StringVar(&Polarion.TestIDPrefix, "test-id-prefix", "", "Set Test ID prefix, in the case it is different than project ID") + flag.StringVar(&Polarion.TestRunTemplate, "test-run-template", "", "Set Test run template, if you wish to create your test run from an existing template") + flag.StringVar(&Polarion.TestRunTitle, "test-run-title", "", "Set Test run title, if you wish to nane your test run") } type PolarionTestSuite struct { @@ -89,6 +91,8 @@ type PolarionReporter struct { LookupMethod string TestSuiteParams string TestIDPrefix string + TestRunTemplate string + TestRunTitle string } func (reporter *PolarionReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { @@ -121,6 +125,14 @@ func (reporter *PolarionReporter) SpecSuiteWillBegin(config config.GinkgoConfigT reporter.Suite.Properties.Property, "polarion-custom-isautomated", "True") reporter.Suite.Properties.Property = addProperty( reporter.Suite.Properties.Property, "polarion-testrun-status-id", "inprogress") + if reporter.TestRunTemplate != "" { + reporter.Suite.Properties.Property = addProperty( + reporter.Suite.Properties.Property, "polarion-testrun-template-id", reporter.TestRunTemplate) + } + if reporter.TestRunTemplate != "" { + reporter.Suite.Properties.Property = addProperty( + reporter.Suite.Properties.Property, "polarion-testrun-title", reporter.TestRunTitle) + } reporter.TestSuiteName = summary.SuiteDescription } diff --git a/pkg/ginkgo-reporters/polarion_reporter_test.go b/pkg/ginkgo-reporters/polarion_reporter_test.go index 8e655bb..7148e93 100644 --- a/pkg/ginkgo-reporters/polarion_reporter_test.go +++ b/pkg/ginkgo-reporters/polarion_reporter_test.go @@ -56,6 +56,8 @@ var _ = Describe("ginkgo_reporters", func() { PlannedIn: "QE_1.0", LookupMethod: "id", TestSuiteParams: "OS=EL7 SC=NFS", + TestRunTemplate: "QE_Regression_template", + TestRunTitle: "My run title", } properties = PolarionProperties{ @@ -92,6 +94,14 @@ var _ = Describe("ginkgo_reporters", func() { Name: "polarion-testrun-status-id", Value: "inprogress", }, + { + Name: "polarion-testrun-template-id", + Value: "QE_Regression_template", + }, + { + Name: "polarion-testrun-title", + Value: "My run title", + }, }, }