Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test cases without namespace #43

Open
patricksadowski opened this issue Dec 1, 2023 · 1 comment
Open

Allow test cases without namespace #43

patricksadowski opened this issue Dec 1, 2023 · 1 comment
Labels
enhancement New feature or request logger: junit JUnit test logger issues

Comments

@patricksadowski
Copy link

To reduce noise, work and maintenance we often use test classes without namespace in .NET. That leads to a test logger message Unable to parse one or more test names provided by your test runner. These will be logged using Namespace='UnknownNamespace', Type='UnknownType'. The entire test name will be used as the Method name. Please open a ticket so we can review this issue.

Would it be possible to allow test cases without namespace? Maybe it's impossible when considering nested classes.

.NET test project file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <RootNamespace></RootNamespace>
  </PropertyGroup>
</Project>

Xunit test file

using Xunit;

public class ClassName
{
    [Fact]
    public void TestMethod()
    {
    }
}

JUnit Report

Current

<testsuites>
  <testsuite name="Assembly.dll" tests="1" skipped="0" failures="0" errors="0" time="1">
    <testcase classname="UnknownNamespace.UnknownType" name="ClassName.TestMethod" time="1" />
  </testsuite>
</testsuites>

Expected

<testsuites>
  <testsuite name="Assembly.dll" tests="1" skipped="0" failures="0" errors="0" time="1">
    <testcase classname="ClassName" name="TestMethod" time="1" />
  </testsuite>
</testsuites>
@codito
Copy link
Contributor

codito commented Dec 3, 2023

@patricksadowski thanks for reporting this issue. We should support this scenario. /cc: @Siphonophora for thoughts.

@codito codito added enhancement New feature or request logger: junit JUnit test logger issues labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request logger: junit JUnit test logger issues
Projects
None yet
Development

No branches or pull requests

2 participants