Skip to content

Commit

Permalink
add id and tag labels (#39)
Browse files Browse the repository at this point in the history
* add id and tag labels

* add tags label and fix id label

Co-authored-by: Andrey Yanushevich <[email protected]>
  • Loading branch information
aianushevich and Andrey Yanushevich authored Feb 10, 2022
1 parent 7992366 commit f3ba8e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/example_parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,16 @@ func TestAllureParameterTypes(t *testing.T) {
func TestAllureWithLabels(t *testing.T) {
allure.Test(t, allure.Description("Test with labels"),
allure.Epic("Epic Epic of Epicness"),
allure.ID("id1"),
allure.Lead("Duke Nukem"),
allure.Owner("Rex Powercolt"),
allure.Severity(severity.Critical),
allure.Story("story1"),
allure.Story("story2"),
allure.Feature("feature1"),
allure.Feature("feature2"),
allure.Tag("tag1"),
allure.Tags("tag2", "tag3"),
allure.Action(func() {}))
}

Expand Down
20 changes: 20 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import (

type Option func(r hasOptions)

func ID(id string) Option {
return func(r hasOptions) {
r.addLabel("AS_ID", id)
}
}

func Lead(lead string) Option {
return func(r hasOptions) {
r.addLabel("lead", lead)
Expand Down Expand Up @@ -42,6 +48,20 @@ func Feature(feature string) Option {
}
}

func Tag(tag string) Option {
return func(r hasOptions) {
r.addLabel("tag", tag)
}
}

func Tags(tags ...string) Option {
return func(r hasOptions) {
for _, tag := range tags {
r.addLabel("tag", tag)
}
}
}

func Parameter(name string, value interface{}) Option {
return func(r hasOptions) {
r.addParameter(name, value)
Expand Down

0 comments on commit f3ba8e0

Please sign in to comment.