Skip to content

Add Support for Templating in LogFileName Β #1876

Closed as not planned
Closed as not planned
@RehanSaeed

Description

@RehanSaeed

Description

The trx file produced from dotnet test is highly unique but terrible for humans:

[Username]_[MachineName]_2018-12-23_08_27_05.trx

I'd like to supply a LogFileName using some sort of template syntax:

trx;LogFileName=[ProjectName]-[Timestamp].trx

To output:

MyProject-2018-12-23_08_27_05.trx

There are various replacements that could take place in LogFileName:

  • TargetFramework e.g. net7.0
  • ProjectName
  • Timestamp
  • Username
  • MachineName

Why is this useful

We can now run dotnet test on a folder to run all tests. However, I want custom file names, so I end up not being able to use the new feature above.

foreach(var project in GetFiles("./Tests/**/*Test.csproj"))
{
    DotNetCoreTest(
        project.ToString(),
        new DotNetCoreTestSettings()
        {
            Configuration = configuration,
            Logger = $"trx;LogFileName={project.GetFilenameWithoutExtension()}.trx",
            NoBuild = true,
            NoRestore = true,
            ResultsDirectory = artifactsDirectory
        });
}

I'd like a template syntax, so I could write:


DotNetCoreTest(
    ".",
    new DotNetCoreTestSettings()
    {
        Configuration = configuration,
        Logger = $"trx;LogFileName=[ProjectName].trx",
        NoBuild = true,
        NoRestore = true,
        ResultsDirectory = artifactsDirectory
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions