本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
執行 AWS IoT Greengrass 資格套件
在您設定必要組態之後,便可開始測試。完整測試套件的執行時間取決於您的硬體。做為參考,在 Raspberry Pi 3B 上完成整個測試套件約需 30 分鐘。
使用下列run-suite命令來執行一組測試。
devicetester_[linux | mac | win]_x86-64 run-suite \\ --suite-idsuite-id\\ --group-idgroup-id\\ --pool-idyour-device-pool\\ --test-idtest-id\\ --update-idty|n\\ --userdatauserdata.json
所有選項皆為選用。例如,pool-id如果您只有一個裝置集區,這是一組相同的裝置,在您的device.json檔案中定義,您可以省略。或者,如果您想要執行 tests 資料夾中最新的測試套件版本,則可以省略 suite-id。
注意
如果線上有較新的測試套件版本,IDT 會提示您。如需詳細資訊,請參閱測試套件版本。
執行資格套件的範例命令
下列命令列範例示範如何執行裝置集區的資格測試。如需 run-suite 和其他 IDT 命令的詳細資訊,請參閱 IDT for AWS IoT Greengrass V2 命令。
使用以下命令,在指定的測試套件中執行所有測試群組。list-suites 命令會列出 tests 資料夾中的測試套件。
devicetester_[linux | mac | win]_x86-64 run-suite \ --suite-id GGV2Q_1.0.0 \ --pool-id<pool-id>\ --userdata userdata.json
使用以下命令在測試套件中執行特定測試群組。list-groups 命令會列出測試套件中的測試群組。
devicetester_[linux | mac | win]_x86-64 run-suite \ --suite-id GGV2Q_1.0.0 \ --group-id<group-id>\ --pool-id<pool-id>\ --userdata userdata.json
使用以下命令在測試群組中執行特定測試案例。
devicetester_[linux | mac | win]_x86-64 run-suite \ --group-id<group-id>\ --test-id<test-id>\ --userdata userdata.json
使用以下命令在測試群組中執行多個測試案例。
devicetester_[linux | mac | win]_x86-64 run-suite \ --group-id<group-id>\ --test-id<test-id1>,<test-id2>--userdata userdata.json
使用以下命令列出測試群組中的所有測試案例。
devicetester_[linux | mac | win]_x86-64 list-test-cases --group-id<group-id>
我們建議您執行完整的資格測試套件,以正確的順序執行測試群組相依性。如果您選擇執行特定測試群組,建議您先執行相依性檢查程式測試群組,以確保在執行相關測試群組之前已安裝所有 Greengrass 相依性。例如:
-
在執行核心資格測試組之前執行
coredependencies。
IDT for AWS IoT Greengrass V2 命令
IDT 命令位於 目錄中。若要執行測試套件,請以下列格式提供 命令:<device-tester-extract-location>/bin
help-
列出所指定命令的相關資訊。
list-groups-
列出指定測試套件中的群組。
list-suites-
列出可用的測試套件。
list-supported-products-
列出支援的 產品,在此案例中為 AWS IoT Greengrass IDT 版本,以及測試套件版本。
list-test-cases-
列出特定測試群組中的測試案例。支援下列選項:
-
group-id。 要搜尋的測試群組。此選項為必要選項,且必須指定單一群組。
-
run-suite-
在裝置集區上執行測試套件。以下是一些支援的選項:
-
suite-id。 要執行的測試套件版本。如果未指定,IDT 會使用tests資料夾中的最新版本。 -
group-id。 要執行的測試群組,以逗號分隔的清單的形式呈現。如果未指定,IDT 會根據 中的設定,在測試套件中執行所有適當的測試群組device.json。IDT 不會根據您設定的設定執行裝置不支援的任何測試群組,即使這些測試群組是在group-id清單中指定。 -
test-id。 要執行的測試案例,以逗號分隔的清單形式呈現。指定時,group-id必須指定單一群組。 -
pool-id。 要測試的裝置集區。如果device.json檔案中已定義多個裝置集區,則必須指定集區。 -
stop-on-first-failure。 設定 IDT 在第一次失敗時停止執行。當您想要偵錯指定的測試群組group-id時,請使用此選項搭配 。執行完整測試套件產生資格報告時,請勿使用此選項。 -
update-idt。 設定提示更新 IDT 的回應。如果 IDT 偵測到有較新的版本,Y回應會停止測試執行。N回應會繼續測試執行。 -
userdata。 檔案的完整路徑userdata.json,其中包含測試成品路徑的相關資訊。run-suite命令需要此選項。userdata.json檔案必須位於devicetester_extract_location/devicetester_ggv2_【win|mac|linux】/configs/ 目錄中。
如需
run-suite選項的詳細資訊,請使用下列help選項:devicetester_[linux | mac | win]_x86-64run-suite -h -