2.11.0
What's Changed
π New features
Runtime API
This release introduces Runtime API that can be used to affect the report during test execution. Previously, users had to utilize AllireLifecycle
's methods, such as AllureLifecycle.UpdateTestCase
, to achieve that. Now we advise all users to migrate to the new API whenever possible.
The API is accessible as static methods of Allure.Net.Commons.AllureApi
. The full list of the class's methods includes:
- Metadata
SetTestName(string newName)
SetFixtureName(string newName)
SetStepName(string newName)
SetDescription(string description)
SetDescriptionHtml(string descriptionHtml)
- Labels
AddLabels(params Label[] labels)
AddLabel(string name, string value)
AddLabel(Label newLabel)
SetSeverity(SeverityLevel severity)
SetOwner(string owner)
SetAllureId(int allureId)
AddTags(params string[] tags)
- Links
AddLink(string url)
AddLink(string name, string url)
AddIssue(string url)
AddIssue(string name, string url)
AddTmsItem(string url)
AddTmsItem(string name, string url)
AddLink(string name, string type, string url)
AddLinks(params Link[] links)
- Hierarchies
- Suites hierarchy
AddParentSuite(string parentSuite)
AddSuite(string suite)
AddSubSuite(string subSuite)
- BDD hierarchy
AddEpic(string epic)
AddFeature(string feature)
AddStory(string story)
- Suites hierarchy
- Steps
Step(string name)
- Lambda steps
Step(string name, Action action)
Step<T>(string name, Func<T> function): T
async Step(string name, Func<Task> action): Task
async Step<T>(string name, Func<Task<T>> function): Task<T>
- Attachments
AddAttachment(string name, string type, string path)
AddAttachment(string name, string type, byte[] content, string fileExtension = "")
AddAttachment(string path, string? name = null)
AddScreenDiff(string expectedPng, string actualPng, string diffPng)
- Parameters
AddTestParameter(string name, object? value)
AddTestParameter(string name, object? value, ParameterMode mode)
AddTestParameter(string name, object? value, bool excluded)
AddTestParameter(string name, object? value, ParameterMode mode, bool excluded)
AddTestParameter(Parameter parameter)
Some less frequently used API methods are available as static methods of Allure.Net.Commons.ExtendedApi
. Those are:
- Low-level fixtures API
StartBeforeFixture(string name)
StartAfterFixture(string name)
PassFixture()
PassFixture(Action<FixtureResult> updateResults)
FailFixture()
FailFixture(Action<FixtureResult> updateResults)
BreakFixture()
BreakFixture(Action<FixtureResult> updateResults)
- Low-level steps API
StartStep(string name)
StartStep(string name, Action<StepResult> updateResults)
PassStep()
PassStep(Action<StepResult> updateResults)
FailStep()
FailStep(Action<StepResult> updateResults)
BreakStep()
BreakStep(Action<StepResult> updateResults)
- Lambda fixtures
Before(string name, Action action)
Before<T>(string name, Func<T> function): T
async Before(string name, Func<Task> action): Task
async Before<T>(string name, Func<Task<T>> function): Task<T>
After(string name, Action action)
After<T>(string name, Func<T> function): T
async After(string name, Func<Task> action): Task
async After<T>(string name, Func<Task<T>> function): Task<T>
Note
Allure.Net.Commons.Steps.CoreStepsHelper
as its derivatives (NUnit.Allure.Core.StepsHelper
and Allure.Xunit.Steps
) are now deprecated in favor of the new API. The attachment-related methods from Allure.Net.Commons.AllureLifecycle
are also deprecated.
(implements #404 by @delatrie via #414)
Parameter's mode and exclude fields
Allure Report supports masked and hidden parameters of a test. Allure TestOps does, and the future major release of Allure Report will support excluded parameters of a test. Additionally, many other Allure integrations support excluded parameters of a test when calculating historyId
of the test.
This release adds the mode
and exclude
fields to the Allure.Net.Commons.Parameter
class as well as some overloads of the new AllureApi.AddTestParameter
method to fill those fields. Allure NUnit, Allure xUnit.net, and Allure SpecFlow now ignore excluded parameters when calculating historyId
(implements #425 by @delatrie via #414).
π¬ Improvements
- Xml documentation was added to the Allure.Net.Commons package (partially implements #426 by @delatrie via #414).
- Now Allure SpecFlow doesn't interrupt the run if an exception is thrown during an attempt to patch SpecFlow with Harmony to enable selective run. Selective run won't work in such a case. This allows to workaround #434 until a new version of MonoMod that supports net8.0 is released (implements #436 by @delatrie via #437).
π Bug fixes
- BOM was removed from JSON schemas to comply with RFC 8259 (fixes #415 by @delatrie via #414).
Link.Issue(string name)
andLink.Tms(string name)
now correctly fill theurl
field of the link they create. The parameter was renamed tourl
for both methods (fixes #416 by @delatrie via #414).- InvalidOperationException that sometimes occurs when Allure SpecFlow is run in a multithreaded environment was fixed (fixes #433 by @delatrie via #414).
- Skipped xUnit theories now get their
historyId
filled correctly (fixes #422 by @delatrie via #414).
New Contributors
Full Changelog: 2.10.0...2.11.0