From f3ba8e04fe8528a5c1ab33cccab0905ea8b0b324 Mon Sep 17 00:00:00 2001 From: aianushevich <45210995+aianushevich@users.noreply.github.com> Date: Thu, 10 Feb 2022 18:16:25 +0300 Subject: [PATCH] add id and tag labels (#39) * add id and tag labels * add tags label and fix id label Co-authored-by: Andrey Yanushevich --- example/example_parameters_test.go | 3 +++ options.go | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/example/example_parameters_test.go b/example/example_parameters_test.go index 9366407..4da3d0f 100644 --- a/example/example_parameters_test.go +++ b/example/example_parameters_test.go @@ -84,6 +84,7 @@ 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), @@ -91,6 +92,8 @@ func TestAllureWithLabels(t *testing.T) { allure.Story("story2"), allure.Feature("feature1"), allure.Feature("feature2"), + allure.Tag("tag1"), + allure.Tags("tag2", "tag3"), allure.Action(func() {})) } diff --git a/options.go b/options.go index b7830f8..d47e618 100644 --- a/options.go +++ b/options.go @@ -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) @@ -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)