Kiểm thử và gỡ lỗi tiện ích bổ sung Google Workspace của Apps Script
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Khi bạn phát hành một tiện ích bổ sung, người dùng có thể cài đặt tiện ích đó thông qua ứng dụng lưu trữ hoặc Google Workspace Marketplace. Trước khi phát hành, hãy kiểm thử các tiện ích bổ sung mà bạn phát triển trong các ứng dụng lưu trữ mà các tiện ích đó mở rộng.
Trang này mô tả cách cài đặt một tiện ích bổ sung đang trong quá trình phát triển (được gọi là tiện ích bổ sung chưa phát hành hoặc dành cho nhà phát triển) để kiểm thử hoặc sử dụng cá nhân. Bạn cũng có thể gỡ lỗi tiện ích bổ sung bằng trình gỡ lỗi và điểm ngắt của IDE Apps Script.
Điều kiện tiên quyết
Bạn phải có quyền chỉnh sửa đối với dự án tập lệnh của tiện ích bổ sung.
Để cho phép những người khác trong tổ chức của bạn kiểm thử tiện ích bổ sung, hãy cấp cho họ quyền chỉnh sửa dự án tập lệnh. Để biết thông tin chi tiết về cách cấp quyền truy cập, hãy xem phần Cộng tác với các nhà phát triển khác.
Cài đặt tiện ích bổ sung chưa phát hành
Bạn có thể cài đặt các tiện ích bổ sung chưa xuất bản từ hộp thoại Bản triển khai của Apps Script.
Hãy làm theo các bước sau để cài đặt một tiện ích bổ sung chưa phát hành của Google Workspace để kiểm thử:
Mở dự án tập lệnh trong trình chỉnh sửa Apps Script.
Nhấp vào Triển khai > Kiểm thử các bản triển khai.
Nhấp vào Cài đặt.
Ở dưới cùng, hãy nhấp vào Xong.
Bạn có thể cho phép người dùng khác kiểm thử tiện ích bổ sung bằng cách chia sẻ dự án Apps Script với tài khoản của họ (bắt buộc phải có quyền chỉnh sửa). Sau đó, nhắc người dùng làm theo các bước trên.
Sau khi cài đặt, tiện ích bổ sung sẽ có sẵn ngay trong các ứng dụng lưu trữ mà tiện ích đó mở rộng. Bạn có thể cần làm mới thẻ ứng dụng lưu trữ trước khi tiện ích bổ sung xuất hiện. Bạn cũng phải uỷ quyền cho tiện ích bổ sung trước khi sử dụng.
Gỡ cài đặt tiện ích bổ sung chưa phát hành
Để gỡ cài đặt một bản triển khai tiện ích bổ sung chưa xuất bản, hãy làm theo các bước sau:
Mở dự án tập lệnh trong trình chỉnh sửa Apps Script.
Nhấp vào Triển khai > Kiểm thử các bản triển khai.
Nhấp vào Gỡ cài đặt.
Ở dưới cùng, hãy nhấp vào Xong.
Các bước này sẽ xoá ngay bản triển khai và tiện ích bổ sung sẽ không còn xuất hiện trong bất kỳ ứng dụng lưu trữ nào. Bạn có thể cài đặt lại bản triển khai bất cứ lúc nào bằng cách
lặp lại quy trình cài đặt.
Các phương pháp hay nhất về kiểm thử
Trong khi kiểm thử tiện ích bổ sung Google Workspace, hãy nhớ làm theo Các phương pháp hay nhất để phát triển tiện ích bổ sung. Ngoài ra, hãy nhớ làm những việc sau:
Kiểm thử kỹ lưỡng luồng điều hướng thẻ trong tất cả các ứng dụng lưu trữ mà tiện ích bổ sung mở rộng. Đảm bảo hành vi của tiện ích bổ sung là chính xác khi người dùng di chuyển từ ngữ cảnh này sang ngữ cảnh khác, cũng như giữa các thẻ không theo ngữ cảnh và thẻ theo ngữ cảnh.
Nếu tiện ích bổ sung của bạn kết nối với một API bên thứ ba hoặc dịch vụ khác, hãy xác minh rằng bạn có thể truy cập vào dịch vụ đó và dịch vụ đó hoạt động như mong đợi. Đảm bảo rằng tiện ích bổ sung của bạn đang xử lý đúng cách thông tin đăng nhập và uỷ quyền.
Đảm bảo mọi điều kiện lỗi đều được xử lý một cách linh hoạt. Sử dụng thẻ lỗi khi cần.
Hãy chú ý đến hiệu suất của tiện ích bổ sung. Nếu bạn thực hiện thay đổi đối với mã và tiện ích bổ sung bắt đầu chậm lại, bạn có thể cần xoá hoặc làm lại tính năng đó.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2024-12-22 UTC."],[[["\u003cp\u003eUnpublished Google Workspace add-ons can be installed for testing and personal use directly from the Apps Script project.\u003c/p\u003e\n"],["\u003cp\u003eUsers need editor access to the script project to install and test the unpublished add-on.\u003c/p\u003e\n"],["\u003cp\u003eUninstalling an unpublished add-on removes it from all host applications and requires reinstallation for further use.\u003c/p\u003e\n"],["\u003cp\u003eThorough testing is crucial, including card navigation, data handling, external service integrations, error management, and performance evaluation.\u003c/p\u003e\n"]]],["To test an unpublished add-on, open its script project in the Apps Script editor and navigate to **Deploy \u003e Test deployments**. Click **Install**, then **Done** to make it available in host applications. Share the project for others to test. Uninstall by repeating the process and selecting **Uninstall**. Testing should include card navigation, example data evaluation, third-party service verification, error handling, and performance monitoring.\n"],null,["# Test and debug Apps Script Google Workspace add-ons\n\nWhen you publish an add-on, users can install it\nthrough the host application\nor the [Google Workspace Marketplace](https://workspace.google.com/marketplace/). Before you publish, test the\nadd-ons that you develop within the host applications that\nthey extend.\n\nThis page describes how to install an add-on that is\nunder development (called an *unpublished* or *developer*\nadd-on) for testing or\npersonal use. You can also debug add-ons using the\nApps Script\nIDE's [debugger and breakpoints](/apps-script/guides/support/troubleshooting#use-debugger).\n\nPrerequisites\n-------------\n\n- You must have editor access to the add-on's script project.\n- To let other people in your organization test the add-on, grant them editor access to the script project. For details about granting access, see [Collaborating with Other Developers](/apps-script/guides/collaborating).\n\nInstall an unpublished add-on\n-----------------------------\n\nYou can install unpublished add-ons from Apps Script's **Deployments**\ndialog.\n\nFollow these steps to install an unpublished\nGoogle Workspace add-on for testing:\n\n1. Open the script project in the Apps Script editor.\n2. Click **Deploy \\\u003e Test deployments**.\n3. Click **Install**.\n4. At the bottom, click **Done**.\n\nYou can let other users test the add-on by sharing the Apps Script project\nwith their account (edit access is required). Then prompt the users to\nfollow the above steps.\n\nOnce installed, the add-on is immediately available in host applications it\nextends. You may need to refresh the host application tab before the add-on\nappears. You must also\n[authorize](/workspace/add-ons/how-tos/authorizing-addons#authorizing_unpublished_g_suite_add-ons)\nthe add-on before using it.\n\nUninstall an unpublished add-on\n-------------------------------\n\nTo uninstall an unpublished add-on deployment, follow these steps:\n\n1. Open the script project in the Apps Script editor.\n2. Click **Deploy \\\u003e Test deployments**.\n3. Click **Uninstall**.\n4. At the bottom, click **Done**.\n\nThese steps immediately remove the deployment and the add-on no longer appears\nin any host application. You can reinstall the deployment at any time by\nrepeating the [install procedure](#install_an_unpublished_add-on).\n\nTesting best practices\n----------------------\n\nWhile testing your Google Workspace add-on, be sure\nto follow the\n[Best practices](/workspace/add-ons/guides/workspace-best-practices)\nfor add-on development. In addition, be sure to do the following:\n\n1. Test card navigation flows thoroughly in all the host applications the\n add-on extends. Make sure the add-on behavior is correct as the user moves\n from context to context, and between non-contextual and contextual cards.\n\n2. [Use example test data](/workspace/add-ons/guides/workspace-best-practices#_write_tests_and_test_messages)\n to evaluate your add-on's behavior.\n\n3. If your add-on connects to a third-party API or other service, verify\n that the service can be accessed and behaves as expected. Make sure\n your add-on is handling the\n [authorization and log-in details](/workspace/add-ons/how-tos/non-google-services)\n correctly.\n\n4. Make sure any error conditions are handled gracefully. [Use error cards](/workspace/add-ons/guides/workspace-best-practices#_use_error_cards)\n where needed.\n\n5. Pay attention to how performant the add-on is. If you make a change to the\n code and the add-on starts slowing down, you may need to remove or rework\n that feature."]]