Using XUnit with Visual Studio Online

2019-04-11 09:08发布

I've setup my build as below using the build definition. I'm using XUnit and locally my tests are discovered and run. I've tested the glob **\*spec*.dll and it finds all my test dlls and the build log shows that those dlls are in fact built.

enter image description here

However in the build log I get

Run VS Test Runner

No test found. Make sure that installed test
discoverers & executors, platform & framework
version settings are appropriate and try again.

Which seems to suggest it is trying to use the MSTest test runner instead of the XUnit test runner. How do I tell the build for visual studio online to use the XUnit test runner and discoverer?

1条回答
劫难
2楼-- · 2019-04-11 09:10

This might be out of date now, but this is how I have it setup and working - downvote and let me know if it's wrong and I'll delete this. I got it from a blog post/MSDN page, but I can't locate it any more.

First you need to create a TFVC Team Project (doesn't matter if you don't use it again).

Into $/MyTFVC/BuildProcessTemplate/CustomActivities/

Checking the following files from xunit.net:

Files

Now in VS, click the BUILD, Manage Build Controllers... option. Select the "Hosted Build Controller (Hosted)" and click "Properties...".

Enter the path where you checked in the DLL's into the "Version control path to custom assemblies" field:

enter image description here

You should be good to go.

查看更多
登录 后发表回答