Результаты покрытия кода не сообщаются после успешного завершения этапа Visual Studio Test - PullRequest
0 голосов
/ 05 мая 2018

У меня очень простой проект в моей учетной записи VSTS с несколькими тестами. Я добавил шаг VsTest в сборку и установил флажок покрытия кода. Однако после запуска сборки написано «нет результатов покрытия кода» и предлагается добавить шаг сборки теста Visual Studio в свою сборку. Но когда я добавляю один, он аналогичен шагу VsTest, который у меня уже есть.

Как получить покрытие кода из моей сборки VSTS?

РЕДАКТИРОВАТЬ: Журналы испытаний ниже. Были две части с большим количеством специальных символов, которые я не мог скопировать и вставить.

    2018-05-04T21:51:59.5221025Z ##[section]Starting: VsTest - testAssemblies
    2018-05-04T21:51:59.5227667Z ==============================================================================
    2018-05-04T21:51:59.5227804Z Task         : Visual Studio Test
    2018-05-04T21:51:59.5227968Z Description  : Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test runner. Test frameworks that have a Visual Studio test adapter such as xUnit, NUnit, Chutzpah, etc. can also be run. Tests can be distributed on multiple agents using this task (version 2).
    2018-05-04T21:51:59.5228145Z Version      : 2.5.8
    2018-05-04T21:51:59.5228227Z Author       : Microsoft Corporation
    2018-05-04T21:51:59.5228339Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=835764)
    2018-05-04T21:51:59.5228918Z ==============================================================================
    2018-05-04T21:52:00.6581473Z Run the tests locally using vstest.console.exe
    2018-05-04T21:52:00.6581612Z ========================================================
    2018-05-04T21:52:00.6582115Z Test selector : Test assemblies
    2018-05-04T21:52:00.6582269Z Test assemblies : **\release\**\*.dll
    2018-05-04T21:52:00.6582399Z Test filter criteria : null
    2018-05-04T21:52:00.6582534Z Search folder : D:\a\1\s
    2018-05-04T21:52:00.6582658Z Run settings file : D:\a\1\s
    2018-05-04T21:52:00.6582831Z Run in parallel : false
    2018-05-04T21:52:00.6582954Z Run in isolation : false
    2018-05-04T21:52:00.6584318Z Path to custom adapters : null
    2018-05-04T21:52:00.6584486Z Other console options : null
    2018-05-04T21:52:00.6584627Z Code coverage enabled : true
    2018-05-04T21:52:00.6584910Z Rerun failed tests: false
    2018-05-04T21:52:00.6585116Z VisualStudio version selected for test execution : latest
    2018-05-04T21:52:01.5193379Z ========================================================
    2018-05-04T21:52:01.5908190Z [command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" @D:\a\_temp\60315131-4fe5-11e8-9269-e9217bdc2ba0.txt
    2018-05-04T21:52:06.6551385Z Microsoft (R) Test Execution Command Line Tool Version 15.6.2
    2018-05-04T21:52:06.6552014Z Copyright (c) Microsoft Corporation.  All rights reserved.
    2018-05-04T21:52:06.6552213Z 
    2018-05-04T21:52:06.8162937Z vstest.console.exe 
    2018-05-04T21:52:06.8164594Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\Microsoft.VisualStudio.CodeCoverage.Shim.dll"
    2018-05-04T21:52:06.8165659Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\TestTesting.dll"
    2018-05-04T21:52:06.8166614Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.abstractions.dll"
    2018-05-04T21:52:06.8167552Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.assert.dll"
    2018-05-04T21:52:06.8168335Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.core.dll"
    2018-05-04T21:52:06.8169121Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.execution.desktop.dll"
    2018-05-04T21:52:06.8169879Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.runner.reporters.net452.dll"
    2018-05-04T21:52:06.8170678Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.runner.utility.net452.dll"
    2018-05-04T21:52:06.8171460Z "D:\a\1\s\TestTesting\TestTesting\bin\Release\net461\xunit.runner.visualstudio.testadapter.dll"
    2018-05-04T21:52:06.8172221Z "D:\a\1\s\TestTesting\TestTesting\obj\Release\net461\TestTesting.dll"
    2018-05-04T21:52:06.8172936Z /EnableCodeCoverage
    2018-05-04T21:52:06.8173974Z /logger:"trx"
    2018-05-04T21:52:06.8174130Z /TestAdapterPath:"D:\a\1\s"
    2018-05-04T21:52:10.5221260Z Starting test execution, please wait...
    2018-05-04T21:52:10.9446034Z Test run will use DLL(s) built for framework .NETFramework,Version=v4.6.1 and platform X86. Following DLL(s) do not match framework/platform settings.
    2018-05-04T21:52:10.9446506Z xunit.assert.dll is built for Framework 1.1 and Platform AnyCPU.
    2018-05-04T21:52:10.9446876Z xunit.core.dll is built for Framework 1.1 and Platform AnyCPU.
    2018-05-04T21:52:10.9447201Z xunit.execution.desktop.dll is built for Framework 4.5.2 and Platform AnyCPU.
    2018-05-04T21:52:10.9449027Z xunit.runner.reporters.net452.dll is built for Framework 4.5.2 and Platform AnyCPU.
    2018-05-04T21:52:10.9449230Z xunit.runner.utility.net452.dll is built for Framework 4.5.2 and Platform AnyCPU.
    2018-05-04T21:52:10.9449440Z xunit.runner.visualstudio.testadapter.dll is built for Framework 4.5.2 and Platform AnyCPU.
    2018-05-04T21:52:10.9449631Z Go to http://go.microsoft.com/fwlink/?LinkID=236877&clcid=0x409 for more details on managing these settings.
    2018-05-04T21:52:10.9449774Z 

    [[Uncopyable part here. What I could read spelled out "Microsoft Coverage Collection", followed by a copyright.

    2018-05-04T21:52:31.9257584Z [xUnit.net 00:00:00.9144322]   Discovering: Microsoft.VisualStudio.CodeCoverage.Shim
    2018-05-04T21:52:32.0551765Z [xUnit.net 00:00:01.0599884]   Discovered:  Microsoft.VisualStudio.CodeCoverage.Shim
    2018-05-04T21:52:32.4727660Z [xUnit.net 00:00:01.4776210]   Discovering: TestTesting
    2018-05-04T21:52:32.7346755Z [xUnit.net 00:00:01.7395514]   Discovered:  TestTesting
    2018-05-04T21:52:32.7417690Z [xUnit.net 00:00:01.7468703]   Starting:    TestTesting
    2018-05-04T21:52:33.2084443Z [xUnit.net 00:00:01.9469140]     TestTesting.Tests.Skipped [SKIP]
    2018-05-04T21:52:33.2085046Z [xUnit.net 00:00:01.9471459]       Skipping
    2018-05-04T21:52:33.2085275Z [xUnit.net 00:00:01.9542762]   Finished:    TestTesting
    2018-05-04T21:52:33.2881381Z [xUnit.net 00:00:02.2931214]   Discovering: xunit.abstractions
    2018-05-04T21:52:33.3305957Z [xUnit.net 00:00:02.3357501]   Discovered:  xunit.abstractions
    2018-05-04T21:52:34.0395297Z [xUnit.net 00:00:03.0443103]   Discovering: xunit.runner.reporters.net452
    2018-05-04T21:52:34.1043673Z [xUnit.net 00:00:03.1090663]   Discovered:  xunit.runner.reporters.net452
    2018-05-04T21:52:34.4684448Z Passed   TestTesting.Tests.Passing
    2018-05-04T21:52:34.8614665Z Skipped  TestTesting.Tests.Skipped
    2018-05-04T21:52:34.8620656Z Standard Output Messages:
    2018-05-04T21:52:34.8620971Z  Skipping
    2018-05-04T21:52:34.8625877Z Passed   TestTesting.Tests.NoLongerFailing
    2018-05-04T21:52:36.1389527Z [xUnit.net 00:00:05.1437439]   Discovering: xunit.runner.utility.net452
    2018-05-04T21:52:36.2616608Z [xUnit.net 00:00:05.2660797]   Discovered:  xunit.runner.utility.net452

    [[Uncopyable part repeated here.]]

    2018-05-04T21:52:38.5800594Z Attachments:
    2018-05-04T21:52:38.5800836Z   D:\a\1\s\TestResults\b0d720b3-9bb9-4318-bb6b-7bfa8e404a13\VssAdministrator_factoryvm-az384 2018-05-04 21_52_18.coverage
    2018-05-04T21:52:38.5801023Z 
    2018-05-04T21:52:38.5801196Z Total tests: 3. Passed: 2. Failed: 0. Skipped: 1.
    2018-05-04T21:52:38.5801368Z Test Run Successful.
    2018-05-04T21:52:38.5809597Z Test execution time: 19.0295 Seconds
    2018-05-04T21:52:38.6045339Z Results File: D:\a\1\s\TestResults\VssAdministrator_factoryvm-az384_2018-05-04_21_52_34.trx
    2018-05-04T21:52:38.9702367Z ##[section]Async Command Start: Publish test results
    2018-05-04T21:52:39.1587014Z Publishing test results to test run '3'
    2018-05-04T21:52:39.1587207Z Test results remaining: 3. Test run id: 3
    2018-05-04T21:52:39.6699238Z Published Test Run : https://wjtesttesting.visualstudio.com/MyFirstProject/_TestManagement/Runs#runId=3&_a=runCharts
    2018-05-04T21:52:39.6700510Z ##[section]Async Command End: Publish test results
    2018-05-04T21:52:39.6701395Z ##[section]Finishing: VsTest - testAssemblies

enter image description here

enter image description here

[РЕДАКТИРОВАТЬ 2]: Стариан Чен спросил журналы с System.Debug, установленным в true. Они превышают ограничение размера SO, поэтому я ссылаюсь на них ниже:

Журнал сборки VSTS

Журнал испытаний VSTS

РЕДАКТИРОВАТЬ 3: Когда я указываю структуру в «Другие параметры консоли» моего шага сборки VsTest:

/framework:"Framework461"

Кажется, я недоволен моей версией. Он предоставляет список поддерживаемых платформ, самая высокая из которых - «Framework45».

Редактировать 4: я пытался проект net452, с "Framework45". В этом случае тесты выполнялись с помощью инструкций Starian Chen здесь , просто заменив "Framework45" на "netcoreapp2.0". Однако до сих пор не было отчета о покрытии кода.

1 Ответ

0 голосов
/ 09 мая 2018

В тестовом проекте .Net Framework вам не нужно указывать framework и путь vstest.console.exe в тестовой задаче Visual Studio.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...