편집기 부가기능 테스트
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
부가기능이 의도한 대로 작동하는지 확인하려면 게시하기 전에 철저히 테스트해야 합니다. Apps Script를 사용하면 개발 중인 편집기 부가기능을 특정 Google Docs, Sheets, Forms 또는 Slides 파일에서 테스트할 수 있습니다. 이를 통해 다음 작업을 할 수 있습니다.
- 독립형 스크립트로 작성된 부가기능이 시트, 문서, 프레젠테이션 또는 양식에 적용될 때 의도한 대로 작동하는지 확인합니다.
- 특히 다양한 초기 승인 수명 주기 상태(설치됨, 사용 설정됨 또는 둘 다)에서 부가기능 설치 흐름이 의도한 대로 작동하는지 확인합니다.
- 특정 문서 및 콘텐츠에 작업할 때 부가기능이 의도한 대로 작동하는지 확인합니다.
- 부가기능의 현재 버전과 이전 버전을 테스트하고 비교합니다.
테스트 배포 만들기
테스트 배포는 부가기능과 테스트 문서의 조합입니다.
스크립트 버전을 개발한 후 부가기능으로 테스트하려면 다음 단계를 따르세요.
- 아직 템플릿이 없다면 스프레드시트, 문서, 프레젠테이션 또는 양식을 만들어 부가기능을 테스트합니다.
- 부가기능이 포함된 스크립트 프로젝트를 엽니다.
- 배포 > 배포 테스트를 클릭합니다.
- 유형 선택 옆에 있는 배포 유형 사용 설정 settings을 클릭하고 편집기 부가기능을 선택합니다.
- 새 테스트 만들기 또는 테스트 추가를 클릭합니다.
- 코드 버전을 선택하거나 최신 코드를 선택합니다.
- 구성 섹션에서 테스트의 초기 승인 상태를 선택합니다.
- 테스트 문서에서 선택된 문서 없음을 클릭합니다. 부가기능을 테스트하는 데 사용할 Sheets, Docs, Slides 또는 Forms 파일을 선택하고 삽입을 클릭합니다.
- 테스트 저장을 클릭합니다.
저장된 모든 테스트 배포가 테스트 배포 대화상자에 표시됩니다. 이렇게 하면 나중에 동일한 테스트 배포를 다시 방문할 수 있습니다.
테스트 배포 실행
저장된 테스트 배포가 하나 이상 있는 경우 다음 단계에 따라 테스트 배포 중 하나를 실행할 수 있습니다.
- 부가기능이 포함된 스크립트 프로젝트를 엽니다.
- 배포 > 배포 테스트를 클릭합니다.
- 저장된 테스트에서 실행하려는 저장된 테스트 배포 옆의 라디오 버튼을 선택하고 실행을 클릭합니다.
테스트 문서가 새 탭에서 열립니다. 부가기능이 테스트 배포에 지정된 승인 상태에 있습니다. 메뉴 및 UI 요소와 상호작용하여 부가기능이 의도한 대로 작동하는지 확인할 수 있습니다.
테스트 세부정보
이 방법으로 에디터 부가기능을 테스트할 때는 다음 사항에 유의해야 합니다.
- 테스트 시 설치 가능한 트리거는 지원되지 않습니다. 설치 가능한 트리거에 종속되는 기능은 테스트할 수 없습니다.
- 최신 코드로 테스트하도록 설정된 테스트 배포를 실행하는 동안 테스트 문서를 새로고침하면 부가기능 스크립트에 저장된 변경사항을 확인할 수 있습니다.
- 테스트 문서에는 원본 테스트 문서의 편집자와 공유할 수 있는 URL이 있습니다. 이렇게 하면 테스트 및 개발 중에 다른 사용자와 더 쉽게 공동작업할 수 있습니다.
- 부가기능에서 속성 서비스를 사용하는 경우 속성이 유지되며 다음에 테스트 배포를 실행할 때 계속 사용할 수 있습니다.
- 또한 부가기능과 테스트 문서의 조합이 동일한 모든 테스트 배포는 동일한 속성 정보에 액세스할 수 있습니다. 예를 들어 테스트 배포를 두 개 만드는 경우 첫 번째 배포를 실행하는 동안 저장된 속성을 두 번째 배포를 실행하는 동안 사용할 수 있으며 그 반대의 경우도 마찬가지입니다. 단, 배포에서 동일한 스크립트와 테스트 문서를 사용하는 경우에만 가능합니다.
- 테스트 배포를 실행하는 경우 이전에 스크립트를 실행한 적이 없는 경우 승인 메시지가 표시될 수 있습니다. 테스트 중에 스크립트를 승인하면 테스트 외부에서도 스크립트가 승인됩니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-12-22(UTC)
[null,null,["최종 업데이트: 2024-12-22(UTC)"],[[["\u003cp\u003eApps Script allows developers to test editor add-ons directly within Google Docs, Sheets, Slides, or Forms to verify functionality and installation flow.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can create test deployments to specify add-on versions, authorization states, and associated documents for controlled testing environments.\u003c/p\u003e\n"],["\u003cp\u003eSaved test deployments can be executed repeatedly, enabling developers to iterate on their add-ons and observe changes in real-time within the test document.\u003c/p\u003e\n"],["\u003cp\u003eWhile offering valuable testing capabilities, test deployments have limitations such as not supporting installable triggers and shared property persistence across deployments using the same add-on and document.\u003c/p\u003e\n"],["\u003cp\u003eTest deployments provide a shareable URL for collaborative testing and may require authorization for the script, both within and outside the testing environment.\u003c/p\u003e\n"]]],["To test add-ons in development, create a test deployment linking a script version to a specific Google Docs, Sheets, Forms, or Slides file. Select the add-on's authorization state and save the test. Run saved tests by selecting them in the \"Test deployments\" dialog and clicking \"Execute.\" During testing, changes to the script can be viewed by refreshing the test document; the test document URL is shareable for collaboration. Any properties created are also persisted across multiple test deployments.\n"],null,["# Test an Editor add-on\n\nAdd-ons should be tested thoroughly prior to publishing to ensure they\nbehave as intended. Apps Script lets you test\n[Editor add-ons](/workspace/add-ons/concepts/types#editor_add-ons)\nin development on specific Google Docs Sheets, Forms, or Slides files. This\ncan be used to:\n\n- Verify that an add-on written in a standalone script functions as intended when applied to a sheet, doc, presentation, or form.\n- Verify that the add-on installation flow works as intended, particularly for different initial [authorization lifecycle states](/workspace/add-ons/concepts/editor-auth-lifecycle#the_complete_lifecycle) ([installed, enabled, or both](/workspace/add-ons/concepts/editor-auth-lifecycle#installed_versus_enabled)).\n- Verify that the add-on functions as intended when acting on a particular document and its contents.\n- Test and compare the current and previous versions of the add-on.\n\nCreate a test deployment\n------------------------\n\nA test deployment is the combination of an add-on and a test document.\nOnce you have a script version developed and would like to test it as an add-on,\nfollow these steps:\n\n1. If you don't have one already, create a spreadsheet, document, presentation, or form to test the add-on with.\n2. Open the script project containing your add-on.\n3. Click **Deploy** \\\u003e **Test deployments**.\n4. Next to **Select type** , click Enable deployment types settings and select **Editor add-on**.\n5. Click **Create new test** or **Add test**.\n6. Choose a code version or select **Latest Code**.\n7. In the **Config** section, select the initial [authorization state](/workspace/add-ons/concepts/editor-auth-lifecycle#installed_versus_enabled) for the test.\n8. Under **Test document** , click **No document selected** . Select the Sheets, Docs, Slides, or Forms file you want to use to test the add-on and click **Insert**.\n9. Click **Save test**.\n\nAll saved test deployments appear in the **Test deployments** dialog. This lets\nyou revisit the same test deployment later on.\n\nRun a test deployment\n---------------------\n\nIf you have one or more saved test deployments, you can run one of them by\nfollowing these steps:\n\n1. Open the script project containing your add-on.\n2. Click **Deploy** \\\u003e **Test deployments**.\n3. Under **Saved Tests** , select the radio button next to the saved test deployment you want to run and click **Execute**.\n\nThe test document opens in a new tab. The add-on is in the\n[authorization state](/workspace/add-ons/concepts/editor-auth-lifecycle#installed_versus_enabled)\nspecified in the test deployment. You can verify that the add-on functions as\nintended by interacting with its menu and UI elements.\n\n### Testing details\n\nThere are a number of things to keep in mind while testing Editor add-ons\nthis way:\n\n- [Installable triggers](/workspace/add-ons/concepts/editor-triggers#installable_triggers_in_add-ons) aren't supported when testing. Functionality that depends on installable triggers is not testable.\n- While running a test deployment that's set to test with the latest code, you can see changes saved to the add-on script by refreshing the test document.\n- The test document has a URL that you can share with editors of the original test document. This way, you can more easily collaborate with others while testing and developing.\n- If your add-on uses the [Properties service](/apps-script/reference/properties/properties-service), properties persist and remain available the next time the test deployment is run.\n- In addition, any test deployment that uses the same combination of add-on and test document has access to the same property information. For example, if you create two test deployments, the properties saved while running the first are available while running the second and vice versa, but only if the deployments use the same script and test document.\n- If you run a test deployment, you might be prompted for authorization if you have not run the script before. Be aware that authorizing a script while testing also authorizes the script outside of testing."]]