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

Get NUnit test running/debugging working #834

Merged
merged 3 commits into from
Apr 27, 2017

Conversation

DustinCampbell
Copy link
Contributor

Fixes dotnet/vscode-csharp#1434

This change updates the test manager to pass dummy RunSettings, which allows the latest NUnit alpha to work (the NUnit test adapter does not handle null RunSettings). In addition, this updates our NUnit test project to use the latest NUnitTestAdapter CI build and uncomments the NUnit tests. When there's an official NUnitTestAdapter release, we'll want to update the test project to reference that and get rid of its NuGet.config.

cc @bernardbr and @rprouse

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AppVeyor NUnit CI Feed" value="https://ci.appveyor.com/nuget/nunit" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but you don't need this line/feed unless you want to pull in pre-release versions of the NUnit Framework. The adapter PR only uses the Engine and Adapter feeds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as there's an NUnitTestAdapter on nuget.org that we can use, I'll just delete this file.

// When it does, the NUnitTestProject should be updated and the tests below re-enabled.

//[Fact]
[Fact]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing NUnit with xUnit, ironic 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, NUnit doesn't work yet, so...

@rprouse
Copy link

rprouse commented Apr 27, 2017

Looks good. At my end, I will push an update to the adapter to handle null RunSettings.

@bernardbr
Copy link

Thank you very much @DustinCampbell and @rprouse !

Noob's Question: How can I use this version of omni-sharp? 😄

@DustinCampbell
Copy link
Contributor Author

@bernardbr: I'll be producing a new omnisharp-vscode beta later today with this fix.

@bernardbr
Copy link

Ok @DustinCampbell
Thanks again!

@DustinCampbell
Copy link
Contributor Author

Alright. CI passed again. I'm going to go ahead and merge.

@DustinCampbell DustinCampbell merged commit 9951f13 into OmniSharp:dev Apr 27, 2017
@DustinCampbell DustinCampbell deleted the fix-nunit branch April 27, 2017 20:53
@rprouse
Copy link

rprouse commented Apr 28, 2017

@bernardbr I fixed this in the NUnit adapter also with nunit/nunit3-vs-adapter@d345c72 and the NuGet package 4.0.0-ci-00455-pr-313 and newer should work without these fixes.

@bernardbr
Copy link

bernardbr commented Apr 28, 2017

Hello @rprouse!
Can you help me to see what I did wrong?
I do the update of Test Adapter for the version you've mentioned, but the "null" error still occurring!
UnitTest.zip

Thanks!

##Editing
I'm using the release version of omnisharp 1.9.0...

@rprouse
Copy link

rprouse commented Apr 28, 2017

@bernardbr It isn't working for me either. I am attempting to debug and will report back.

@DustinCampbell
Copy link
Contributor Author

Try the 1.10.0-beta1 release of C# for VS Code I created last night. Follow these steps Installing Beta Releases.

@rprouse
Copy link

rprouse commented Apr 28, 2017

@DustinCampbell your fix is working. I just can't figure out why my fix isn't working and I am having trouble debugging with all the layers. What is troubling me is that I believe your fix confirmed my diagnosis that we weren't handling a null RunSettings and I switched our code to use defaults if it is null or empty along with unit tests to prove that it works. I've spent the last hour digging through our code, but there are no other usages. My test is effectively the same as yours, just at our end.

Is there anyway to get the callstack like you displayed in the issue without a debug compile?

image

@DustinCampbell
Copy link
Contributor Author

Not without a compile of OmniSharp without my change. That's not actually too big of a deal. I usually do it like so on Windows:

  1. Get latest from omnisharp-roslyn dev branch and run build.cmd
  2. Open OmniSharp.sln in VS 2017 and build
  3. In VS Code, select Preferences->User Settings from the menu and add the following setting to the settings.json:
"omnisharp.path": "<path to your omnisharp folder>/OmniSharp/bin/Debug/net46/OmniSharp.exe"
  1. Open your test project in VS Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants