VsTest不起作用:框架版本设置是合适的,然后再试一次

时间:2018-02-01 09:11:51

标签: c# azure-devops xunit

我在步骤 Vstest 的游戏中遇到问题。 xunit测试运行良好,但最后我有一个错误,我无法解决它。 我的解决方案包含以下项目:

  • KapseoPlus.App:UWP
  • KapseoPlus.ViewModels:.Net Standard 2.0
  • KapseoPlus.DataAccess.Interfaces.Online:.Net Standard 2.0
  • KapseoPlus.DataAccess.Interfaces.Offline:.Net Standard 2.0
  • KapseoPlus.DataAccess.Online:.Net Standard 2.0
  • KapseoPlus.DataAccess.Offline:.Net Standard 2.0
  • KapseoPlus.Tests.ViewModels:.Net Core 2.0(xUnit)
  • KapseoPlus.Tools:.Net Standard 2.0

从我读过的内容来看,似乎我们需要将ViewModels项目放在.Net Core 2.0中才能运行。除了我不能参考UWP .net核心项目,它不起作用。

2018-01-31T16:00:27.1674177Z ##[section]Starting: VsTest - testAssemblies
2018-01-31T16:00:27.1726467Z ==============================================================================
2018-01-31T16:00:27.1726710Z Task         : Visual Studio Test
2018-01-31T16:00:27.1726909Z Description  : Run tests with Visual Studio test runner
2018-01-31T16:00:27.1727069Z Version      : 2.3.8
2018-01-31T16:00:27.1727217Z Author       : Microsoft Corporation
2018-01-31T16:00:27.1727415Z Help         : [More Information] (https://go.microsoft.com/fwlink/?LinkId=835764)
2018-01-31T16:00:27.1727603Z ==============================================================================
2018-01-31T16:00:29.7903816Z Run the tests locally using vstest.console.exe
2018-01-31T16:00:29.7907346Z ========================================================
2018-01-31T16:00:29.7908117Z Test selector : Test assemblies
2018-01-31T16:00:29.7908468Z Test assemblies : **\bin\Release\netcoreapp2.0\KapseoPlus.Tests.ViewModels.dll,**\obj\Release\netcoreapp2.0\KapseoPlus.Tests.ViewModels.dll
2018-01-31T16:00:29.7908951Z Test filter criteria : null
2018-01-31T16:00:29.7909208Z Search folder : d:\a\3\s
2018-01-31T16:00:29.7909472Z Run settings file : d:\a\3\s
2018-01-31T16:00:29.7909813Z Run in parallel : false
2018-01-31T16:00:29.7910075Z Run in isolation : false
2018-01-31T16:00:29.7911556Z Path to custom adapters : null
2018-01-31T16:00:29.7911854Z Other console options : /framework:".NETCoreApp,Version=v2.0"
2018-01-31T16:00:29.7912124Z Code coverage enabled : false
2018-01-31T16:00:29.7912645Z Rerun failed tests: false
2018-01-31T16:00:29.7913065Z vstest.console.exe, specified location : C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform
2018-01-31T16:00:31.2520701Z ========================================================
2018-01-31T16:00:51.8200129Z[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" d:\a\3\s\KapseoPlusApp\develop\KapseoPlus.Tests.ViewModels\bin\Release\netcoreapp2.0\KapseoPlus.Tests.ViewModels.dll d:\a\3\s\KapseoPlusApp\develop\KapseoPlus.Tests.ViewModels\obj\Release\netcoreapp2.0\KapseoPlus.Tests.ViewModels.dll /logger:trx "/TestAdapterPath:\"d:\a\3\s\"" /framework:.NETCoreApp, Version= v2.0
2018-01-31T16:00:52.8446006Z Microsoft (R) Test Execution Command Line Tool Version 15.5.0
2018-01-31T16:00:52.8446943Z Copyright (c) Microsoft Corporation.All rights reserved.
2018-01-31T16:00:52.8447292Z
2018-01-31T16:00:57.1694969Z Starting test execution, please wait...
2018-01-31T16:01:14.9034185Z[xUnit.net 00:00:08.5971876] Discovering: KapseoPlus.Tests.ViewModels
2018-01-31T16:01:15.0893853Z[xUnit.net 00:00:08.8032528] Discovered:  KapseoPlus.Tests.ViewModels
2018-01-31T16:01:15.0986393Z[xUnit.net 00:00:08.8128145] Starting:    KapseoPlus.Tests.ViewModels
2018-01-31T16:01:16.5384403Z Passed   KapseoPlus.Tests.ViewModels.TestSelectionDomainePageViewModel.IsNotEmptyDomaineList
2018-01-31T16:01:16.5751928Z Passed   KapseoPlus.Tests.ViewModels.TestCommentaireMiseEnAttenteViewModel.LastTicketEnAttente
2018-01-31T16:01:16.5752431Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 10.01, article_TauxTva: 5.5)
2018-01-31T16:01:16.5752810Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 0.05, article_TauxTva: 5.5)
2018-01-31T16:01:16.5753163Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 0.09, article_TauxTva: 2.1)
2018-01-31T16:01:16.5753493Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 99.09998, article_TauxTva: 2.1)
2018-01-31T16:01:16.5753844Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 10.09, article_TauxTva: 5.5)
2018-01-31T16:01:16.5756125Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 0.05, article_TauxTva: 2.1)
2018-01-31T16:01:16.7205288Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 10, article_TauxTva: 5.5)
2018-01-31T16:01:16.7206531Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 0.09, article_TauxTva: 20)
2018-01-31T16:01:16.7207841Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 99.09998, article_TauxTva: 5.5)
2018-01-31T16:01:16.7208726Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 0.01997512, article_TauxTva: 2.1)
2018-01-31T16:01:16.7209366Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 99.09998, article_TauxTva: 20)
2018-01-31T16:01:16.7209863Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 99.01997, article_TauxTva: 2.1)
2018-01-31T16:01:16.7210343Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_ValeurPrixUnitaireHorsTaxes2Decimals_When_LigneTicket_Created(article_prixUnitaireTTC: 0.09, article_TauxTva: 5.5)
2018-01-31T16:01:16.7211132Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Mettre_Ticket_EnAttente_Possible_Si_Ticket_Non_Vide
2018-01-31T16:01:16.7211612Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.BaisserQuantite_Sur_ligne_Ticket
2018-01-31T16:01:16.8354602Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.ReconnaissanceArticleByCodeArticle_Check_Ajout_LigneTicket
2018-01-31T16:01:16.8355300Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Check_TicketVide_When_ViewModel_Created
2018-01-31T16:01:16.8355602Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Retirer_Ligne_Ticket
2018-01-31T16:01:16.8355969Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Encaissement_SansMontant_Donné
2018-01-31T16:01:16.8356275Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Mettre_Ticket_EnAttente_Impossible_Si_Ticket_Vide_Ou_Encaisse
2018-01-31T16:01:16.8356605Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Encaissement_Remboursement_Avec_Montant_Donné
2018-01-31T16:01:16.8356894Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Encaissement_AvecMontant_Donné
2018-01-31T16:01:16.8357111Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Retirer_Ticket
2018-01-31T16:01:16.8357370Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.AugmenterQuantite_Sur_ligne_Ticket
2018-01-31T16:01:18.3458896Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.ReconnaissanceArticleByCodeBarre_Check_Ajout_LigneTicket
2018-01-31T16:01:18.3460562Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.ReconnaissanceArticleByCodeArticle_Check_DoNothingIfEmpty
2018-01-31T16:01:18.3461181Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Encaissement_Remboursement_Sans_Montant_Donné
2018-01-31T16:01:18.3461951Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.Mettre_Ticket_EnAttente_TicketCourant_Renouvele
2018-01-31T16:01:18.3462403Z Passed   KapseoPlus.Tests.ViewModels.TestCaissePageViewModel.ReconnaissanceArticleByCodeArticle_Check_DoNothingIfNoArticle
2018-01-31T16:01:18.3462855Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.GetAllTickets
2018-01-31T16:01:18.3464683Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.AddLigneTicket_InitialQuantity
2018-01-31T16:01:18.6559570Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.Add_Article
2018-01-31T16:01:18.6560042Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.AddTicket
2018-01-31T16:01:18.6560255Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.AddEncaissement
2018-01-31T16:01:18.6560461Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.GetAllTicketByStatutType
2018-01-31T16:01:18.6560778Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.CheckStatutTicketTransition
2018-01-31T16:01:18.6561001Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.AddLigneTicket_UpdateQuantity
2018-01-31T16:01:18.6561718Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.RetirerLigneticket
2018-01-31T16:01:18.6561952Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.AddTVA
2018-01-31T16:01:18.6562148Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.UpdateArticle
2018-01-31T16:01:18.6780148Z[xUnit.net 00:00:12.3919874] Finished:    KapseoPlus.Tests.ViewModels
2018-01-31T16:01:18.7775035Z Passed   KapseoPlus.Tests.ViewModels.TestEncaissementService.ReprendreTicket
2018-01-31T16:01:18.8192784Z No test is available in d:\a\3\s\KapseoPlusApp\develop\KapseoPlus.Tests.ViewModels\obj\Release\netcoreapp2.0\KapseoPlus.Tests.ViewModels.dll.Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate and try again.
2018-01-31T16:01:18.9329691Z 
2018-01-31T16:01:18.9336552Z Total tests: Unknown.Passed: 43. Failed: 0. Skipped: 0.
2018-01-31T16:01:18.9336867Z Test Run Aborted.
2018-01-31T16:01:18.9348453Z Test execution time: 19.3283 Seconds
2018-01-31T16:01:18.9749184Z Results File: d:\a\3\s\TestResults\VssAdministrator_factoryvm-az308_2018-01-31_16_01_16.trx
2018-01-31T16:01:19.0000302Z ##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
2018-01-31T16:01:19.1702369Z ##[error]Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe failed with return code: 1
2018-01-31T16:01:22.4205965Z ##[error]VsTest task failed.
2018-01-31T16:01:22.6303021Z ##[section]Async Command Start: Publish test results
2018-01-31T16:01:22.8045344Z Publishing test results to test run '12'
2018-01-31T16:01:22.8045618Z Test results remaining: 43. Test run id: 12
2018-01-31T16:01:23.5931259Z Published Test Run : https://aleda-france.visualstudio.com/KapseoPlus/_TestManagement/Runs#runId=12&_a=runCharts
2018-01-31T16:01:23.5931871Z ##[section]Async Command End: Publish test results
2018-01-31T16:01:23.5933611Z ##[section]Finishing: VsTest - testAssemblies

1 个答案:

答案 0 :(得分:1)

在Visual Studio测试任务的测试程序集框中使用以下代码:

**\bin\Release\netcoreapp2.0\KapseoPlus.Tests.ViewModels.dll
!**\obj\**