You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
При установке переменной окружения в OneTimeSetUp конфиг будет соответствовать указанному в path. Environment.SetEnvironmentVariable(AllureConstants.ALLURE_CONFIG_ENV_VARIABLE, path);
What is the motivation / use case for changing the behavior?
Для разделения отчётности по отдельным запускам.
В том числе отделение отчётов созданных при отладке.
Подробный пример выложил в репозиторий https://github.com/lJFoxl/TempTest
запустив тесты с одинаковым кодом мы будем наблюдать ошибку в версии 2.10 и позитивный тест в 2.9.2.
Судя по всему AllureLifecycle.Instance вызывается до OneTimeSetUp библиотекой Allure.NUnit
The text was updated successfully, but these errors were encountered:
lJFoxl
changed the title
Не возможно сменить путь конфига в OneTimeSetUp
Невозможно сменить путь конфига в OneTimeSetUp
Oct 24, 2023
Starting from 2.10 the OneTimeSetUp/OneTimeTearDown methods of a TestFixture are executed in the context of Allure. This is necessary to convert those methods to Allure fixtures as well as to enable using features of Allure (steps, attachments, etc) from them. And as you've just figured out, it's too late to change the config at that point.
Although a more straightforward API for such tasks is indeed necessary, for now, you may just move your code from TestFixture to an assembly-level SetupFixture. See example in this answer.
В версии 2.10 методы OneTimeSetUp/OneTimeTearDown тестовых классов выполняются в контексте Allure, чтобы пользователи могли создавать фикстуры в отчёте на их основе и, например, добавлять шаги и аттачменты из них. Allure в этот момент уже проинициализирован, поэтому изменение переменной окружения ALLURE_CONFIG ни на что не влияет.
Переместите ваш код, который отвечает за создание конфига, из тестового класса (TestFixture) в SetUpFixture. Чтобы он точно выполнялся до инициализации Allure, разместите этот класс в пустом пространстве имён. Вот в этом ответе есть пример, а вот по этой ссылке - подробности про SetUpFixture.
Обновил тестовый пример. https://github.com/lJFoxl/TempTest.
Если SetUpFixture находится в подключаемом проекте изменение ALLURE_CONFIG_ENV_VARIABLE ни к чему не приводит, а если в одном проекте то OneTimeSetUp вызывается дважды.
I'm submitting a ...
What is the current behavior?
С версии 2.10 всегда устанавливается либо стандартное значение либо из конфига в базовой директории
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Подробный пример выложил в репозиторий https://github.com/lJFoxl/TempTest
What is the expected behavior?
При установке переменной окружения в OneTimeSetUp конфиг будет соответствовать указанному в path.
Environment.SetEnvironmentVariable(AllureConstants.ALLURE_CONFIG_ENV_VARIABLE, path);
What is the motivation / use case for changing the behavior?
Для разделения отчётности по отдельным запускам.
В том числе отделение отчётов созданных при отладке.
Please tell us about your environment:
Allure.Net.Commons Version="2.10.0"
Allure.NUnit Version="2.10.0"
Microsoft.NET.Test.Sdk Version="17.7.2"
NUnit Version="3.13.3"
NUnit3TestAdapter Version="4.5.0"
Other information
Подробный пример выложил в репозиторий https://github.com/lJFoxl/TempTest
запустив тесты с одинаковым кодом мы будем наблюдать ошибку в версии 2.10 и позитивный тест в 2.9.2.
Судя по всему AllureLifecycle.Instance вызывается до OneTimeSetUp библиотекой Allure.NUnit
The text was updated successfully, but these errors were encountered: