Skip to content

Commit

Permalink
Merge pull request #18 from nellyc/add_template_option
Browse files Browse the repository at this point in the history
Xunit builder - added more options
  • Loading branch information
nellyc authored Apr 2, 2020
2 parents 8a7c9af + fdbbc1b commit 22fd879
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/ginkgo-reporters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions pkg/ginkgo-reporters/polarion_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/ginkgo-reporters/polarion_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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",
},
},
}

Expand Down

0 comments on commit 22fd879

Please sign in to comment.