Complete Allure provider in Go which doesn't overload the interface usage

allure-testify

Allure-Testify - проект, предоставляющий полноценный провайдер allure в go, без перегрузки интерфейса использования.
Проект начинался как форк от testify, но со временем обзавелся своим раннером и своими особенностями.

Other Languages README.md

Head of contents

Features

pkg/allure

Пакет, содержащий модель данных для Allure.
Полный список allure-объектов:

  • Attachment
  • Container
  • Label
  • Link
  • Parameter
  • Result
  • Step

Предоставление отдельного пакета позволяет кастомизировать работу с allure.
Подробно можно почитать тут.

pkg/provider.T

Враппер контекста теста (testing.T).
Основные преимущества и особенности:

  • Имеет свой раннер тестов (T.Run(testName string, test func(t *provider.T), tags ...string)), что позволяет использовать преимущества библиотеки testing.
  • Функциональность аналогов на других языках, без потери удобства и простоты использования.
  • Полностью интегрирован с allure. Ваши go-тесты еще никогда не были такими информативными!

Подробно можно почитать тут.

pkg/framework/runner

Пакет предоставляет функции для запуска тестовых структур (Suite) и отдельных тестов.
Тесты, запущенные с помощью этих функций по окончанию исполнения будут создавать allure отчет.
Подробно можно почитать тут.

pkg/framework/suite

Пакет предоставляет структуру Suite, в которой можно описывать тесты, группируя их в тест-комплекты.
Это может быть удобным, если у вас много разных тестов и вам сложно в них ориентироваться, без дополнительных "уровней вложения" вызовов тестов.
Подробно можно почитать тут.

Getting Started

  1. Установить пакет
go get github.com/koodeex/allure-testify
  1. Если Вы уже используете testify, то нужно заменить импорты
package tests

import (
	"github.com/stretchr/testify/suite"
)

на

package tests

import (
	"github.com/koodeex/allure-testify/pkg/framework/suite"
)
  1. Заменить функции
  • SetupSuite -> BeforeAll
  • SetupTest -> BeforeEach
  • TearDownTest -> AfterEach
  • TearDownSuite -> AfterAll
  1. Запустить go test!

Demo

Demo Installation

  git clone https://github.com/koodeex/allure-testify.git

Run Examples

make demo

How to use

Installation

go get github.com/koodeex/allure-testify

Configure Behavior

Путь до allure отчетов собирается из двух глобальных переменных $ALLURE_OUTPUT_FOLDER/$ALLURE_OUTPUT_PATH

  • ALLURE_OUTPUT_FOLDER - это имя папки, в которую будут складываться allure-отчеты (по умолчанию - allure-results).
  • ALLURE_OUTPUT_PATH - это путь, в котором будет создана ALLURE_OUTPUT_FOLDER (по умолчанию это корневая папка запуска тестов).

Так же, можно указать несколько глобальных конфигураций, для интеграции с вашей TMS или Task Tracker:

  • ALLURE_ISSUE_PATTERN - Указывает урл-паттерн для ваших Issues. Не имеет значения по умолчанию. Обязательно должен содержать %s.

Если ALLURE_ISSUE_PATTERN не задан, ссылка будет читаться целиком.

Пример:

package provider_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
	"github.com/koodeex/allure-testify/pkg/provider"
)

func TestSampleDemo(t *testing.T) {
	runner.RunTest(t, "Just Link", func(t *provider.T) {
		t.SetIssue("https://pkg.go.dev/github.com/stretchr/testify")
	})

	runner.RunTest(t, "With Pattern", func(t *provider.T) {
		_ = os.Setenv("ALLURE_ISSUE_PATTERN", "https://pkg.go.dev/github.com/stretchr/%s")
		t.SetIssue("testify")
	})
}
  • ALLURE_TESTCASE_PATTERN - Указывает урл-паттерн для ваших TestCases. Не имеет значения по умолчанию. Обязательно должен содержать %s.

Если ALLURE_TESTCASE_PATTERN не задан, ссылка будет читаться целиком.

Пример:

package provider_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
	"github.com/koodeex/allure-testify/pkg/provider"
)

func TestSampleDemo(t *testing.T) {
	runner.RunTest(t, "Just Link", func(t *provider.T) {
		t.SetTestCase("https://pkg.go.dev/github.com/stretchr/testify")
	})

	runner.RunTest(t, "With Pattern", func(t *provider.T) {
		_ = os.Setenv("ALLURE_TESTCASE_PATTERN", "https://pkg.go.dev/github.com/stretchr/%s")
		t.SetTestCase("testify")
	})
}
  • ALLURE_LAUNCH_TAGS - Прокидывает список тэгов, которые будут применены к каждому тесту по умолчанию. Не имеет значения по умолчанию.

Совет: ALLURE_LAUNCH_TAGS - очень удобен в использовании с CI/CD. Например, в нем можно определять группы тестов по вашим ci-jobs или же прокидывать имя ветки.

Configure Test

  1. Используя пакет runner:
package provider_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
	"github.com/koodeex/allure-testify/pkg/provider"
)

func TestSampleDemo(t *testing.T) {
	runner.RunTest(t, "My test", func(t *provider.T) {
		// Test Body
	})
}
  1. Используя декларирование контекста TestRunner:
package provider_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
)

func TestOtherSampleDemo(realT *testing.T) {
	r := runner.NewTestRunner(realT)
	r.Run("My test", func(t *provider.T) {
		// Test Body
	})
}

Второй вариант позволит использовать BeforeEach/AfterEach:

package provider_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
)

func TestOtherSampleDemo(realT *testing.T) {
	r := runner.NewTestRunner(realT)
	r.WithBeforeEach(func(t *provider.T) {
		// Before Each body 
	})
	r.WithAfterEach(func(t *provider.T) {
		// After Each body
	})
	r.Run("My test", func(t *provider.T) {
		// Test Body
	})
}

Так же сохранена особенность библиотеки testing, позволяющая запускать тесты из других тестов:

package provider_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
	"github.com/koodeex/allure-testify/pkg/provider"
)

func TestOtherSampleDemo(realT *testing.T) {
	r := runner.NewTestRunner(realT)
	r.Run("My test", func(t *provider.T) {
		// Test Body
		t.WithBeforeTest(func(t *provider.T) {
			// inner Before Each body
		})
		t.WithAfterTest(func(t *provider.T) {
			// inner After Each body
		})
		t.Run("My test", func(t *provider.T) {
			// inner test body
		})
	})
}

Configure Suite

Чтобы группировать тесты в тест-комплекты, необходимо:

  1. объявить структуру, методами которой будут ваши тесты
package suite_demo

type DemoSuite struct {
}
  1. расширить объявленную структуру структурой suite.Suite
package suite_demo

import "github.com/koodeex/allure-testify/pkg/framework/suite"

type DemoSuite struct {
	suite.Suite
}
  1. описать тесты
package suite_demo

import "github.com/koodeex/allure-testify/pkg/framework/suite"

type DemoSuite struct {
	suite.Suite
}

func (s *DemoSuite) TestSkip() {
	s.Epic("Demo")
	s.Feature("Suites")
	s.Title("My first test")
	s.Description(`
		This test will be attached to the suite DemoSuite`)
}
  1. Запустить тесты.

Для этого нужно описать функцию, которая запустить Ваш тест и вызвать runner.RunSuite:

package suite_demo

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/runner"
	"github.com/koodeex/allure-testify/pkg/framework/suite"
)

type DemoSuite struct {
	suite.Suite
}

func (s *DemoSuite) TestSkip() {
	s.Epic("Demo")
	s.Feature("Suites")
	s.Title("My first test")
	s.Description(`
		This test will be attached to the suite DemoSuite`)
}

func TestSkipDemo(t *testing.T) {
	t.Parallel()
	runner.RunSuite(t, new(SkipDemoSuite))
}

И запустить тесты с помощью go test

go test ${TEST_PATH}

Тогда в корневой папке тестов по окончанию прогона будет проинициализирована папка allure-results, содержащая в себе allure-отчеты.

Configure Your Report

Allure-Testify предоставляет широкие возможности взаимодействия с allure.
Большинство действий осуществляется с помощью структуры provider.T, являющейся оберткой над testing.T.
Так же структура suite.Suite позволяет использовать интерфейс Suite для взаимодействия с allure-report.

Test Info

Полный список поддерживаемых методов для проставления информации о методе:

  • *T.Title
  • *T.Description

Note: По умолчанию имя теста ставится в соответствии с именем функции теста.

Labels

Полный список поддерживаемых лейблов:

  • *T.Epic
  • *T.Feature
  • *T.Story
  • *T.ID
  • *T.Severity
  • *T.ParentSuite
  • *T.Suite
  • *T.SubSuite
  • *T.Package
  • *T.Thread
  • *T.Host
  • *T.Tag
  • *T.Framework
  • *T.Language
  • *T.Owner
  • *T.Lead

Более подробно про методы можно почитать здесь

Default label values
Label Default Value
ParentSuite - Для suite.Suite ставится имя функции, в которой suite был запущен.

- Для независимых тестов - по умолчанию не ставится, однако если тест был вызван внутри другого теста, в этом лейбле будет указан тест, запустивший родительский для текущего тест.
Suite - Для suite.Suite ставится имя suite, которому текущий тест принадлежит.

- Для независимого теста - имя теста - родителя (из которого был запущен текущий тест).
Package Пакет, в котором были запущены тесты
Thread Ставится Result.FullName [1].
Host os.Host()
Framework [email protected]
Language runtime.Version()

NOTES: [1] - Это Knowing Issue - в golang пока не представляется целесообразным (или возможным адекватными способами) пытаться достать имя текущей goroutine, как и невозможно задать ей имя.


Links

Полный список поддерживаемых действий:

  • *T.SetIssue
  • *T.SetTestCase
  • *T.Link

Более подробно про методы можно почитать здесь.

Про переменные, с которыми можно взаимодействовать для упрощения работы было указано выше.

Allure Steps

Полный список поддерживаемых действий:

  • *T.Step - добавляет к отчету переданный Step.
  • *T.NewStep - создает новый пустой Step с переданным именем и добавляет его к отчету.
  • *T.InnerStep - добавляет к отчету переданный Step, проставив переданный ParentStep как родительский.
  • *T.NewInnerStep - создает новый пустой Step с переданным именем и добавляет его к отчету, проставляет переданный ParentStep как родительский и добавляет его к отчету.
  • *T.WithStep - оборачивает переданную в f функцию переданным Step и добавляет Step к отчету.
  • *T.WithNewStep - создает новый Step, оборачивает переданную в f функцию созданным Step и добавляет его к отчету.

Nested-Only Functions

  • *T.AddAttachmentToNested - добавляет к вложенному шагу Attachment
  • *T.AddParameterToNested - добавляет к вложенному шагу Parameter
  • *T.AddParametersToNested - добавляет к вложенному шагу все элементы массива Parameter
  • *T.AddNewParameterToNested - инициализирует новый Parameter и добавляет его к вложенному шагу
  • *T.AddNewParametersToNested - инициализирует новый массив Parameter и добавляет все его элементы к вложенному шагу

Note: Функции с суффиксом ToNested могут быть вызваны ТОЛЬКО внутри функции WithStep/WithNewStep. В противном случае ничего не произойдет.

Allure Attachments

Полный список поддерживаемых действий:

  • *T.Attachment - добавляет к текущему тесту Attachment

Test Behaviour

Полный список поддерживаемых действий:

  • *T.Skip - пропускает текущий тест. В статус отчета будет указан переданный текст.
  • *T.Errorf - помечает выбранный тест, как Failed. В статус отчета будет прикреплен переданный текст,
  • *T.XSkip - пропускает выбранный тест, если в процессе его исполнения вызывается *T.Error/*T.Errorf (например, падает assert)

Forward to suite.Suite

Полный список поддерживаемых действий:

  • Test Info
    • *Suite.Title
    • *Suite.Description
  • Allure Labels
    • *Suite.Epic
    • *Suite.Feature
    • *Suite.Story
    • *Suite.ID
    • *Suite.Severity
    • *Suite.ParentSuite
    • *Suite.Suite
    • *Suite.SubSuite
    • *Suite.Package
    • *Suite.Thread
    • *Suite.Host
    • *Suite.Tag
    • *Suite.Framework
    • *Suite.Language
    • *Suite.Owner
    • *Suite.Lead
  • Allure Links
    • *Suite.SetIssue
    • *Suite.SetTestCase
    • *Suite.Link
  • Allure Steps
    • *Suite.Step
    • *Suite.NewStep
    • *Suite.InnerStep
    • *Suite.InnerNewStep
    • *Suite.WithStep
    • *Suite.WithNewStep
  • Nested Only Functions
    • *Suite.AddNestedAttachment
    • *Suite.AddParameterToNested
    • *Suite.AddParametersToNested
    • *Suite.AddNewParameterToNested
    • *Suite.AddNewParametersToNested
  • Allure Attachments
    • *Suite.Attachment

Documentation

Подробная документация по каждому публичному пакету может быть найдена в каталоге этого пакета.

Examples

Test with nested steps:

Код теста:

package examples

import (
	"github.com/koodeex/allure-testify/pkg/framework/suite"
)

type StepTreeDemoSuite struct {
	suite.Suite
}

func (s *StepTreeDemoSuite) TestInnerSteps() {
	s.Epic("Demo")
	s.Feature("Inner Steps")
	s.Title("Simple Nesting")
	s.Description(`
		Step A is parent step for Step B and Step C
		Call order will be saved in allure report
		A -> (B, C)`)

	s.Tags("Steps", "Nesting")

	s.WithNewStep("Step A", func() {
		s.NewStep("Step B")
		s.NewStep("Step C")
	})
}

Вывод в Allure:

Test with Attachment

Код теста:

package examples

import (
	"encoding/json"

	"github.com/koodeex/allure-testify/pkg/allure"
	"github.com/koodeex/allure-testify/pkg/framework/suite"
)

type JSONStruct struct {
	Message string `json:"message"`
}

type AttachmentTestDemoSuite struct {
	suite.Suite
}

func (s *AttachmentTestDemoSuite) TestAttachment() {
	s.Epic("Demo")
	s.Feature("Attachments")
	s.Title("Test Attachments")
	s.Description(`
		Test's test body and all steps inside can contain attachments`)

	s.Tags("Attachments", "BeforeAfter", "Steps")

	attachmentText := `THIS IS A TEXT ATTACHMENT`
	s.Attachment(allure.NewAttachment("Text Attachment if TestAttachment", allure.Text, []byte(attachmentText)))

	step := allure.NewSimpleStep("Step A")
	var ExampleJson = JSONStruct{"this is JSON message"}
	attachmentJSON, _ := json.Marshal(ExampleJson)
	step.Attachment(allure.NewAttachment("Json Attachment for Step A", allure.JSON, attachmentJSON))
	s.Step(step)
}

Вывод в Allure:

Run few parallel suites

Код теста:

package examples

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/suite"
)

type TestRunningDemoSuite struct {
	suite.Suite
}

func (s *TestRunningDemoSuite) TestBeforesAfters() {
	t := s.T()
	t.Parallel()
	// use RunInner to run suite of tests
	s.RunSuite(t, new(BeforeAfterDemoSuite))
}

func (s *TestRunningDemoSuite) TestFails() {
	t := s.T()
	t.Parallel()
	s.RunSuite(t, new(FailsDemoSuite))
}

func (s *TestRunningDemoSuite) TestLabels() {
	t := s.T()
	t.Parallel()
	s.RunSuite(t, new(LabelsDemoSuite))
}

func TestRunDemo(t *testing.T) {
	// use RunSuites to run suite of suites
	suite.RunSuite(t, new(TestRunningDemoSuite))
}

Вывод в Allure:

Setup hooks

Код теста:

package examples

import (
	"testing"

	"github.com/koodeex/allure-testify/pkg/framework/suite"
)

type BeforeAfterDemoSuite struct {
	suite.Suite
}

func (s *BeforeAfterDemoSuite) BeforeEach() {
	s.NewStep("Before Test Step")
}

func (s *BeforeAfterDemoSuite) AfterEach() {
	s.NewStep("After Test Step")
}

func (s *BeforeAfterDemoSuite) BeforeAll() {
	s.NewStep("Before suite Step")
}

func (s *BeforeAfterDemoSuite) AfterAll() {
	s.NewStep("After suite Step")
}

func (s *BeforeAfterDemoSuite) TestBeforeAfterTest() {
	s.Epic("Demo")
	s.Feature("BeforeAfter")
	s.Title("Test wrapped with SetUp & TearDown")
	s.Description(`
		This test wrapped with SetUp and TearDown containers.`)

	s.Tags("BeforeAfter")
}

func TestBeforesAfters(t *testing.T) {
	t.Parallel()
	suite.RunSuite(t, new(BeforeAfterDemoSuite))
}

Вывод в Allure:

XSkip

Код теста:

package examples

import (
	"testing"

	"github.com/stretchr/testify/require"

	"github.com/koodeex/allure-testify/pkg/framework/suite"
)

type DemoSuite struct {
	suite.Suite
}

func (s *DemoSuite) TestXSkipFail() {
	s.Title("This test skipped by assert with message")
	s.Description(`
		This Test will be skipped with assert Error.
		Error text: Assertion Failed`)
	s.Tags("fail", "xskip", "assertions")

	t := s.T()
	t.XSkip()
	require.Equal(t, 1, 2, "Assertion Failed")
}

func TestDemoSuite(t *testing.T) {
	t.Parallel()
	suite.RunSuite(t, new(DemoSuite))
}

Вывод в Allure:

Owner
Ozon Tech
ozon.ru open source projects
Ozon Tech
Comments
  • Фильтрация тестов в go

    Фильтрация тестов в go

    Добрый день, Настраиваем у себя тестопс в связке с go и gitlab, столкнулись с такой проблемой что не работает фильтрация тестов при запуске. Наш пайплайн:

    stages:
      - test
    
    variables:
      ALLURE_LAUNCH_NAME: "${CI_PROJECT_NAME} - ${CI_COMMIT_SHORT_SHA}"
      ALLURE_LAUNCH_TAGS: "regular, ${CI_COMMIT_REF_NAME}"
      ALLURE_TESTPLAN_PATH: "./testplan.json"
      ALLURE_RESULTS: "allure-results"
    
    test:
      image: golang:latest
      stage: test
      before_script:
        - wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O /usr/bin/allurectl
        - chmod +x /usr/bin/allurectl
    
        - allurectl job-run start
        - allurectl job-run plan --output-file ${ALLURE_TESTPLAN_PATH}
    
      script:
        - mkdir -p allure-results
        - allurectl watch --results ${ALLURE_RESULTS} -- go test -v
      after_script:
        - pkill allurectl
    

    При запуске пайплайна есть строки:

    $ allurectl job-run plan --output-file ${ALLURE_TESTPLAN_PATH}
    Save test plan for [7] to file [/builds/test-framework-allure-testops/testplan.json]
    
    Save test plan for [7] to file [/builds/test-framework-allure-testops/tests/acl]
    Running command:  go [test -v]
    

    Из этого сделал вывод что интеграция настроена корректно и проблема непосредственно в allurectl job-run plan --output-file ${ALLURE_TESTPLAN_PATH} что подтвердил Артем Ерошенко

    Просьба взять на доработку

  • Add parametes for test body

    Add parametes for test body

    New feature: Parameters for test body

    Add funcs:

    • WithParameters(params ...allure.Parameter)
    • WithNewParameters(kv ...interface{})

    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

  • Error is not included in the allure report if it is in the BeforeAll hook.

    Error is not included in the allure report if it is in the BeforeAll hook.

    Describe the bug If during the initialization of the suite you add a step with a check that will fall, the entire suite in the allure report is simply ignored. The information in the console is displayed correctly

    To Reproduce

    import (
    	"testing"
    
    	"github.com/ozontech/allure-go/pkg/framework/provider"
    	"github.com/ozontech/allure-go/pkg/framework/suite"
    )
    
    type BeforeAfterDemoSuite struct {
    	suite.Suite
    }
    
    func (s *BeforeAfterDemoSuite) BeforeAll(t provider.T) {
    	t.WithNewStep("Before suite Step", func(sCtx provider.StepCtx) {
    		sCtx.Require().Equal(1, 2, "lol")
    	})
    }
    
    func (s *BeforeAfterDemoSuite) TestBeforeAfterTest(t provider.T) {
    	t.Epic("Demo")
    	t.Feature("BeforeAfter")
    	t.Title("Test wrapped with SetUp & TearDown")
    	t.Description(`
    		This test wrapped with SetUp and TearDown containert.`)
    
    	t.Tags("BeforeAfter")
    }
    
    func TestBeforesAfters(t *testing.T) {
    	t.Parallel()
    	suite.RunSuite(t, new(BeforeAfterDemoSuite))
    }
    

    Expected behavior Display the suite in the report, with an error in the setup and a skipped body of tests.

  • Странная работа метода t.WithNewStep, t.Step

    Странная работа метода t.WithNewStep, t.Step

    Добрый день

    Сегодня попробовал использовать ваш проект для написания unit тестов, в результате проб возник следующий вопрос: если я в тесте делаю Step (через WithNewStep) и в переданной функции тест фейлится (require не проходит), то в allure отчете все равно данный шаг помечается как успешный. Пример кода, и отчета прилагаю:

    
    type SomeSuite struct {
    	suite.Suite
    }
    
    func (s *SomeSuite) TestSome(t provider.T) {
    	t.WithNewStep("Step 1", func(sCtx provider.StepCtx) {
    		require.Equal(t, 2, 2)
    	})
    	t.WithNewStep("Шаг 2", func(sCtx provider.StepCtx) {
    		require.Equal(t, 2, 3)
    	})
    	t.WithNewStep("Шаг 3", func(sCtx provider.StepCtx) {
    		require.Equal(t, 2, 2)
    	})
    
    }
    
    func TestSkipDemo(t *testing.T) {
    	suite.RunSuite(t, new(SomeSuite))
    }
    

    Аналогично если делать t.Step.

    133a9d3f-db0d-11ec-9001-bce92f7d8cfc-result.zip

    Подскажите, это ожидаемое поведение, или же нет?

  • Test setup steps logged in Precondition Allure block

    Test setup steps logged in Precondition Allure block

    Is your feature request related to a problem? Please describe. Now days all test setup steps logged in test steps block

    Describe the solution you'd like I want something like WithTestSetup method in provider.T interface for logging into preconditions block

  • Add parameterize semantics

    Add parameterize semantics

    Describe the solution you'd like Parametrization semantics without loops

    Additional context Add test generation based on test cases. Examples:

  • Add full support of testing TB inteface

    Add full support of testing TB inteface

    add support of testing.TB

    type TB interface {
    	Cleanup(func())
    	Error(args ...any)
    	Errorf(format string, args ...any)
    	Fail()
    	FailNow()
    	Failed() bool
    	Fatal(args ...any)
    	Fatalf(format string, args ...any)
    	Helper()
    	Log(args ...any)
    	Logf(format string, args ...any)
    	Name() string
    	Setenv(key, value string)
    	Skip(args ...any)
    	SkipNow()
    	Skipf(format string, args ...any)
    	Skipped() bool
    	TempDir() string
    }
    
  • Documentation mistakes in examples for the suite configuration

    Documentation mistakes in examples for the suite configuration

    There are few documentation mistakes in this example for the suite configuration:

    package suite_demo
    
    import (
    	"testing"
    
    	"github.com/ozontech/allure-go/pkg/framework/provider"
    	"github.com/ozontech/allure-go/pkg/framework/runner"
        "github.com/ozontech/allure-go/pkg/framework/suite"
    )
    
    type DemoSuite struct {
    	suite.Suite
    }
    
    func (s *DemoSuite) TestSkip(t provider.T) {
    	t.Epic("Demo")
    	t.Feature("Suites")
    	t.Title("My first test")
    	t.Description(`
    		This test will be attached to the suite DemoSuite`)
    }
    
    func TestSkipDemo(t *testing.T) {
    	t.Parallel()
    	runner.RunSuite(t, new(SkipDemoSuite))
    }
    

    Seems the TestSkipDemo function should be like that:

    func TestSkipDemo(t *testing.T) {
    	t.Parallel()
    	suite.RunSuite(t, new(DemoSuite))
    }
    
    • new(DemoSuite) instead of the new(SkipDemoSuite) cause the SkipDemoSuite struc doesn't exist in the example.
    • suite.RunSuite instead of the runner.RunSuite cause no any RunSuite method for the runner

    Additional info

    Just a picture with the current code example:

    image

  • [Draft] V050

    [Draft] V050

    Massive refactoring of architecture and fixing a lot of issues

    New Features:

    1. Async tests in suites
    2. Async steps everywhere
    3. BeforeAll/AfterAll in runner object
    4. testify's Asserts can be natively wrapped with allure steps
    5. module framework was moved to provider package
  • Deadlock in async steps

    Deadlock in async steps

    Describe the bug

    1. WithNewAsyncStep in WithNewAsyncStep will cause deadlock and tests will never finish.

    2. WithNewAsyncStep in step won't be executed async

    To Reproduce

    1. example
    package my_suite
    
    import (
    	"github.com/ozontech/allure-go/pkg/framework/provider"
    )
    
    func (s *Suite) TestSome3(t provider.T) {
    	t.Parallel()
    
    	t.WithNewStep("sync-step1", func(sCtx provider.StepCtx) {
    		sCtx.WithNewAsyncStep("sync-step1-async-step-1", func(sCtx provider.StepCtx) {
    			sCtx.WithNewAsyncStep("sync-step1-async-step-1-step1", func(sCtx provider.StepCtx) {
    			})
    		})
    	})
    }
    
    package my_suite
    
    import (
    	"time"
    
    	"github.com/ozontech/allure-go/pkg/framework/provider"
    )
    
    func (s *Suite) TestSome3(t provider.T) {
    	t.Parallel()
    
    	startedAt := time.Now()
    	timeSinceStart := func() int64 {
    		return int64(time.Since(startedAt).Round(time.Second).Seconds())
    	}
    	sleepDuration := 5 * time.Second
    
    	t.WithNewStep("sync-step1", func(sCtx provider.StepCtx) {
    		sCtx.Logf("sync-step1. start: %d", timeSinceStart())
    		time.Sleep(sleepDuration)
    		sCtx.Logf("sync-step1. finish: %d", timeSinceStart())
    
    		sCtx.WithNewAsyncStep("sync-step1-async-step-1", func(sCtx provider.StepCtx) {
    			sCtx.Logf("sync-step1-async-step-1. start: %d", timeSinceStart())
    			time.Sleep(sleepDuration)
    			sCtx.Logf("sync-step1-async-step-1. finish: %d", timeSinceStart())
    		})
    		sCtx.WithNewAsyncStep("sync-step1-async-step-2", func(sCtx provider.StepCtx) {
    			sCtx.Logf("sync-step1-async-step-2. start: %d", timeSinceStart())
    			time.Sleep(sleepDuration)
    			sCtx.Logf("sync-step1-async-step-2. finish: %d", timeSinceStart())
    		})
    	})
    
    	t.WithNewStep("sync-step2", func(sCtx provider.StepCtx) {
    		sCtx.Logf("sync-step2. start: %d", timeSinceStart())
    		time.Sleep(sleepDuration)
    		sCtx.Logf("sync-step2. finish: %d", timeSinceStart())
    	})
    }
    

    output

        step_context.go:104: sync-step1. finish: 5
        step_context.go:104: sync-step1-async-step-1. start: 5
        step_context.go:104: sync-step1-async-step-1. finish: 10
        step_context.go:104: sync-step1-async-step-2. start: 10
        step_context.go:104: sync-step1-async-step-2. finish: 15
        step_context.go:104: sync-step2. start: 15
        step_context.go:104: sync-step2. finish: 20
    

    Expected behavior

    1. No deadlock
    2. Async steps
  • Release/issue 29

    Release/issue 29

    Fixed:

    • parametrized naming (now ParamNameNoPrefix_param)
    • result fileds now pointers (label, parameter)
    • reworked appending labels mechanic (now duplicates now for unique labels)
  • Broken step results in a successful run

    Broken step results in a successful run

    Describe the bug (Probably related to https://github.com/ozontech/allure-go/issues/4)

    A single test with a broken step results in a passed test.

    The test

    func Test_AllureExample(t *testing.T) {
    	runner.Run(t, "Allure demo", func(t provider.T) {
    		t.WithNewStep("First step", func(sCtx provider.StepCtx) {
    			sCtx.Logf("Demo break")
    			sCtx.Broken()
    		})
    	})
    }
    

    The report (exluding labels):

    {
        "name": "Allure demo",
        "fullName": "Test_AllureExample/Allure_demo",
        "status": "passed",
        "statusDetails": {
            "message": "",
            "trace": ""
        },
        "start": 1669278069758,
        "stop": 1669278069758,
        "uuid": "f34c46a8-6bd0-11ed-bd95-a45e60d5053f",
        "historyId": "baa17e747dc3baf09c0ad0b7a00c6251",
        "testCaseId": "3948cbd85816212b9f92d81b0b03b207",
        "labels": [
        ],
        "steps": [
            {
                "name": "First step",
                "status": "broken",
                "start": 1669278069758,
                "stop": 1669278069758
            }
        ]
    }
    

    Note that step has a proper broken status, but the test has a passed status.

    A clear and concise description of what the bug is.

    To Reproduce Steps to reproduce the behavior:

    1. Create a single test.
    2. Define one step in the test.
    3. use broken() in this step's function.
    4. Check report.

    Expected behavior The test is marked as Broken in the report.

    Additional context I have some questions regarding this issue:

    1. Is it a bug or is it intended? If intended, how can i apple Broken status to a test?
    2. What should be done either way with provider.T of my test after setting some step to broken()? There is no BreakNow() fn, so i just have to end the test execution naturally after a broken step?
    3. Which go test status (skipped / failed) will be applied to the test, if it s properly set as Broken by the library?
  • Incorrect timing of the test

    Incorrect timing of the test

    Describe the bug In allure report every step of the test has execution time, and if we sum every step time, it will not be equal to duration

    To Reproduce Steps to reproduce the behavior:

    1. Run tests with allure-steps

    Expected behavior Summ of the execution time of steps is equal to duration

    Screenshots Снимок экрана 2022-11-22 в 12 20 33

    Additional context As you can see duration != summ of the time of steps

  • Request to update Readme.md

    Request to update Readme.md

    Возможно, стоит подсветить обязательность defer перед Teardown и обьяснить почему он нужен, чтобы легче было раскурить этот нюанс без сторонней помощи

  • Test falls in afterEach step

    Test falls in afterEach step

    Describe the bug I am running a test in Suite in gitlab. I had an error in test's step with message "index out of range [0]. Allure was logging an error in the afterEach step instead of an error inside test. Moreover, the element I accessed has len = 1, so this shouldn't be an error.

    To Reproduce Steps to reproduce the behavior:

    1. Used func: suite.RunSuite
    2. What you actually wanted to do: to get test passed :)
    3. What has been expected: noError
    4. What you got actual: error in afterEach step
    5. Error Log (if any): afterEach panicked: runtime error: index out of range [0] with length 0 goroutine 509 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 github.com/ozontech/allure-go/pkg/framework/runner.(*runner).RunTests.func1.3.1.2() /builds/Nx2CE54f/0/bx/pdp-api/.cache/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/runner.go:182 +0x85 panic({0x14edf00, 0xc000dbee28}) /usr/local/go/src/runtime/panic.go:884 +0x212 gitlab.*.ru/bx/pdp-api/e2e/internal/steps.(*Helper).GetDigitalBookLitres.func1() /builds/Nx2CE54f/0/bx/pdp-api/e2e/internal/steps/item.go:111 +0x2a5 gitlab.*.ru/marketplace/qa/tools/qa_pack/pkg/utilities.Poll(0x18956c0?, 0xc0004ab6b0?, 0xc000d39198) /builds/Nx2CE54f/0/bx/pdp-api/.cache/go/pkg/mod/gitlab.*.ru/marketplace/qa/tools/[email protected]/pkg/utilities/utilities.go:123 +0xfb gitlab.*.ru/bx/pdp-api/e2e/internal/steps.(*Helper).GetDigitalBookLitres(0xc00040abd0, {0x18956c0, 0xc0004ab6b0}, {0x18acc20, 0xc0000ef7a0}) /builds/Nx2CE54f/0/bx/pdp-api/e2e/internal/steps/item.go:107 +0x176 gitlab.*.ru/bx/pdp-api/e2e/suites.(*WebSmokeSuite).TestWebAddToCartV8wDigitalBook(0xc000072780, {0x18acc20, 0xc0000ef7a0}) /builds/Nx2CE54f/0/bx/pdp-api/e2e/suites/web_suite.go:176 +0x130 reflect.Value.call({0xc000216a20?, 0xc000131830?, 0x30?}, {0x16067f1, 0x4}, {0xc0005a3920, 0x2, 0x18?}) /usr/local/go/src/reflect/value.go:584 +0x8c5 reflect.Value.Call({0xc000216a20?, 0xc000131830?, 0x10?}, {0xc0005a3920?, 0x10?, 0x2561240?}) /usr/local/go/src/reflect/value.go:368 +0xbc github.com/ozontech/allure-go/pkg/framework/runner.(*testMethod).GetBody.func1({0x18acc20?, 0xc0000ef7a0?}) /builds/Nx2CE54f/0/bx/pdp-api/.cache/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/tests.go:150 +0x2b1 github.com/ozontech/allure-go/pkg/framework/runner.(*runner).RunTests.func1.3.1(0xc000ba9ba0) /builds/Nx2CE54f/0/bx/pdp-api/.cache/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/runner.go:205 +0x2e7 testing.tRunner(0xc000ba9ba0, 0xc000b8e190) /usr/local/go/src/testing/testing.go:1446 +0x10b created by testing.(*T).Run /usr/local/go/src/testing/testing.go:1493 +0x35f

    Expected behavior If test falls, allure logs error inside test

This is from the udemy course: Go: The Complete Developer's Guide (Golang)

Go Udemy course - "Go: The Complete Developer's Guide (Golang)" How to run the file: go run hello-world.go go run <filename>.go GO CLI commands: go ru

Oct 22, 2021
Go: The Complete Developer's Guide (Golang) Udemy Course by Stephen Grider

Go-The-Complete-Developers-Guide Go Command line tools 1. go build - compiles a bunch of go source code files go build

Dec 29, 2021
Official provider for VMware desktop products: Fusion, Player, and Workstation.

Vagrant VMware Desktop Providers This is the common codebase for the official providers for VMware desktop products: Fusion, Player, and Workstation.

Jan 7, 2023
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.

Vegeta is a system resource usage tracking tool built to regularly take snapshots of the memory and CPU load of one or more running processes, so as to dynamically build up a profile of their usage of system resources.

Jan 16, 2022
Partial fork of testify framework with allure integration
Partial fork of testify framework with allure integration

allure-testify Оглавление Demo Getting started Examples Global environments keys How to use suite Allure info Test info Label Link Allure Actions Step

Dec 1, 2021
simple-jwt-provider - Simple and lightweight provider which exhibits JWTs, supports login, password-reset (via mail) and user management.

Simple and lightweight JWT-Provider written in go (golang). It exhibits JWT for the in postgres persisted user, which can be managed via api. Also, a password-reset flow via mail verification is available. User specific custom-claims also available for jwt-generation and mail rendering.

Dec 18, 2022
Provider-generic-workflows - A generic provider which uses argo workflows to define the backend actions.

provider-generic-workflows provider-generic-workflows is a generic provider which uses argo workflows for managing the external resource. This will re

Jan 1, 2022
Disk usage analyzer with console interface written in Go
Disk usage analyzer with console interface written in Go

Gdu is intended primarily for SSD disks where it can fully utilize parallel processing. However HDDs work as well, but the performance gain is not so huge.

Jan 7, 2023
OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)
OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)

Terraform Provider OpenAPI This terraform provider aims to minimise as much as possible the efforts needed from service providers to create and mainta

Dec 26, 2022
Terraform provider to help with various AWS automation tasks (mostly all that stuff we cannot accomplish with the official AWS terraform provider)
Terraform provider to help with various AWS automation tasks (mostly all that stuff we cannot accomplish with the official AWS terraform provider)

terraform-provider-awsutils Terraform provider for performing various tasks that cannot be performed with the official AWS Terraform Provider from Has

Dec 8, 2022
provider-kafka is a Crossplane Provider that is used to manage Kafka resources.

provider-kafka provider-kafka is a Crossplane Provider that is used to manage Kafka resources. Usage Create a provider secret containing a json like t

Oct 29, 2022
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)

Terraform Provider for Azure (Resource Manager) Version 2.x of the AzureRM Provider requires Terraform 0.12.x and later, but 1.0 is recommended. Terra

Oct 16, 2021
provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters

provider-kubernetes provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters ty

Dec 14, 2022
stratus is a cross-cloud identity broker that allows workloads with an identity issued by one cloud provider to exchange this identity for a workload identity issued by another cloud provider.
stratus is a cross-cloud identity broker that allows workloads with an identity issued by one cloud provider to exchange this identity for a workload identity issued by another cloud provider.

stratus stratus is a cross-cloud identity broker that allows workloads with an identity issued by one cloud provider to exchange this identity for a w

Dec 26, 2021
Terraform-provider-mailcow - Terraform provider for Mailcow

Terraform Provider Scaffolding (Terraform Plugin SDK) This template repository i

Dec 31, 2021
Terraform-provider-buddy - Terraform Buddy provider For golang

Terraform Provider for Buddy Documentation Requirements Terraform >= 1.0.11 Go >

Jan 5, 2022
Hashicups-tf-provider - HashiCups Terraform Provider Tutorial

Terraform Provider HashiCups Run the following command to build the provider go

Jan 10, 2022
Terraform-provider-e2e-network - Terraform Provider Scaffolding (Terraform Plugin SDK)

This template repository is built on the Terraform Plugin SDK. The template repository built on the Terraform Plugin Framework can be found at terraform-provider-scaffolding-framework.

Jan 19, 2022
Terraform-provider-vercel - Terraform Vercel Provider With Golang

Vercel Terraform Provider Website: https://www.terraform.io Documentation: https

Dec 14, 2022
Provider-milvus - Milvus provider for crossplane

provider-milvus provider-milvus is a minimal Crossplane Provider that is meant t

Feb 9, 2022