Skip to content

Allure web site "Suites" view shows duplicate results for custom grouping. One correct custom grouping and same test in default mode #638

Description

@darrenge

I am using Allure C# and running into duplicate results in Suites view. I have a base class that sets all the custom groupings.

The good thing is that custom groups work how I like it. However, there also is the default (basically no grouping) for each test as well. I don't want the non custom entry in the Suites section. See attached pic that shows the first part which we like \ want and then where the big red arrow is pointing to is what we don't want. Also, notice (blue arrow), that individual test takes each config and just makes it a "retry".

I assume there is a way to remove the default grouping. I was hoping the x.labels.RemoveAll.. would have handled it but it didn't since I don't think that is really related to "labels".

Image

` public abstract class AllureTestBase
{
[SetUp]
public void LabelEnvironment()
{
string os = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "Linux" :
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "Windows" :
"unknown";
var frameworkAttr = Assembly.GetExecutingAssembly()
.GetCustomAttribute();

     var framework = "unknown";
     if (frameworkAttr != null)
     {
         var parts = frameworkAttr.FrameworkName.Split(',');
         if (parts.Length > 0)
         {
             var lastPart = parts[parts.Length - 1];
             framework = lastPart.Replace("Version=v", "net");
         }
     }
     var config = Assembly.GetExecutingAssembly()
         .GetCustomAttribute<AssemblyConfigurationAttribute>()?.Configuration ?? "unknown";
     // var timestamp = DateTime.Now.ToString("M/d/yyyy HH:mm"); // e.g., "9/17/2025 14:51"
     var timestamp = DateTime.Now.ToString("M/d/yyyy"); // e.g., "9/17/2025"
     var fullName = $"[{os}, {framework}, {config}]";
     var namespaceName = GetType().Namespace ?? "UnknownNamespace";

     AllureLifecycle.Instance.UpdateTestCase(x =>
     {
         // Remove any default suite/subSuite labels that NUnit added
         x.labels.RemoveAll(l => l.name == "suite" || l.name == "subSuite");

         // apply your custom hierarchy
         x.labels.Add(Label.ParentSuite($"{namespaceName} - {timestamp}"));
         x.labels.Add(Label.Suite(os));
         x.labels.Add(Label.SubSuite($"{framework} | {config}"));

         // Deterministic historyId so each matrix variant is distinct but still builds history
         //x.historyId = Guid.NewGuid().ToString(); // Optional: breaks history grouping but keeps each test separate (shows as a "retry" if not separate). Adding the "AddTestParameter" also handles this.
         //x.historyId = $"{GetType().FullName}.{TestContext.CurrentContext.Test.Name}-{os}-{framework}-{config}";
     });

     // allows to separate out tests based on config but still hold history
     AllureApi.AddTestParameter("env", fullName);
 }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions