ozontech / allure-go

Complete Allure provider in Go which doesn't overload the interface usage
https://t.me/allure_go_chat
Apache License 2.0
306 stars 33 forks source link

Add parametes for test body #18

Closed mirecl closed 2 years ago

mirecl commented 2 years ago

New feature: Parameters for test body

Add funcs:

Example test:

import (
    "fmt"
    "testing"

    "github.com/ozontech/allure-go/pkg/allure"
    "github.com/ozontech/allure-go/pkg/framework/provider"
    "github.com/ozontech/allure-go/pkg/framework/runner"
)

func TestSampleDemo(t *testing.T) {
    runner.Run(t, "My test", func(t provider.T) {
        t.Epic("Only Provider Demo")
        t.Feature("runner.RunTest")

        t.Title("Some Sample test")
        t.Description("allure-go allows you to use allure without suites")
        t.WithParameters(allure.NewParameter("host", "localhost")) // or t.WithNewParameters("host", "localhost")

        t.WithNewStep("Some nested step", func(ctx provider.StepCtx) {
            ctx.WithNewStep("Some inner step 1", func(ctx provider.StepCtx) {
                ctx.WithNewStep("Some inner step 1.1", func(ctx provider.StepCtx) {

                })
            })
            ctx.WithNewStep("Some inner step 2", func(ctx provider.StepCtx) {
                ctx.WithNewStep("Some inner step 2.1", func(ctx provider.StepCtx) {

                })
            })
        })
    }, "Sample", "Provider-only", "No provider initialization")
}

Result:

Снимок экрана 2022-07-27 в 18 03 10
koodeex commented 2 years ago

Nice! Didn't know that allure-report support parameters for test-body (I thought it was only for Steps :D)

Good job!

It will be great, if you will add additional method t.WithNewParameters(kv ...interface{}) Like here: https://github.com/ozontech/allure-go/blob/master/pkg/allure/step.go#L64

mirecl commented 2 years ago

@koodeex, done ✅ !

mirecl commented 2 years ago

@koodeex , @siller174 когда ожидать новый релиз с данной фичей?

koodeex commented 2 years ago

Мерджим и релизим

koodeex commented 2 years ago

@mirecl release tags: v0.6.14, pkg/framework/v0.6.14, pkg/allure/v0.6.2

To update:

go get github.com/ozontech/allure-go/pkg/allure@v0.6.2
go get github.com/ozontech/allure-go/pkg/framework@v0.6.14
go get github.com/ozontech/allure-go@v0.6.14