Skip to content

Commit

Permalink
Merge pull request #24 from ozontech/issue-23
Browse files Browse the repository at this point in the history
[Issue-23] Update allure-go
  • Loading branch information
siller174 authored Sep 2, 2022
2 parents c7f2aef + 8e06b25 commit 337b6fc
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 25 deletions.
7 changes: 5 additions & 2 deletions allure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
Expand All @@ -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 {
Expand Down
12 changes: 9 additions & 3 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -123,6 +124,7 @@ func TestHTTPTestMaker(t *testing.T) {
Story(story).
Tag(tag).
Severity(allure.CRITICAL).
AllureID(allureID).
Owner(owner).
Lead(lead).
Label(label).
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
7 changes: 4 additions & 3 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -55,7 +55,7 @@ type attachmentProvider interface {
}

type parametersProvider interface {
WithParameters(parameters ...allure.Parameter)
WithParameters(parameters ...*allure.Parameter)
WithNewParameters(kv ...interface{})
}

Expand All @@ -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)
Expand All @@ -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)
}
7 changes: 4 additions & 3 deletions test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 337b6fc

Please sign in to comment.