Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
ad7dfde
feat(sdk): add sdk project
delatrie Jul 23, 2026
d6718be
feat(sdk): add destinations
delatrie Jul 23, 2026
fbb7c04
feat(sdk): add remaining features
delatrie Jul 24, 2026
cea4b27
feat(sdk): add hooks
delatrie Jul 24, 2026
4b5fdcb
docs(sdk): add README
delatrie Jul 24, 2026
19b0376
feat(sdk): finalize registration hooks
delatrie Jul 27, 2026
2cde84c
feat(sdk): simplify registration
delatrie Jul 27, 2026
f6916fd
feat(sdk): integration -> runtime builder
delatrie Jul 27, 2026
4292eb4
feat(sdk): simplify defaults class
delatrie Jul 27, 2026
e4df6ad
refactor(sdk): TConfig -> TConfiguration
delatrie Jul 27, 2026
ec6d1b2
feta(sdk): FromEnvironmentVariable -> FromPathEnvironmentVariable
delatrie Jul 27, 2026
92056c8
feta(sdk): Lambda* -> Delegate*
delatrie Jul 27, 2026
394af0c
feta(sdk): ILateBoundReferenceView -> IReadOnlyLateBoundReference
delatrie Jul 27, 2026
acbaf4e
feta(sdk): some renames
delatrie Jul 27, 2026
9e48701
feta(sdk): RuntimeBound* -> Runtime*
delatrie Jul 27, 2026
b4fad1f
feta(sdk): more renames
delatrie Jul 27, 2026
0e3c725
feta(sdk): more renames
delatrie Jul 27, 2026
4ab0198
feat(sdk): decompose functions
delatrie Jul 27, 2026
7378702
feat(sdk): factor out Md5.FromObject
delatrie Jul 27, 2026
b314cdd
feat(sdk): function renames
delatrie Jul 27, 2026
971f8cb
feat(sdk): simplify EnvironmentLabels
delatrie Jul 27, 2026
0604f86
feat(sdk): remove leftovers
delatrie Jul 27, 2026
8324068
feat(sdk): open Md5.FromJson
delatrie Jul 27, 2026
1cdf756
refactor(sdk): format
delatrie Jul 27, 2026
0726e3b
feat(sdk): merge env and global variables. decouple from env
delatrie Jul 27, 2026
4de1e8b
feat(sdk): support endpoint hooks
delatrie Jul 27, 2026
aaf7226
fix(sdk): call EnsureDirectory in CopyAttachment
delatrie Jul 27, 2026
3c93cc5
fix(sdk): various fixes
delatrie Jul 27, 2026
bb56952
feat(sdk): allow endpoint availibility and route suppression to hooks
delatrie Jul 27, 2026
92436a8
feat(sdk): make configuration a record
delatrie Jul 27, 2026
14a278f
feat(sdk): reorganize registration hooks
delatrie Jul 27, 2026
9f79b89
fix(sdk): hook type for in-process endpoint registration
delatrie Jul 27, 2026
627ec58
feat(sdk): remove unnecessary lazyness from hook factories
delatrie Jul 27, 2026
f918719
feat(sdk): better user vs integration separation of registration inte…
delatrie Jul 28, 2026
6c2a4f0
feat(sdk): make serializer rule registrations more composable
delatrie Jul 28, 2026
3f37fda
feat(sdk): fix extension methods for rule serializer registration
delatrie Jul 28, 2026
c7db37c
feat(sdk): terminology consistency fix
delatrie Jul 28, 2026
57d4853
feat(sdk): remove extra allocation
delatrie Jul 28, 2026
5352254
feat(sdk): switch to last-call-win serializer registration strategy
delatrie Jul 28, 2026
af23a10
feat(sdk): make last-call-win semantic more aparent
delatrie Jul 28, 2026
5173301
refactor(sdk): tiny name tweak
delatrie Jul 28, 2026
1055df2
fix(sdk): replace stopstep with stopfixture in sync setup and teardown
delatrie Jul 28, 2026
a58bade
fix(sdk): SetName now prioritizes the current step
delatrie Jul 28, 2026
cd03ac8
test(sdk): add sdk test project
delatrie Jul 28, 2026
ccd9206
feat(sdk): hide LateBoundReference
delatrie Jul 28, 2026
e0754ba
test(sdk): add registration tests
delatrie Jul 28, 2026
80d2d9d
test(sdk): add lifecycle and model tests
delatrie Jul 28, 2026
f06171c
fix(sdk): remove stale step and fixture operations
delatrie Jul 28, 2026
12570aa
feat(sdk): throw when context used out of scope
delatrie Jul 28, 2026
5f62d73
test(sdk): cover name, description
delatrie Jul 28, 2026
73af4ff
fix(sdk): empty screen diffs
delatrie Jul 28, 2026
5971897
test(sdk): more attachment tests
delatrie Jul 28, 2026
6e676b9
test(sdk): more attachment tests
delatrie Jul 28, 2026
bde8c29
test(sdk): cover globals
delatrie Jul 28, 2026
e2dc82e
test(sdk): cover labels
delatrie Jul 28, 2026
a4174be
test(sdk): cover links
delatrie Jul 28, 2026
b80e05f
test(sdk): cover model operations
delatrie Jul 28, 2026
3775724
test(sdk): cover test parameters
delatrie Jul 28, 2026
d58a001
test(sdk): more step tests
delatrie Jul 28, 2026
ad241da
fix(sdk): do not throw from json serializer
delatrie Jul 28, 2026
30c073f
feat(sdk): serialize more types with ToString
delatrie Jul 28, 2026
47b7043
test(sdk): more serializer tests
delatrie Jul 28, 2026
22836f3
test(sdk): more serializer tests
delatrie Jul 28, 2026
d5f2517
test(sdk): more serializer tests
delatrie Jul 28, 2026
0a893b5
test(sdk): more serializer tests
delatrie Jul 28, 2026
bc7a1d1
test(sdk): more serializer tests
delatrie Jul 28, 2026
392f6f9
test(sdk): cover file object destination
delatrie Jul 28, 2026
6c66703
test(sdk): cover fs destination
delatrie Jul 29, 2026
06c84db
feat(sdk): use atomic write
delatrie Jul 29, 2026
9473d41
test(sdk): cover fs atomic write
delatrie Jul 29, 2026
47307dc
test(sdk): complete destination coverage
delatrie Jul 29, 2026
f3276da
fix(sdk): make configuration loading case sensitive
delatrie Jul 29, 2026
2b69e85
test(sdk): complete registration hook coverage
delatrie Jul 29, 2026
8ba141c
test(sdk): complete endpoint coverage
delatrie Jul 29, 2026
0a1c91e
test(sdk): complete helper coverage
delatrie Jul 29, 2026
ee39ba6
test(sdk): complete coverage
delatrie Jul 29, 2026
8fd7c4d
docs(sdk): add xmldocs
delatrie Jul 29, 2026
ba16706
chore: enable allure.net.sdk tests in CI
delatrie Jul 29, 2026
121274e
fix(sdk): add missing project reference
delatrie Jul 29, 2026
6d3fee4
feat(sdk): add convenience runtime type overloads
delatrie Jul 29, 2026
07d78cd
feat(sdk): hide configuration types from hooks
delatrie Jul 29, 2026
97567b1
feat(sdk): complete registration
delatrie Jul 29, 2026
b57e440
feat(sdk): transition to setup/teardown
delatrie Jul 29, 2026
a22de1f
feat(sdk): add execution context base
delatrie Jul 29, 2026
58235fc
docs(sdk): add README
delatrie Jul 29, 2026
9871c48
feat(sdk): runtimeRegistrationHook
delatrie Jul 30, 2026
1e7f7d9
feat(sdk): complete custom runtime registration contour
delatrie Jul 30, 2026
bac66e0
feat(sdk): update README
delatrie Jul 30, 2026
21a8d33
fix(sdk): make scope name optional
delatrie Jul 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Test
env:
SOLUTION_PATH: allure-csharp.slnx
BUILD_CONFIGURATION: 'Release'
PACK_CONFIGURATION: 'Publish'

on:
workflow_dispatch:
Expand Down Expand Up @@ -53,7 +54,7 @@ jobs:
dotnet pack ${{ env.SOLUTION_PATH }}\
--no-restore\
--no-build\
--configuration ${{ env.BUILD_CONFIGURATION }}
--configuration ${{ env.PACK_CONFIGURATION }}

- name: Build test samples
run: |
Expand All @@ -77,6 +78,10 @@ jobs:
--no-restore\
--no-build\
--configuration ${{ env.BUILD_CONFIGURATION }}
npx -y allure@3 run --config ./.allurerc.mjs --rerun 2 --environment="${{ env.BUILD_CONFIGURATION }}" --dump="allure-results-sdk" -- dotnet run --project ./tests/Allure.Net.Sdk.Tests\
--no-restore\
--no-build\
--configuration ${{ env.BUILD_CONFIGURATION }}
npx -y allure@3 run --config ./.allurerc.mjs --rerun 2 --environment="${{ env.BUILD_CONFIGURATION }}" --dump="allure-results-testing-platform" -- dotnet run --project ./tests/Allure.TestingPlatform.Tests\
--no-restore\
--no-build\
Expand Down
6 changes: 6 additions & 0 deletions allure-csharp.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<Project Path="src/Allure.Net.Commons/Allure.Net.Commons.csproj">
<BuildType Solution="Publish|*" Project="Release" />
</Project>
<Project Path="src/Allure.Net.Sdk/Allure.Net.Sdk.csproj">
<BuildType Solution="Publish|*" Project="Release" />
</Project>
<Project Path="src/Allure.NUnit/Allure.NUnit.csproj">
<BuildType Solution="Publish|*" Project="Release" />
</Project>
Expand All @@ -78,6 +81,9 @@
<Project Path="tests/Allure.Net.Tests/Allure.Net.Tests.csproj">
<Build Solution="Publish|*" Project="false" />
</Project>
<Project Path="tests/Allure.Net.Sdk.Tests/Allure.Net.Sdk.Tests.csproj">
<Build Solution="Publish|*" Project="false" />
</Project>
<Project Path="tests/Allure.NUnit.Tests/Allure.NUnit.Tests.csproj">
<Build Solution="Publish|*" Project="false" />
</Project>
Expand Down
2 changes: 1 addition & 1 deletion src/Allure.Net.Commons/Functions/ModelFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class ModelFunctions
{
/// <summary>
/// Checks if an exception type, one of its base types, or one of the
/// interfaces it implements exists in the list of known execption types.
/// interfaces it implements exists in the list of known excecption types.
/// </summary>
/// <param name="knownErrorBases">The list of known exception types.</param>
/// <param name="e">The exception to check.</param>
Expand Down
25 changes: 25 additions & 0 deletions src/Allure.Net.Sdk/Allure.Net.Sdk.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Allure.Sdk</RootNamespace>
<Description>Provides the API and utilities for building Allure integrations.</Description>
<PackageIcon>Allure-Color.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Allure.Net\Allure.Net.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.10" />
<PackageReference Include="System.Text.Json" Version="10.0.10" />
</ItemGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
<None Include="../../img/Allure-Color.png" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions src/Allure.Net.Sdk/CompilerHints/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.ComponentModel;

#pragma warning disable IDE0130

namespace System.Runtime.CompilerServices;

/// <summary>
/// Provides the compiler-required modifier type for init-only setters when
/// targeting frameworks earlier than .NET 5, including .NET Standard. See
/// <see href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/init#metadata-encoding">
/// this article
/// </see>
/// and
/// <see href="https://developercommunity.visualstudio.com/t/error-cs0518-predefined-type-systemruntimecompiler/1244809#TPIN-N1249582">
/// this answer
/// </see>
/// for more details.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit { }
14 changes: 14 additions & 0 deletions src/Allure.Net.Sdk/CompilerHints/MaybeNullWhenAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Indicates that the parameter may be <see langword="null"/> when the method
/// returns the specified value.
/// This attribute is not included in .NET Standard 2.0, so it is defined locally.
/// </summary>
/// <param name="returnValue">
/// The return value for which the parameter may be <see langword="null"/>.
/// </param>
[AttributeUsage(AttributeTargets.Parameter)]
internal sealed class MaybeNullWhenAttribute(bool returnValue) : Attribute {
public bool ReturnValue { get; } = returnValue;
}
14 changes: 14 additions & 0 deletions src/Allure.Net.Sdk/CompilerHints/NotNullWhenAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Indicates that the parameter is not <see langword="null"/> when the method
/// returns the specified value.
/// This attribute is not included in .NET Standard 2.0, so it is defined locally.
/// </summary>
/// <param name="returnValue">
/// The return value for which the parameter is not <see langword="null"/>.
/// </param>
[AttributeUsage(AttributeTargets.Parameter)]
internal sealed class NotNullWhenAttribute(bool returnValue) : Attribute {
public bool ReturnValue { get; } = returnValue;
}
56 changes: 56 additions & 0 deletions src/Allure.Net.Sdk/Configuration/AllureConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Collections.Immutable;
using System.IO;

namespace Allure.Sdk.Configuration;

/// <summary>
/// Defines the common configuration used by an Allure runtime.
/// </summary>
public record class AllureConfiguration
{
readonly string resultsDirectory =
Path.Combine(Environment.CurrentDirectory, "allure-results");

/// <summary>
/// Gets the host name recorded in generated test results.
/// </summary>
public string Hostname { get; init; } = Environment.MachineName;

/// <summary>
/// Gets the absolute path of the directory where Allure result files are written.
/// </summary>
public string ResultsDirectory
{
get => this.resultsDirectory;
init
{
this.resultsDirectory = Path.GetFullPath(value);
}
}

/// <summary>
/// Gets the link templates indexed by link type.
/// </summary>
public ImmutableDictionary<string, AllureLinkTemplate> LinkTemplates { get; init; } = [];

/// <summary>
/// Gets the exception type names that Allure treats as test failures.
/// </summary>
public ImmutableList<string> FailExceptions { get; init; } = [];

/// <summary>
/// Gets a value indicating whether generated JSON files are indented.
/// </summary>
public bool IndentOutput { get; init; } = false;

/// <summary>
/// Gets the labels applied to every test result.
/// </summary>
public ImmutableDictionary<string, string> GlobalLabels { get; init; } = [];

/// <summary>
/// Gets the assembly-qualified name of the runtime registration hook type.
/// </summary>
public string? RuntimeRegistrationHook { get; init; }
}
16 changes: 16 additions & 0 deletions src/Allure.Net.Sdk/Configuration/AllureLinkTemplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Allure.Sdk.Configuration;

/// <summary>
/// Defines templates used to expand a link URL and, optionally, its display name.
/// </summary>
/// <param name="UrlTemplate">
/// The composite format string used to build the URL. Placeholder <c>{0}</c>
/// represents the original link value.
/// </param>
/// <param name="NameTemplate">
/// The optional composite format string used to build the display name.
/// </param>
public record class AllureLinkTemplate(
string UrlTemplate,
string? NameTemplate
);
48 changes: 48 additions & 0 deletions src/Allure.Net.Sdk/Configuration/DelegateConfigurationSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;

namespace Allure.Sdk.Configuration;

/// <summary>
/// Loads configuration by invoking a delegate.
/// </summary>
/// <typeparam name="TConfiguration">The configuration type.</typeparam>
/// <param name="name">A human-readable name for the source.</param>
/// <param name="factory">The delegate that creates the configuration.</param>
public sealed class DelegateConfigurationSource<TConfiguration>(
string name,
Func<TConfiguration> factory
) :
IAllureConfigurationSource<TConfiguration>

where TConfiguration : AllureConfiguration
{
/// <inheritdoc/>
public string Name => name;

/// <inheritdoc/>
public bool CanLoad => true;

/// <inheritdoc/>
public TConfiguration LoadConfiguration() => factory();
}

/// <summary>
/// Creates delegate-backed configuration sources.
/// </summary>
public static class DelegateConfigurationSource
{
/// <summary>
/// Creates a configuration source that invokes the specified factory.
/// </summary>
/// <typeparam name="TConfiguration">The configuration type.</typeparam>
/// <param name="name">A human-readable name for the source.</param>
/// <param name="configurationFactory">The delegate that creates the configuration.</param>
/// <returns>The configuration source.</returns>
public static DelegateConfigurationSource<TConfiguration> Create<TConfiguration>(
string name,
Func<TConfiguration> configurationFactory
)
where TConfiguration : AllureConfiguration
=>
new(name, configurationFactory);
}
25 changes: 25 additions & 0 deletions src/Allure.Net.Sdk/Configuration/IAllureConfigurationSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Allure.Sdk.Configuration;

/// <summary>
/// Provides configuration values to an Allure runtime.
/// </summary>
/// <typeparam name="TConfiguration">The configuration type.</typeparam>
public interface IAllureConfigurationSource<out TConfiguration>
where TConfiguration : AllureConfiguration
{
/// <summary>
/// Gets a human-readable name for the source.
/// </summary>
string Name { get; }

/// <summary>
/// Gets a value indicating whether the source can currently load configuration.
/// </summary>
bool CanLoad { get; }

/// <summary>
/// Loads configuration from the source.
/// </summary>
/// <returns>The loaded configuration.</returns>
TConfiguration LoadConfiguration();
}
Loading
Loading