I had two build steps in VSTS:
But after I upgraded to VS2017 the -XML tag is not working anymore. I changed step one to use this: test --logger "trx;LogFileName=TEST-results.xml"
but the second step throws an error " Invalid results file. Please make sure the Test Result Format field in the task matches the result format of the file "
Is there another way to run .NetCore tests on VSTS? or am I doing something wrong?
Thanks,
starain-MSFT's answer will work, unless you want/need the xunit tests to be logged using an xunit logger. In that case, you'll need to do two things.
<PackageReference Include="xunitxml.testlogger" Version="1.0.2-pre-rtm" />
dotnet test -a:. -l:xunit
dotnet test -a:. -l:xunit
-a:.
switch, which specifies the adapter path, is only necessary for CLI tools V15.0, in 15.1 that can be removed (as discussed here ). As of today, the VS2017 Hosted Queue is using 15.0, so you'll need the -a:.
on VSTS for now. The -l:xunit
uses the friendlyname, which I think isn't so friendly since you have to dig into the source code for the particular logger to find the attribute where it is specified (as seen here for xunit and here for trx) The docs for the -l
switch are spotty to say the least, but in the github for vstest, there is a document which talks about test loggers and links to their repositories and nuget packages, which after you look at the source for the friendlyname, gets you all the way there for whichever logger you need. If you need a custom logger, those are great examples to help understand how to implement.
Finally, the publish step that you used originally should be fine, since the output file is still called TestResults.xml
将“测试结果格式”更改为“发布测试的VSTest”结果步骤/任务,它会正确读取结果文件。
Use dotnet xunit
instead of dotnet test
. See Getting Started with .NET Core .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.