-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from dailymotion/aftertest_on_fail_panic
Resolved #30
- Loading branch information
Showing
18 changed files
with
261 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
example/example_before_panic_test.go → ...ure_examples/example_before_panic_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package example | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
"github.com/pkg/errors" | ||
"testing" | ||
) | ||
|
||
func TestBreakAllure(t *testing.T) { | ||
allure.Test(t, allure.Description("Test with Allure error in it"), allure.Action(func() { | ||
allure.Step(allure.Description("Step 1"), allure.Action(func() {})) | ||
allure.Step(allure.Description("Step 2"), allure.Action(func() { | ||
allure.Break(errors.New("Error message")) | ||
})) | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
"github.com/pkg/errors" | ||
"testing" | ||
) | ||
|
||
func TestBreakNowAllure(t *testing.T) { | ||
allure.Test(t, allure.Description("Test with Allure error in it"), allure.Action(func() { | ||
allure.BreakNow(errors.New("A more serious error")) | ||
allure.Step(allure.Description("Step you're not supposed to see"), allure.Action(func() {})) | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
"github.com/pkg/errors" | ||
"testing" | ||
) | ||
|
||
func TestFailAllure(t *testing.T) { | ||
allure.Test(t, allure.Description("Test with Allure error in it"), allure.Action(func() { | ||
allure.Step(allure.Description("Step 1"), allure.Action(func() { | ||
})) | ||
allure.Step(allure.Description("Step 2"), allure.Action(func() { | ||
allure.Fail(errors.New("Error message")) | ||
})) | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
"github.com/pkg/errors" | ||
"testing" | ||
) | ||
|
||
func TestFailNowAllure(t *testing.T) { | ||
allure.Test(t, allure.Description("Test with Allure error in it"), allure.Action(func() { | ||
allure.FailNow(errors.New("A more serious error")) | ||
allure.Step(allure.Description("Step you're not supposed to see"), allure.Action(func() {})) | ||
})) | ||
} |
2 changes: 1 addition & 1 deletion
2
example/example_panic_handling_test.go → ...e_examples/example_panic_handling_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package example | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
|
2 changes: 1 addition & 1 deletion
2
example/example_panic_in_step_test.go → ...re_examples/example_panic_in_step_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package example | ||
package failure_examples | ||
|
||
import ( | ||
"github.com/dailymotion/allure-go" | ||
|
23 changes: 23 additions & 0 deletions
23
example/failure_examples/teardown/example_after_break_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestAfterBreak(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.Break(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
|
||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
} |
23 changes: 23 additions & 0 deletions
23
example/failure_examples/teardown/example_after_breaknow_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestAfterBreakNow(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.BreakNow(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
|
||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
} |
23 changes: 23 additions & 0 deletions
23
example/failure_examples/teardown/example_after_fail_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestAfterFail(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.Fail(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
|
||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
} |
23 changes: 23 additions & 0 deletions
23
example/failure_examples/teardown/example_after_failnow_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestAfterFailNow(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.FailNow(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
|
||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
} |
24 changes: 24 additions & 0 deletions
24
example/failure_examples/teardown/example_deferred_after_break_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestDeferredAfterBreak(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.Break(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
defer func() { | ||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
}() | ||
} |
24 changes: 24 additions & 0 deletions
24
example/failure_examples/teardown/example_deferred_after_breaknow_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestDeferredAfterBreakNow(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.BreakNow(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
defer func() { | ||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
}() | ||
} |
24 changes: 24 additions & 0 deletions
24
example/failure_examples/teardown/example_deferred_after_fail_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestDeferredAfterFail(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.Fail(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
defer func() { | ||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
}() | ||
} |
24 changes: 24 additions & 0 deletions
24
example/failure_examples/teardown/example_deferred_after_failnow_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package teardown | ||
|
||
import ( | ||
"errors" | ||
"github.com/dailymotion/allure-go" | ||
"testing" | ||
) | ||
|
||
func TestDeferredAfterFailNow(t *testing.T) { | ||
allure.Test(t, | ||
allure.Description("Break now"), | ||
allure.Action(func() { | ||
//panic("panic at the before statement! (disco)") | ||
allure.FailNow(errors.New("break now statement")) | ||
|
||
allure.Step(allure.Description("Step after break"), | ||
allure.Action(func() {})) | ||
})) | ||
defer func() { | ||
allure.AfterTest(t, allure.Action(func() { | ||
allure.Step(allure.Description("Running after a panic")) | ||
})) | ||
}() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters