Skip to content

Fixes a bug with double test cases #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions NUnit HTML Report Generator/ExampleResults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<message><![CDATA[No valid data]]></message>
</reason>
</test-case>
<test-case name="NUnit.Tests.Assemblies.MockTestFixture.MockTest1" description="Mock Test #1" executed="True" result="Success" success="True" time="0.000" asserts="0" />
<test-case name="NUnit.Tests.Assemblies.MockTestFixture.MockTest2" description="This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long description" executed="True" result="Success" success="True" time="0.000" asserts="0">
<test-case name="NUnit.Tests.Assemblies.MockTestFixture.MockTest1('a', 'b')" description="Mock Test #1" executed="True" result="Success" success="True" time="0.000" asserts="0" />
<test-case name="NUnit.Tests.Assemblies.MockTestFixture.MockTest2(1.5, 2)" description="This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long description" executed="True" result="Success" success="True" time="0.000" asserts="0">
<categories>
<category name="MockCategory" />
</categories>
Expand Down
14 changes: 12 additions & 2 deletions NUnit HTML Report Generator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,18 @@ private static string GenerateFixtureModal(XElement fixture, string modalId, str
name = testCase.Attribute("name").Value;
result = testCase.Attribute("result").Value;

// Remove namespace if included
name = name.Substring(name.LastIndexOf('.') + 1, name.Length - name.LastIndexOf('.') - 1);
// Remove namespace if included, which is all text before the last point, the last point being before any parenthesis (for the test cases)
int parenthesisPosition = name.LastIndexOf('(');
if (parenthesisPosition >= 0)
{
parenthesisPosition = parenthesisPosition - 1;
}
else
{
parenthesisPosition = name.Length - 1;
}

name = name.Substring(name.LastIndexOf('.', parenthesisPosition) + 1, name.Length - name.LastIndexOf('.', parenthesisPosition) - 1);

html.AppendLine("<div class=\"panel ");

Expand Down