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

Discover and execute (both run and debug) xunit test in VS Code #382

Merged
merged 10 commits into from
May 31, 2016
Merged

Discover and execute (both run and debug) xunit test in VS Code #382

merged 10 commits into from
May 31, 2016

Conversation

troydai
Copy link
Contributor

@troydai troydai commented May 26, 2016

Demo

it's a gif, may take time to load
mn0xdmo - imgur

Brief

The change relies on a change in OmniSharp which supports test discovery and execution.

It also relies on startDebug command from VS Code to start debugger. For earlier version of VS Code, the debug test link won't show up on Code Lens.

Open question

How and where to show test result. Currently, the test result is shown in message box. Could there be a better way to organize and show test results?

@gregg-miskelly
Copy link
Contributor

Woohoo! Question: Is this stuff about ready to ship? Or do you need to more work first? The stuff currently in 'dev' is almost ready to ship. So if this will not be ready within the next week, I think we need another branch.

@troydai
Copy link
Contributor Author

troydai commented May 27, 2016

@gregg-miskelly besides the open question the PR surely needs more testing. Baring a major issue the main structure is in place. If new features are provisioned during the code review, they can be added incrementally afterwards.

There are small changes I'll make additionally. Specifically:

  1. Add a test panel in which test output are printed.
  2. More information for test result.

The only open question is how we report the test result. The current behavior is to report in the message box which is not idea.

I'm confident it is good enough for next week's ship. I'm not chasing a timeline here, but base on the exciting feedback I got from my demo, I really hope this can get to users early. Of course I'd like to have C# extension crew to take a look at the changes and give me more feedback.


export function registerDotNetTestRunCommand(server: OmnisharpServer): vscode.Disposable {
return vscode.commands.registerCommand(
'dotnet.test.run',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be listed in our package.json?

@gregg-miskelly
Copy link
Contributor

:shipit:

@troydai
Copy link
Contributor Author

troydai commented May 27, 2016

Thanks, I'll adjust the test message a bit and address the comments. Afterward this PR should be done. But I won't merge until the corresponding PR on OmniSharp side is merged (that shouldn't be blocked for too long).

@troydai
Copy link
Contributor Author

troydai commented May 28, 2016

@gregg-miskelly @DustinCampbell
I make some changes to address comments and changes in OmniSharp. Changes on the server side has been merged. A release is drafted: https://github.com/OmniSharp/omnisharp-roslyn/releases/tag/1.9-beta2.

@gregg-miskelly
Copy link
Contributor

@troydai LGTM. Dustin would need to comment on how to put the OmniSharp release on Azure blob storage, and if we want to do that now, or wait till we get closer to release.

return vscode.Disposable.from(d1, d2, d3, d4, d5);

return vscode.Disposable.from(d1, d2, d3, d4, d5,
dotnetTest.registerDotNetTestRunCommand(server),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe follow the same pattern as the rest of the disposables?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do.

@DustinCampbell
Copy link
Member

LGTM

I'll work on updating to a newer release of OmniSharp. It looks like 1.9-beta4 has all of the releases we'll need.

@troydai
Copy link
Contributor Author

troydai commented May 31, 2016

All set. Can somebody merge this for me?

@DustinCampbell DustinCampbell merged commit 969188d into dotnet:dev May 31, 2016

// dotnet-test endpoints

export interface GetTestStartInfoRequest {
Copy link
Member

Choose a reason for hiding this comment

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

Hey @troydai -- are these new v2 endpoints? If so, could you include them in the V2 namespace above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. i'll send another PR to fix this.

@kerryjiang
Copy link

I am looking forward to use this new feature!
I am trying to debug test using Visual Studio Code, but no luck for now.
I tried to add a new node in launch.json, but haven't make it work.

@gregg-miskelly
Copy link
Contributor

There is a release preview with this support:

@kerryjiang
Copy link

Thanks Greg, but after I installed the latest C# extension and then installed the debuger successfully, the omnisharp always show "starting" status.

There might be something wrong.

Thank you all the same!

@DustinCampbell
Copy link
Member

@kerryjiang, if you select View->Toggle Output from the menu and change the selector to "OmniSharp Log" what do you see?

@kerryjiang
Copy link

kerryjiang commented Jun 3, 2016

@DustinCampbell

The last log always be downloading...

[INFO] Starting OmniSharp at '/Users/kerryjiang/WorkShop/NRack/master/src/NRack.Base'...
[INFO] Installing to /Users/kerryjiang/.vscode/extensions/ms-vscode.csharp-1.1.2/.omnisharp
[INFO] Attempting to download omnisharp-1.9-beta4-osx-x64-netcoreapp1.0.tar.gz...
[INFO] Downloading to /var/folders/n2/vkp2byyx5vgbvz1cqk_phmc40000gn/T/tmp-92895XQ1dhrwgkZx.tmp...

@DustinCampbell
Copy link
Member

Are you behind a proxy? Have you configured it in VS Code?

@kerryjiang
Copy link

Not a proxy.
Probably is a network issue.

@gregg-miskelly
Copy link
Contributor

@kerryjiang did this ever wind up working for you?

@kerryjiang
Copy link

@gregg-miskelly @DustinCampbell

Thanks guys, it works now.
My network was really slow last night.

@BingyuLiu
Copy link

@gregg-miskelly

@andschwa and I have VS Code insiders edition, 1.3.0-1465425900, with C# extension 1.1.5, on Ubuntu 14.04. We have a .NET Core xUnit test file opened, but we do not have the link to run the test in the debugger that we see here.

Is this simply a Windows only feature, or not available in .NET Core? We cannot currently find a way to attach to dotnet test, as it executes as a child process. Short of writing a shim, what can we do?

@BingyuLiu
Copy link

FWIW we don't have a "Toggle OmniSharp log", are we missing something simple?

@DustinCampbell
Copy link
Member

@BingyuLiu, @andschwa: could you file an issue rather starting a conversation on PR that has already been merged?

@troydai
Copy link
Contributor Author

troydai commented Jun 9, 2016

@BingyuLiu please attack your test project while open the issue. It will be very helpful for us to investigate this issue. It is not Windows only feature.

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.

6 participants