"단위 테스트 작성"은 어디에 있습니까?
새로운 Visual Studio 2012 Ultimate을 설치했습니다.
내 솔루션으로 테스트 프로젝트를 만들었으며 기본 단위 테스트가 포함되어 있습니다. 그러나 새로운 방법을 마우스 오른쪽 버튼으로 클릭해도 "단위 테스트 생성"컨텍스트 메뉴가 더 이상 표시되지 않습니다.
Visual Studio 2010 Ultimate를 참조하십시오.
그리고 Visual Studio 2012 Ultimate :
왜 그런지 알 수 있습니까?
최신 정보:
Visual Studio 2012 및 2013 용 솔루션 :
Microsoft는 여기에서 이를 인정했으며이를 해결하기 위한 공식적인 해결책을 제공합니다. 다운로드, 설치 및 즐기십시오!
이 기능은 VS에서 잘 렸습니다.
단위 테스트 생성 마법사 – VS2010에서는 코드에서 메소드를 마우스 오른쪽 버튼으로 클릭하여 테스트 프로젝트에 단위 테스트를 생성 할 수 있습니다. 이 마법사는 MS-Test와 매우 밀접하게 연결되어 있으며 Private Accessors와 같은 기능을 사용하여 작업을 수행했기 때문에 중단되었습니다. 우리는 여기서 대안을 모색하고 있지만 아직 좋은 해결책이 없습니다.
편집 해결 방법이 있습니다 : http://blogs.msdn.com/b/malaysia/archive/2013/02/20/right-click-create-unit-tests.aspx
" 단위 테스트 생성기 "확장을 사용할 수 있습니다
Visual Studio 2012/2013 IDE에서 직접 추가하려면
- 메뉴 : 도구-> 확장 및 업데이트
- 클릭 : 온라인-> Visual Studio Gallery
- "단위 테스트 생성기"검색
참고 : VS 2012/2013의 MSTest는 여전히 짜증납니다.
메뉴 항목은 여전히 제자리에 있지만 알 수없는 이유로 코드 편집기에서는 보이지 않습니다. 그러나 Visual Studio 명령을 사용하여 단위 테스트 마법사를 실행할 수 있습니다. 필요한 명령은
EditorContextMenus.CodeWindow.CreateUnitTests
명령 창을 열고 여기에 명령을 입력하십시오. 또는 다음과 같이 별칭 명령을 입력하십시오
alias ut EditorContextMenus.CodeWindow.CreateUnitTests
명령을 더 빨리 실행하도록 별칭을 할당하십시오.
마법사를 실행하는 다른 방법은 바로 가기 키입니다. Visual Studio에서
Tools -> Options -> Environment -> Keyboard
"포함하는 명령 표시"텍스트 상자에 "createunit"을 입력하여 CreateUnitTests 명령을 필터링하고 선택하십시오. "새 단축키 사용"콤보에서 "텍스트 편집기"를 선택하고 "바로 가기 키 누르기"텍스트 필드에서 원하는 단축키를 누르십시오 (예 : Ctrl + T, Ctrl + C). 마지막으로 Assign 버튼을 누릅니다. 즐겨!
다시 활성화하는 방법은 다음과 같습니다.
방법 1-명령 창
충분히 열심히 찾으면 Create Unit Tests를 호출하는 명령이 실제로 다음과 같다는 것을 알게 될 것입니다.
EditorContextMenus.CodeWindow.CreateUnitTests
실제로 명령 창에 입력하여 단위 테스트 작성 마법사를 호출 할 수 있습니다. 너무 자세한 정보를 발견하면 실제로 별명을 작성할 수 있습니다.
alias ut EditorContextMenus.CodeWindow.CreateUnitTests
그런 다음 ut를 입력하여 마법사를 시작하십시오.
방법 2-키보드 단축키
다음 방법은 도구-> 옵션-> 환경-> 키보드로 이동하여 환경 설정의 단축키를 설정하는 것입니다.
방법 3-Create Unit Tests ... Context Menu를 다시 활성화하십시오.
Create Unit Tests ... 메뉴를 다시 활성화하려면 Tools-> Customize ...로 이동하여 Customize 대화 상자를 시작하십시오. 사용자 화 대화 상자에서 명령 탭으로 이동하여 상황에 맞는 메뉴 단일 선택 단추를 선택하고 편집기 상황에 맞는 메뉴 | 코드 창.
You will realized that the menu item is actually available in the context menu. The VS developers were kind enough to leave it there for us.
Click on the Create Unit Tests... menu item and click Move Down until it's on/under the "Run tests.." Command. Then click Close.
Restart Visual Studio 2012 and that's it ! The context menu will be available!
You may discover that using any of the above methods may not work. i.e. The Command Window will tell you that the command is not available, the keyboard shortcut will not fire or the Context menu will be available but disabled.
To allow all these to work, you will first need to have a Unit Test Project in your solution. After creating the Unit Test Project, you will need to manually Add a Unit Test item to the project even though the project unfolds with one on its own. After you have done this, everything will function as it is like back in Visual Studio 2010. You can safely remove those UnitTest1.cs files.
Source(with images, i don't have enough Rep Points to put them) :
http://serena-yeoh.blogspot.fr/2013/02/visual-studio-2012-create-unit-test.html
(ps : read the Caveats !!!! )
The answer of intrueder didn't work for many users. When I enter UT in a command window, I sometimes had the following
>UT
Command "EditorContextMenus.CodeWindow.CreateUnitTests" is not available.
But sometimes it worked for the same solution, so behavior seemed to be intermittent.
With a help of Dawa Law's post “Create Unit Tests… Function Not Available Or Disabled" I found that during each Visual Studio session you need to create one test class manually before wizard will be available.
If you have an existing Unit Test project in the solution,
At Solution Explorer, right click the Unit Test project –> Add –> Unit Test… This will create a new unit test class and trigger Visual Studio that an existing Unit Test class is available, thus enables Create Unit Tests wizard. Note: You may delete the created Unit Test class file (UnitTestX.cs) as it is used to trigger the function.
If you do not have an existing Unit Test project in the solution, you need to create it before adding a manual class:
Go to File –> Add –> New Project… In the Add New Project window, select Installed –> Visual C# –> Test –> Unit Test Project. Give it a meaningful name and click OK
The Dawa Law's post “Create Unit Tests…” Function Not Available Or Disabled has snapshots to illustrate each step.
Note, that VS 2012 Create Unit Tests Wizard support generation tests for public methods only, when in previous version private methods were also supported.
.
The "Create Unit Tests" menu was removed in the beta. I'm not certain if there are plans to bring it back or not. If it really is a problem for you, request it on the Visual Studio UserVoice site: http://visualstudio.uservoice.com/
You may regain the right click "Create Unit Tests..." by importing the following vssettings from here.
http://blogs.msdn.com/b/malaysia/archive/2013/02/20/right-click-create-unit-tests.aspx
Method 3 - Re-enable the Create Unit Tests... Context Menu.
This is by far the best method ever. To re-enable the Create Unit Tests... menu, go to Tools->Customize... to launch the Customize dialog. At the Customize dialog, go to the Commands tab, select the Context menu radio button and choose Editor Context Menus | Code Window.
"You may discover that using any of the above methods may not work. i.e. The Command Window will tell you that the command is not available, the keyboard shortcut will not fire or the Context menu will be available but disabled.
이 모든 것이 작동하게하려면 먼저 솔루션에 단위 테스트 프로젝트가 있어야합니다. 단위 테스트 프로젝트를 만든 후에는 프로젝트가 단독으로 전개 되더라도 단위 테스트 항목을 프로젝트에 수동으로 추가해야합니다. 이 작업을 완료하면 Visual Studio 2010에서와 같이 모든 것이 작동합니다. 이러한 UnitTest1.cs 파일을 안전하게 제거 할 수 있습니다. "
(마이클 프레이드 김)
참고 URL : https://stackoverflow.com/questions/9547055/where-is-the-create-unit-tests-selection
'Programing' 카테고리의 다른 글
"로컬 복사"및 프로젝트 참조에 대한 모범 사례는 무엇입니까? (0) | 2020.06.08 |
---|---|
.py 파일을 구문 분석하고 AST를 읽고 수정 한 다음 수정 된 소스 코드를 다시 작성하십시오. (0) | 2020.06.08 |
여러 열에서 INNER JOIN을 수행하는 방법 (0) | 2020.06.08 |
글꼴이 포함 된 SVG 이미지에 적합한 MIME 유형 (0) | 2020.06.08 |
왜 배열이 공변이지만 제네릭은 변하지 않습니까? (0) | 2020.06.08 |