Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-84] support helper #85

Merged
merged 6 commits into from
Mar 20, 2024
Merged

[ISSUE-84] support helper #85

merged 6 commits into from
Mar 20, 2024

Conversation

siller174
Copy link
Collaborator

@siller174 siller174 commented Mar 16, 2024

  1. Support Helper() in StepCtx
  2. Add helper to Error() and ErrorF
    This is needed for correct tracing inside the test.

Test: bla_test.go

func TestName(t *testing.T) {
	runner.Run(t, "Single test with allure-go Runner", func(t provider.T) {
		t.Epic("Compare with allure-go")
		t.Description("New Test Description")
		t.WithNewStep("Step description", func(ctx provider.StepCtx) {
			ctx.Errorf("Error message")
		})
	})
}

func TestName1(t *testing.T) {
	runner.Run(t, "Single test with allure-go Runner", func(t provider.T) {
		t.Errorf("Error message")
	})
}

Logs without helper:

=== RUN   TestName
=== RUN   TestName/Single_test_with_allure-go_Runner
    common.go:125: Error message
--- FAIL: TestName (0.00s)
    --- FAIL: TestName/Single_test_with_allure-go_Runner (0.00s)


=== RUN   TestName1
=== RUN   TestName1/Single_test_with_allure-go_Runner
    common.go:125: Error message
--- FAIL: TestName1 (0.00s)
    --- FAIL: TestName1/Single_test_with_allure-go_Runner (0.00s)

Trace from allure: common.go:125: Error message and common.go:125: Error message

Log with helper:

=== RUN   TestName
=== RUN   TestName/Single_test_with_allure-go_Runner
    bla_test.go:15: Error message
--- FAIL: TestName (0.00s)
    --- FAIL: TestName/Single_test_with_allure-go_Runner (0.00s)


=== RUN   TestName1
=== RUN   TestName1/Single_test_with_allure-go_Runner
    bla_test.go:22: Error message 
--- FAIL: TestName1 (0.00s)
    --- FAIL: TestName1/Single_test_with_allure-go_Runner (0.00s)

Trace from test: bla_test.go:15: Error message and bla_test.go:22: Error message

@siller174 siller174 requested a review from koodeex March 16, 2024 22:00
@koodeex koodeex merged commit dd7f2ab into master Mar 20, 2024
3 checks passed
@koodeex koodeex deleted the issue-84 branch March 20, 2024 12:43
@siller174 siller174 mentioned this pull request Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants