diff --git a/allure.go b/allure.go index e5219f6..d878f92 100644 --- a/allure.go +++ b/allure.go @@ -14,7 +14,7 @@ func (it *test) setLinksAllure(t linksAllureProvider) { if it.allureLinks.testCase != "" { t.SetTestCase(it.allureLinks.testCase) } - if it.allureLinks.link.Name != "" { + if it.allureLinks.link != nil { t.Link(it.allureLinks.link) } } @@ -38,6 +38,9 @@ func (it *test) setLabelsAllure(t labelsAllureProvider) { if it.allureLabels.tag != "" { t.Tag(it.allureLabels.tag) } + if it.allureLabels.allureID != "" { + t.AllureID(it.allureLabels.allureID) + } if it.allureLabels.severity != "" { t.Severity(it.allureLabels.severity) } @@ -47,7 +50,7 @@ func (it *test) setLabelsAllure(t labelsAllureProvider) { if it.allureLabels.lead != "" { t.Lead(it.allureLabels.lead) } - if it.allureLabels.label.Name != "" { + if it.allureLabels.label != nil { t.Label(it.allureLabels.label) } if len(it.allureLabels.labels) != 0 { diff --git a/builder.go b/builder.go index df915a9..1a555ec 100644 --- a/builder.go +++ b/builder.go @@ -121,7 +121,7 @@ func (it *test) SetTestCase(testCase string) AllureBuilder { return it } -func (it *test) Link(link allure.Link) AllureBuilder { +func (it *test) Link(link *allure.Link) AllureBuilder { it.allureLinks.link = link return it @@ -133,6 +133,12 @@ func (it *test) ID(value string) AllureBuilder { return it } +func (it *test) AllureID(value string) AllureBuilder { + it.allureLabels.allureID = value + + return it +} + func (it *test) AddSuiteLabel(value string) AllureBuilder { it.allureLabels.suiteLabel = value @@ -181,13 +187,13 @@ func (it *test) Lead(value string) AllureBuilder { return it } -func (it *test) Label(label allure.Label) AllureBuilder { +func (it *test) Label(label *allure.Label) AllureBuilder { it.allureLabels.label = label return it } -func (it *test) Labels(labels ...allure.Label) AllureBuilder { +func (it *test) Labels(labels ...*allure.Label) AllureBuilder { it.allureLabels.labels = labels return it diff --git a/builder_test.go b/builder_test.go index e8a23e8..5c094c5 100644 --- a/builder_test.go +++ b/builder_test.go @@ -45,19 +45,20 @@ func TestHTTPTestMaker(t *testing.T) { addParentSuite = "AddParentSuite" story = "Story" tag = "Tag" + allureID = "AllureID" owner = "Owner" lead = "Lead" - label = allure.Label{"kek", "lol"} + label = &allure.Label{"kek", "lol"} setIssue = "SetIssue" setTestCase = "SetTestCase" repeatCount = 10 repeatDelay = time.Duration(10) - link = allure.Link{ + link = &allure.Link{ Name: "link", Type: "type", URL: "http://go.go", } - labels = []allure.Label{ + labels = []*allure.Label{ { Name: "label_1", Value: "value_1", @@ -123,6 +124,7 @@ func TestHTTPTestMaker(t *testing.T) { Story(story). Tag(tag). Severity(allure.CRITICAL). + AllureID(allureID). Owner(owner). Lead(lead). Label(label). @@ -171,6 +173,7 @@ func TestHTTPTestMaker(t *testing.T) { require.Equal(t, owner, resHt.allureLabels.owner) require.Equal(t, lead, resHt.allureLabels.lead) require.Equal(t, label, resHt.allureLabels.label) + require.Equal(t, allureID, resHt.allureLabels.allureID) require.Equal(t, setIssue, resHt.allureLinks.issue) require.Equal(t, setTestCase, resHt.allureLinks.testCase) require.Equal(t, link, resHt.allureLinks.link) diff --git a/go.mod b/go.mod index 1f86f35..d10ab36 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.17 require ( github.com/PaesslerAG/jsonpath v0.1.1 github.com/moul/http2curl v1.0.0 - github.com/ozontech/allure-go/pkg/allure v0.6.3 - github.com/ozontech/allure-go/pkg/framework v0.6.17 + github.com/ozontech/allure-go/pkg/allure v0.6.4 + github.com/ozontech/allure-go/pkg/framework v0.6.18 github.com/stretchr/testify v1.7.1 github.com/xeipuuv/gojsonschema v1.2.0 ) diff --git a/go.sum b/go.sum index c0fd4bd..15c4702 100644 --- a/go.sum +++ b/go.sum @@ -14,10 +14,10 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7 github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= -github.com/ozontech/allure-go/pkg/allure v0.6.3 h1:+nGs+2Kq+XprmONt4xww+MEDjnShkLK6kPtfOknernY= -github.com/ozontech/allure-go/pkg/allure v0.6.3/go.mod h1:xyVZ+6tLDzQ4pr19eqLR0EckaI51kYUC1A5ihsDTygo= -github.com/ozontech/allure-go/pkg/framework v0.6.17 h1:XCnysk4udjqR4EzJzYFRvmTtwNDkyiLYBo4mnYi80C8= -github.com/ozontech/allure-go/pkg/framework v0.6.17/go.mod h1:RxbhHdppAf70AST+S0G3iMDxkHcNb11ygMaXISF3m1A= +github.com/ozontech/allure-go/pkg/allure v0.6.4 h1:lQ2NJSgl3sj/0oi4HTG+8EXkV1A+wWN7WIfDkOaBtmY= +github.com/ozontech/allure-go/pkg/allure v0.6.4/go.mod h1:xyVZ+6tLDzQ4pr19eqLR0EckaI51kYUC1A5ihsDTygo= +github.com/ozontech/allure-go/pkg/framework v0.6.18 h1:QoYFww5gMu3qPaoVDVetBa17ahKTHNYEhbyUIP+qYn8= +github.com/ozontech/allure-go/pkg/framework v0.6.18/go.mod h1:QNKRZHCSCxJHSBuJssp00Fc7EL5XvVX/IEJNSgxBN18= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/interface.go b/interface.go index fe74a40..462c751 100644 --- a/interface.go +++ b/interface.go @@ -33,12 +33,13 @@ type AllureInfoBuilder interface { type AllureLinksBuilder interface { SetIssue(issue string) AllureBuilder SetTestCase(testCase string) AllureBuilder - Link(link allure.Link) AllureBuilder + Link(link *allure.Link) AllureBuilder } type AllureLabelsBuilder interface { Feature(feature string) AllureBuilder Epic(epic string) AllureBuilder + AllureID(value string) AllureBuilder Tags(tags ...string) AllureBuilder ID(value string) AllureBuilder AddSuiteLabel(value string) AllureBuilder @@ -49,8 +50,8 @@ type AllureLabelsBuilder interface { Severity(value allure.SeverityType) AllureBuilder Owner(value string) AllureBuilder Lead(value string) AllureBuilder - Label(label allure.Label) AllureBuilder - Labels(labels ...allure.Label) AllureBuilder + Label(label *allure.Label) AllureBuilder + Labels(labels ...*allure.Label) AllureBuilder } // StepBuilder is a scope of methods for set step information diff --git a/provider.go b/provider.go index 87187db..c0df8d1 100644 --- a/provider.go +++ b/provider.go @@ -46,7 +46,7 @@ type logProvider interface { type stepProvider interface { Step(step *allure.Step) - WithNewStep(stepName string, step func(ctx provider.StepCtx), params ...allure.Parameter) + WithNewStep(stepName string, step func(ctx provider.StepCtx), params ...*allure.Parameter) } type attachmentProvider interface { @@ -55,7 +55,7 @@ type attachmentProvider interface { } type parametersProvider interface { - WithParameters(parameters ...allure.Parameter) + WithParameters(parameters ...*allure.Parameter) WithNewParameters(kv ...interface{}) } @@ -66,6 +66,7 @@ type infoAllureProvider interface { type labelsAllureProvider interface { ID(value string) + AllureID(value string) Epic(value string) AddSuiteLabel(value string) AddSubSuite(value string) @@ -77,12 +78,12 @@ type labelsAllureProvider interface { Severity(value allure.SeverityType) Owner(value string) Lead(value string) - Label(label allure.Label) - Labels(labels ...allure.Label) + Label(label *allure.Label) + Labels(labels ...*allure.Label) } type linksAllureProvider interface { SetIssue(issue string) SetTestCase(testCase string) - Link(link allure.Link) + Link(link *allure.Link) } diff --git a/test.go b/test.go index b2b22b4..e31ab63 100644 --- a/test.go +++ b/test.go @@ -84,14 +84,15 @@ type allureLabels struct { severity allure.SeverityType owner string lead string - label allure.Label - labels []allure.Label + label *allure.Label + labels []*allure.Label + allureID string } type allureLinks struct { issue string testCase string - link allure.Link + link *allure.Link } type allureStep struct {