Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions examples/suite_demo/fails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ func (s *FailsDemoSuite) TestXSkipFail(t provider.T) {
t.Require().Equal(1, 2, "Assertion Failed")
}

func (s *FailsDemoSuite) TestXSkipFailInStep(t provider.T) {
t.Title("This test skipped by assert inside step")
t.Description(`
This Test will be skipped with assert Error inside a step.
Error text: Assertion Failed`)
t.Tags("fail", "xskip", "assertions")

t.XSkip()
t.WithNewStep("Failed parent step", func(ctx provider.StepCtx) {
ctx.WithNewStep("Failed child step", func(ctx provider.StepCtx) {
ctx.Require().Equal(1, 2, "Failed inside step")
})
})
}

func (s *FailsDemoSuite) TestAssertionFailNoMessage(t provider.T) {
t.Title("This test failed by assert without message")
t.Description(`
Expand Down
13 changes: 13 additions & 0 deletions pkg/framework/core/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ func (c *Common) FailNow() {
r.Status = allure.Failed
}
})

if c.xSkip {
c.registerError("[XSkip] test marked as xskip but failed")
c.TestingT.Skip()
return
}

c.TestingT.FailNow()
}

Expand All @@ -235,6 +242,12 @@ func (c *Common) BrokenNow() {
r.Status = allure.Broken
})

if c.xSkip {
c.registerError("[XSkip] test marked as xskip but broken")
c.TestingT.Skip()
return
}

c.TestingT.FailNow()
}

Expand Down
Loading