단위 테스트 시나리오 생성
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
앱의 단위 테스트를 작성할 때 Gemini는 테스트하려는 코드의 컨텍스트를 사용하여 테스트 시나리오를 제안할 수 있습니다. 단위 테스트 시나리오를 생성할 때 Gemini는 테스트에 대한 자세한 이름과 설명을 포함하므로 추천된 각 테스트의 의도를 더 잘 이해할 수 있습니다. 각 테스트의 본문을 직접 구현해야 합니다.
단위 테스트 시나리오를 생성하려면 다음 단계를 따르세요.
- 단위 테스트 시나리오를 생성할 클래스로 이동합니다.
- 클래스 이름을 마우스 오른쪽 버튼으로 클릭하고 컨텍스트 메뉴에서 Gemini > 단위 테스트 시나리오 생성을 선택합니다.
- 표시되는 대화상자에서 시나리오를 생성할 클래스의 메서드를 선택하고 테스트의 대상 패키지를 설정합니다.
- OK(확인)을 클릭합니다.
- 테스트의 대상 디렉터리를 확인하고 OK를 클릭합니다.
- 테스트 클래스가 이미 있는 경우 Gemini가 기존 파일에 업데이트를 제안하도록 할지 확인합니다.
Gemini가 요청을 처리하면 제안된 단위 테스트가 포함된 새 파일 또는 기존 파일에 권장되는 변경사항을 적용할 수 있는 차이가 표시됩니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-31(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-31(UTC)"],[],[],null,["# Generate unit test scenarios\n\nWhen writing unit tests for your app, Gemini can suggest test scenarios using\nthe context of the code you want to test. When generating unit test scenarios,\nGemini includes detailed names and descriptions for your tests, so that you\nbetter understand the intention for each suggested test. You need to implement\nthe body of each test yourself.\n\nTo generate unit test scenarios, do the following:\n\n1. Navigate to the class you want to generate unit test scenarios for.\n2. Right-click on the class name and select **Gemini \\\u003e Generate Unit Test Scenarios** from the context menu.\n3. In the dialog that appears, select the methods of the class that you want to generate scenarios for, and set the destination package for the tests.\n4. Click **OK**.\n5. Confirm the destination directory for your tests and click **OK**.\n6. If the test class already exists, confirm whether you want Gemini to suggest updates to the existing file.\n\nAfter Gemini processes the request, you should see either a new file with the\nsuggested unit tests or a diff for you to accept recommended changes to an\nexisting file."]]