NUnit 3 upgrade breaking build

baynezy's Avatar

baynezy

22 Dec, 2015 03:34 PM

I had been watching this issue http://help.appveyor.com/discussions/problems/2586-nunit-3 and was pleased to see that NUnit 3 support has been added.

I have upgraded several of my projects, but any that require reading local files fail after upgrading from 2.x to 3.x.

As you can see I did nothing other than update NuGet package version.
https://github.com/baynezy/Html2Markdown/commit/08292dbb99ca55159937a91b9c5a836966c676d4

However, any build of the project with NUnit 3.x fails. E.g. https://ci.appveyor.com/project/baynezy/html2markdown/build/1.0.90

I get a System.IO.DirectoryNotFoundException error:

    1) Error : Html2Markdown.Test.ConverterTest.ConvertFile_WhenReadingInHtmlFile_ThenConvertToMarkdown
    System.IO.DirectoryNotFoundException : Could not find a part of the path 'C:\Files\TestHtml.txt'.
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
       at System.IO.StreamReader..ctor(String path)
       at Html2Markdown.Converter.ConvertFile
    (String path) in C:\projects\html2markdown\src\Html2Markdown\Converter.cs:line 159
       at Html2Markdown.Test.ConverterTest.CheckFileConversion(String path, String expected) in C:\projects\html2markdown\test\Html2Markdown.Test\ConverterTest.cs:line 959
       at Html2Markdown.Test.ConverterTest.ConvertFile_WhenReadingInHtmlFile_ThenConvertToMarkdown() in C:\projects\html2markdown\test\Html2Markdown.Test\ConverterTest.cs:line 761

The code for this test is very simple.

     [Test]
        public void ConvertFile_WhenReadingInHtmlFile_ThenConvertToMarkdown()
        {
            const string sourcePath = @"..\..\Files\TestHtml.txt";
            const string expected = @"## Installing via NuGet
        Install-Package Html2Markdown
## Usage
        var converter = new Converter();
        var result = converter.Convert(html);";

            CheckFileConversion(sourcePath, expected);
        }

The obvious issue is that something about NUnit 3.x changes how the relative path executes.

Please help.

  1. Support Staff 1 Posted by Feodor Fitsner on 22 Dec, 2015 11:37 PM

    Feodor Fitsner's Avatar

    I think you'd better ask that question on NUnit issues: https://github.com/nunit/nunit/issues

    But anyway, I'd rather avoid using relative paths in tests and rely on configuration settings (or environment variables) instead.

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:03 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac