Skip to content

Отображается только один кейс в Allure репорте при использовании тегов сборки #69

Description

@7isenko

Имеем два файла в директории component
duplicating_test.go

//go:build component

package component

import (
	"github.com/stretchr/testify/require"
	"strconv"
	"testing"
)

func TestGeneral(t *testing.T) {
	t.Run("Example test", func(t *testing.T) {
		cases := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
		for _, c := range cases {
			t.Run("subtest "+strconv.Itoa(c), func(t *testing.T) {
				require.NotZero(t, c)

			})
		}
	})

	t.Run("Example second test", func(t *testing.T) {
		cases := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
		for _, c := range cases {
			t.Run("subtest "+strconv.Itoa(c), func(t *testing.T) {
				require.NotZero(t, c)

			})
		}
	})
}

и файл
duplicating2_test.go

//go:build component

package component

import (
	"github.com/stretchr/testify/require"
	"strconv"
	"testing"
)
// Должен быть всегда красный
func TestGeneralSecondTime(t *testing.T) {
	t.Run("Second example test", func(t *testing.T) {
		cases := []int{10, 20, 30, 40, 50, 0}
		for _, c := range cases {
			t.Run("second subtest "+strconv.Itoa(c), func(t *testing.T) {
				require.NotZero(t, c)
			})
		}
	})

	t.Run("Second example second test", func(t *testing.T) {
		cases := []int{10, 20, 30, 40, 50, 0}
		for _, c := range cases {
			t.Run("second subtest "+strconv.Itoa(c), func(t *testing.T) {
				require.NotZero(t, c)
			})
		}
	})
}

Оба помечены тегом //go:build component

Захожу в директорию, запускаю тесты и создаю аллюр отчет следующей командой:
go test -json -tags=component . |golurectl -l -e -s -o ./allure-results --allure-suite TestsWithTag (с указанием -tags=component) и получаю следующий аллюр отчет:
image
Видно, что в сюьте один тест кейс.

image image Второй тест попал в рераны. **По какой-то причине testCaseId обоих тесткейсов равняется md5 от пустой строки.**

У меня получилось решить эту проблему, выйдя из директории и запуская тесты с дополнительным ключом --gotags=component: go test -json -tags=component ./component/... |golurectl -l -e -s -a -o ./allure-results --allure-suite TestsWithTag --gotags component
image
Получаю ожидаемый отчет.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions