aspnet/Testing

Run tests on published test project

Closed this issue · 2 comments

I'm trying to publish tests and then run them in the Release stage using VSTS Release Management. I would like to copy over the test project publish output to run in the release pipeline.

My project is:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
    <PackageReference Include="xunit" Version="2.2.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
  </ItemGroup>
</Project>

Steps with the dotnet cli are:

dotnet new xunit
dotnet restore
dotnet publish -c Release -o test-output
cd test-output
dotnet .\my-test-project.dll

The result of this just returns with no output

Steps with VSTest.console.exe:

dotnet new xunit
dotnet restore
dotnet publish -c Release -o test-output
cd test-output
VSTest.Console.exe /UseVsizExtensions:true /logger:trx /TestAdapterPath:. my-test-project.dll

The result of this is the warning: "Warning: No test is available in my-test-project.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again."

Am I able to test a published dll that contains XUnit Fact definitions just from the dll. It would seem at this stage I need to publish the whole folder with the csproj and source and then restore, and test from Release Management?

This isn't an ASP.NET specific problem. I'd start with http://github.com/Microsoft/vstest.

Thanks, I'll repost over there.