Bug: Crashes if NUnit 3 xml contains no test results #30

Closed
espenalb opened this Issue Dec 15, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@espenalb
Collaborator

espenalb commented Dec 15, 2015

This should not crash - happens in our test suite when we are only running SmokeTests...

12:03:40   Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
12:03:40      at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
12:03:40      at ReportUnit.Parser.NUnit.CreateRunInfo(XDocument doc, Report report)
12:03:40      at ReportUnit.Parser.NUnit.Parse(String resultsFile)
12:03:40      at ReportUnit.ReportUnitService.CreateFolderReport(String inputDirectory, String outputDirectory)
12:03:40      at ReportUnit.Program.Main(String[] args)
@espenalb

This comment has been minimized.

Show comment
Hide comment
@espenalb

espenalb Dec 15, 2015

Collaborator

This is the test report:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="2" testcasecount="0" result="Failed" label="Invalid" total="0" passed="0" failed="0" inconclusive="0" skipped="0" asserts="0" engine-version="3.0.5813.39036" clr-version="4.0.30319.42000" start-time="2015-12-15 10:54:30Z" end-time="2015-12-15 10:54:30Z" duration="0.006484">
  <command-line><![CDATA[J:\Jenkins\jobs\GsWindows-feature\workspace\\packages\NUnit.Console.3.0.1\tools\\nunit3-console.exe  J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\\bin\Debug\\GsViewer2.Tests.dll --result=J:\Jenkins\jobs\GsWindows-feature\workspace\artifacts\TestResults\IntegrationTests\GsViewer2.Tests.xml;format=nunit3 --where="cat=~MergeTests AND cat!~TestDurationLong" --result=J:\Jenkins\jobs\GsWindows-feature\workspace\\TestResults\\NUnit-GsViewer2.Tests.xml;format=nunit2 --x86]]></command-line>
  <filter>
    <and>
      <cat re="1">MergeTests</cat>
      <not>
        <cat re="1">TestDurationLong</cat>
      </not>
    </and>
  </filter>
  <test-suite type="Assembly" id="0-1" name="GsViewer2.Tests.dll" fullname="J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\bin\Debug\GsViewer2.Tests.dll" testcasecount="0" runstate="NotRunnable" result="Failed" label="Invalid">
    <properties>
      <property name="_SKIPREASON" value="No suitable tests found in 'J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\bin\Debug\GsViewer2.Tests.dll'.&#xA;Either assembly contains no tests or proper test driver has not been found." />
    </properties>
    <reason>
      <message>No suitable tests found in 'J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\bin\Debug\GsViewer2.Tests.dll'.
Either assembly contains no tests or proper test driver has not been found.</message>
    </reason>
  </test-suite>
</test-run>
Collaborator

espenalb commented Dec 15, 2015

This is the test report:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="2" testcasecount="0" result="Failed" label="Invalid" total="0" passed="0" failed="0" inconclusive="0" skipped="0" asserts="0" engine-version="3.0.5813.39036" clr-version="4.0.30319.42000" start-time="2015-12-15 10:54:30Z" end-time="2015-12-15 10:54:30Z" duration="0.006484">
  <command-line><![CDATA[J:\Jenkins\jobs\GsWindows-feature\workspace\\packages\NUnit.Console.3.0.1\tools\\nunit3-console.exe  J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\\bin\Debug\\GsViewer2.Tests.dll --result=J:\Jenkins\jobs\GsWindows-feature\workspace\artifacts\TestResults\IntegrationTests\GsViewer2.Tests.xml;format=nunit3 --where="cat=~MergeTests AND cat!~TestDurationLong" --result=J:\Jenkins\jobs\GsWindows-feature\workspace\\TestResults\\NUnit-GsViewer2.Tests.xml;format=nunit2 --x86]]></command-line>
  <filter>
    <and>
      <cat re="1">MergeTests</cat>
      <not>
        <cat re="1">TestDurationLong</cat>
      </not>
    </and>
  </filter>
  <test-suite type="Assembly" id="0-1" name="GsViewer2.Tests.dll" fullname="J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\bin\Debug\GsViewer2.Tests.dll" testcasecount="0" runstate="NotRunnable" result="Failed" label="Invalid">
    <properties>
      <property name="_SKIPREASON" value="No suitable tests found in 'J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\bin\Debug\GsViewer2.Tests.dll'.&#xA;Either assembly contains no tests or proper test driver has not been found." />
    </properties>
    <reason>
      <message>No suitable tests found in 'J:\Jenkins\jobs\GsWindows-feature\workspace\GsViewer.Tests\bin\Debug\GsViewer2.Tests.dll'.
Either assembly contains no tests or proper test driver has not been found.</message>
    </reason>
  </test-suite>
</test-run>
@anshooarora

This comment has been minimized.

Show comment
Hide comment
@anshooarora

anshooarora Dec 15, 2015

Member

Can you test with the latest 661fa1b to see if it works for you?

Member

anshooarora commented Dec 15, 2015

Can you test with the latest 661fa1b to see if it works for you?

@espenalb

This comment has been minimized.

Show comment
Hide comment
@espenalb

espenalb Dec 16, 2015

Collaborator

Works perfectly. Excellent!
One minor suggestion: Maybe show the "reason" when there are no tests found?

Collaborator

espenalb commented Dec 16, 2015

Works perfectly. Excellent!
One minor suggestion: Maybe show the "reason" when there are no tests found?

@anshooarora

This comment has been minimized.

Show comment
Hide comment
@anshooarora

anshooarora Dec 16, 2015

Member

Adds message: ebd9301.

Member

anshooarora commented Dec 16, 2015

Adds message: ebd9301.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment