Nice programing

테스트가 없습니다.

nicepro 2020. 10. 16. 08:05
반응형

테스트가 없습니다. 설치된 테스트 발견 자 및 실행기, 플랫폼 및 프레임 워크 버전 설정이 적절한 지 확인하고 다시 시도하십시오.


기존 솔루션을 .Net 4.6.1로 업그레이드하는 중이며 서버 빌드 중에 단위 테스트를 실행할 수 없습니다. 로컬에서는 예상대로 실행되고 프레임 워크 버전을 .Net 4.5.1로 되 돌리면 서버에서 다시 실행됩니다.

다음과 같은 오류가 발생합니다.

테스트가 없습니다. 설치된 테스트 발견 자 및 실행기, 플랫폼 및 프레임 워크 버전 설정이 적절한 지 확인하고 다시 시도하십시오.

더 간단한 설정으로 문제를 재현했습니다.

  • 두 개의 테스트 (하나는 실패, 하나는 통과)가 포함 된 단일 C # 단위 테스트 프로젝트가있는 솔루션입니다.
  • 기본 템플릿 (TfvcTemplate.12.xaml)을 사용한 XAML 빌드 정의
  • Visual Studio Enterprise 2015 업데이트 1이 설치된 TFS 2015 업데이트 1 XAML 빌드 서버 (6 개의 유사한 서버가 있고 모두 동일한 결과를 생성 함)

테스트 설정에서 기본 프로세서 아키텍처 를 X86에서 X64 로 변경할 수 있습니다 . 제 경우에는 이것이 문제였습니다.

이는 테스트중인 프로젝트의 플랫폼 대상이로 설정된 경우 발생합니다 x64.

테스트 설정 스크린 샷


내 빌드도 테스트를 찾지 못했습니다. 테스트를 찾기위한 설정 및 솔루션은 다음과 같습니다.

VSTS (Visual Studio Team Services)를 사용하고 모든 빌드에서 NUGET 패키지를 새로 고치도록 구성된 빌드가 있습니다. NUnit을 사용하고 있으며 다음 NUGET 명령 (Visual Studio의 패키지 관리자 콘솔에서)을 실행하여 NUnitTestAdapter 라이브러리를 내 테스트 프로젝트에 추가하고 packages.config에서 확인하면 테스트가 내 VSTS 빌드에서 실행된다는 것을 발견했습니다.

Install-Package NUnitTestAdapter

Maurice가 NUnit3에 대한이 게시물에 대한 의견에서 언급했듯이 다음 NUGET 패키지를 사용하십시오 (링크에서 다른 유틸리티를 찾으십시오. 예 : dotnet CLI 및 Paket CLI).

Install-Package NUnit3TestAdapter

도움이 되었기를 바랍니다.


제 경우에는 :

1) 테스트 proj를 netcore 2.0으로 변환 (이전 netstandard 2.0)

2) 너겟 패키지 추가 xunit.runner.visualstudio

참조 : http://www.neekgreen.com/2017/11/20/xunit-no-test-is-available/


이 오류가 발생하여 해결할 수있었습니다.

  1. Visual Studio Professional 2017을 사용합니다.
  2. VS에서 도구-> 확장 및 업데이트로 이동했습니다.
  3. 메뉴 상단에서 NUnit 어댑터가 비활성화 된 것을 확인했습니다.
  4. [사용] 버튼을 클릭했습니다
  5. 오류없이 테스트를 시작할 수있었습니다.

MSTest를 사용하고 있습니다. 나를 위해, 그것은이었다 버전 missmatch 다른 종속 패키지 누락은 -

1) 내 패키지 폴더에는 MSTest.TestFramework.1.2.1 패키지 만 포함되어 있습니다. 내 프로젝트 파일 (.csproj)에서 Target Name의 참조는 패키지 폴더에없는 MSTest.TestAdapter.1.2.0 패키지였습니다. 내 packages.config에는 MSTest.TestFramework.1.2.0에 대한 참조도 있습니다.

2) 그래서 Nuget 패키지 관리자에서 MSTest.TestAdapter.1.2.0을 설치하고 프로젝트 및 패키지 파일에서 MSTest.TestFramework 버전을 1.2.0에 맞 춥니 다. 마지막으로 참조에 Microsoft.VisualStudio.TestPlatform.TestFramework 및 Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions를 추가합니다.

그런 다음 모든 것이 괜찮 았습니다. 이것이 누군가를 돕기를 바랍니다.


이 문제는 Visual Studio 2017에서 다시 나타납니다. 다른 버그 일 가능성이 높지만 결과는 같습니다.

작동하는 것으로 보이는 한 가지 해결 방법은 영향을받는 컴퓨터에서 Microsoft Visual Studio 2017 원격 디버거를 제거하는 것입니다.


.Net 4.6.2를 사용하는 VSTS에서 동일한 문제가 발생했습니다. VSTS 콘솔 출력에서이 내용이 표시되는 경우 @Sushil에서 제공하는 해결 방법이 여전히 VSTS에서 작동하며 필요합니다. 불행히도 Microsoft에서 제공하는 "Test Assemblies"작업은 통과하므로 출력을 확인하고 실제로 실행 된 테스트가 하나도 발견되지 않으면 문제가 있다는 사실조차 알지 못합니다!

VSTS 테스트 수정


VS 2017 및 4.6.2 테스트 프로젝트에서 다음 단계로 문제를 해결했습니다.

  1. Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 및 확장에 대한 참조 제거
  2. Microsoft.VisualStudio.QualityTools.UnitTestFramework.Updated nuget 패키지를 설치합니다.

  1. NUGET 패키지에서 Nunit 및 NUnitTestAdapter 최신 버전을 설치합니다.
  2. ----> 테스트 -----> 테스트 설정 ---> 기본 프로세서 아키텍처 ------> X64로 변경
  3. 솔루션을 구축하십시오.
  4. 이렇게하면 단위 테스트에서 테스트 실행 및 디버거 문제가 해결되고 작동이 시작됩니다.

이것은 현재 .Net 4.6의 알려진 문제입니다.

TFS 2015 UPdate1을 사용하여 XAML TFS 빌드의 일부로 .Net 4.6.x 단위 테스트를 실행할 수 없음 소스 : https://connect.microsoft.com/VisualStudio/feedback/details/2245723

다음은 유사한 질문 입니다. TFS 2015 XAML 빌드 서버의 .Net 4.6 단위 테스트를 실행할 수 없습니다 .


"Microsoft.NET.Test.Sdk"너겟이 설치되어 있는지 확인하십시오.


비슷한 문제가 발생하고 어떻게 든 app.config파일이 테스트 프로젝트에 추가되었음을 알았 습니다. 이 구성 파일을 제거하면 문제가 해결되었습니다.


프로젝트의 모든 테스트 관련 NuGet 패키지를 다시 설치하여이 문제를 해결했습니다 : Xunit, Xunit.runner.vistualstudio, Microsoft.Net.Test.Sdk


I'll throw my solution onto the heap. In my case, I am adding a couple of projects to an existing solution along with Test projects for them. We're using MSTest. There was a previous UnitTest.testsettings file enabled on the solution that was causing compatibility issues.

Clicking on the settings file removed the check and the test run was successful for my tests.

여기에 이미지 설명 입력


Found a way! Probably not the most orthodox but it did helped me out in a hurry:

  1. Update the MSTest.TestAdapter and MSTest.TestAdapterFramework packages to the 1.4.0 from the Tools > NuGet Package Manager.
  2. The clean the solution and run the tests again.

I don't think is anything particular with the version, but updating it certainly cleans whatever reference is bad in the solution/project.


If you are running your tests inside docker using multistage building and tests aren't found. Make sure you copy all files not only project files like below Dockerfile section.

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["MainProject/FirstApp.csproj", "MainProject/"]
COPY ["TestProject/*", "TestProject/"]

RUN dotnet restore "TestProject/TestProject.csproj"
RUN dotnet build "TestProject/TestProject.csproj" -c Release
RUN dotnet test "TestProject/TestProject.csproj" -c Release

This is just to recap the solution brought forward by @Sushil earlier.

This is a known issue in Team Foundation Server 2015 RTM + Update 1 and will be fixed in Update 2, reference.

There is a workaround described by @Sushil here, which includes adding a .runsettings file that forces the test runner to older .Net framework (please not that you have to specify it through the "Add/Edit Test Run" dialog as adding it directly in the build process editor will be ignored).


Using .Net Core with a build pipeline in TFS 2017, my Visual Studio Test step was passing without actually executing any tests. Had to edit the step, "Advanced Execution Options" -> "Other console options" to include:

/framework:".NETCoreApp,Version=v2.0"

(That field also contains /platform:x64)


In Visual Studio 2017 I just uninstall and reinstall NUnitTestAdapter or install new package like NUnitTestAdapter.WithFramework package and problem gone.


I got this error because my Unit test class was not public.

Ex:

class ClientTests

Error in Output:

...\bin\Debug\Tests.dll] UTA001: TestClass attribute defined on non-public class ClientTests

Correction:

public class ClientTests


I faced the similar issue when tried nUnit in VS 2017 and it's not a core project. Installing NUnit3TestAdapter fixed the issue.


I am having the same issue. I am using Visual Studio 2017 Community Edition.

여기에 이미지 설명 입력

I used these steps to successfully discover all my test cases and successfully run it:

  • First go to Extensions and Updates, install NUnit3 Test Adapter. If you already have, just enable it.

  • Restart your Visual Studio 2017, it will automatically prompt to
    install your extension, if a prompt says to end task to continue
    installing, just click "End Task".

  • After that, rebuild your Test Project and all test cases will now be identified and you can now start running your test cases.


In my case Reinstalling Nunit3 Adapter, Deleting temp folders, Changing architecture and nothing worked. Its because of the Daemon Resharper caused the problem.

Add or Remove Programs> Find Resharper > Repair > Install again > Restart VS 

That resolves the issues.


This error can happen for async tests if you have the wrong return type. The return type should be Task, and not void.


After add the TestAdapterPath in the commander, it's worked for me:

vstest.console.exe Xom.Gci.Lvf.FileParserInvoker.UnitTests.dll /TestAdapterPath:"C:\****\****\{SolutionFolder}"

In my case the tests were discovered but running resulted in "Test not Available..." and the (in)famous: "Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again."

the error was independent of Visual Studio (tested from dotnet CLI tools and nearly naked UNit test) and it was only when targeting .NET 4.7.1. dotnetcore app works fine.

also running tests with the Nuint3 CLI nunit3-console.exe Tests.csproj shows the error:

"Either assembly contains no tests or proper test driver has not been found."

the error was because the test-adapter could not be found on a (mapped) network drive or share and was solved by copy it locally and rerun.

참고 URL : https://stackoverflow.com/questions/34790339/no-test-found-make-sure-that-installed-test-discoverers-executors-platform

반응형