Düzenleyici eklentisini test etme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Eklentilerin amaçlandığı gibi davrandığından emin olmak için yayınlanmadan önce kapsamlı bir şekilde test edilmesi gerekir. Apps Komut Dosyası, geliştirme aşamasındaki Düzenleyici eklentilerini belirli Google Dokümanlar, E-Tablolar, Formlar veya Slaytlar dosyalarında test etmenize olanak tanır. Bu, aşağıdakiler için kullanılabilir:
- Bağımsız bir komut dosyasında yazılmış bir eklentinin, e-tabloya, dokümana, sunucuya veya forma uygulandığında amaçlandığı gibi çalıştığını doğrulayın.
- Eklenti yükleme akışının, özellikle farklı ilk yetkilendirme yaşam döngüsü durumları (yüklü, etkin veya her ikisi) için amaçlandığı gibi çalıştığını doğrulayın.
- Eklentinin belirli bir doküman ve içeriği üzerinde işlem yaparken amaçlandığı gibi çalıştığını doğrulayın.
- Eklentinin mevcut ve önceki sürümlerini test edip karşılaştırın.
Test dağıtımı oluşturma
Test dağıtımı, bir eklenti ve test belgesinin birleşimidir.
Geliştirdiğiniz bir komut dosyası sürümünü eklenti olarak test etmek istiyorsanız aşağıdaki adımları uygulayın:
- Henüz yoksa eklentiyi test etmek için bir e-tablo, doküman, sunu veya form oluşturun.
- Eklentinizi içeren komut dosyası projesini açın.
- Dağıt > Dağıtım testleri'ni tıklayın.
- Türü seçin'in yanındaki Dağıtım türlerini etkinleştir'i settings tıklayın ve Düzenleyici eklentisi'ni seçin.
- Yeni test oluştur'u veya Test ekle'yi tıklayın.
- Bir kod sürümü seçin veya En Son Kod'u seçin.
- Yapılandırma bölümünde, test için ilk yetkilendirme durumunu seçin.
- Test dokümanı bölümünde Doküman seçilmedi'yi tıklayın. Eklentiyi test etmek için kullanmak istediğiniz E-Tablolar, Dokümanlar, Slaytlar veya Formlar dosyasını seçin ve Ekle'yi tıklayın.
- Testi kaydet'i tıklayın.
Kayıtlı tüm test dağıtımları Test dağıtımları iletişim kutusunda görünür. Bu sayede daha sonra aynı test dağıtımını tekrar ziyaret edebilirsiniz.
Test dağıtımı çalıştırma
Bir veya daha fazla kayıtlı test dağıtımınız varsa aşağıdaki adımları uygulayarak bunlardan birini çalıştırabilirsiniz:
- Eklentinizi içeren komut dosyası projesini açın.
- Dağıt > Dağıtım testleri'ni tıklayın.
- Kayıtlı Testler bölümünde, çalıştırmak istediğiniz kayıtlı test dağıtımının yanındaki radyo düğmesini seçin ve Yürüt'ü tıklayın.
Test dokümanı yeni bir sekmede açılır. Eklenti, test dağıtımında belirtilen yetkilendirme durumundadır. Menüsü ve kullanıcı arayüzü öğeleriyle etkileşime geçerek eklentinin istenen şekilde çalıştığını doğrulayabilirsiniz.
Test ayrıntıları
Editor eklentilerini bu şekilde test ederken göz önünde bulundurmanız gereken bazı noktalar vardır:
- Yüklenebilir tetikleyiciler test sırasında desteklenmez. Yüklenebilir tetikleyicilere bağlı işlevler test edilemez.
- En son kodla test edilecek şekilde ayarlanmış bir test dağıtımını çalıştırırken test dokümanlarını yenileyerek eklenti komut dosyasına kaydedilen değişiklikleri görebilirsiniz.
- Test dokümanının, orijinal test dokümanının düzenleyicileriyle paylaşabileceğiniz bir URL'si vardır. Bu sayede, test ve geliştirme sırasında diğer kullanıcılarla daha kolay işbirliği yapabilirsiniz.
- Eklentiniz Özellikler hizmetini kullanıyorsa özellikler kalır ve test dağıtımı bir sonraki sefer çalıştırıldığında kullanılabilir durumda kalır.
- Ayrıca, aynı eklenti ve test dokümanı kombinasyonunu kullanan tüm test dağıtımları aynı mülk bilgilerine erişebilir. Örneğin, iki test dağıtımı oluşturursanız ilk dağıtım çalıştırılırken kaydedilen özellikler ikinci dağıtım çalıştırılırken kullanılabilir ve bunun tersi de geçerlidir. Ancak bu durum yalnızca dağıtımlarda aynı komut dosyası ve test dokümanı kullanılıyorsa geçerlidir.
- Test dağıtımı çalıştırırsanız komut dosyasını daha önce çalıştırmadıysanız yetkilendirme isteyebilirsiniz. Test sırasında bir komut dosyasına yetki vermenin, komut dosyasının test dışında da yetkilendirileceği anlamına geldiğini unutmayın.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2024-12-22 UTC.
[null,null,["Son güncelleme tarihi: 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."]]