ジョブの実行タイミングを定義することは、テスト自動化の中核を成します。これにより、キュー内の実行順序が一定に保たれます。Typhoon Test Hubでは、手動トリガー、定期トリガー、イベントトリガーを作成できます。これらはすべて同じ動作をしますが、開始方法が異なります。トリガーに関する最も重要な情報は、トリガーテーブルで確認できます。ここでは、新しいトリガーの作成、トリガーの更新、既存のトリガーの削除を行うことができます。トリガーには、以下のいずれかのタイプがあります。
import requests
auth_token = 123456 # Replace with the token value of the trigger you want to start
tth_url = "URL" # Replace URL with the URL of your TTH
trigger_id = 4 # Replace with the Trigger Number you would like to start
branch = "main"
trigger_url = f"{tth_url}/api/triggers/start/{trigger_id}"
exec_id = requests.post(trigger_url, headers={'X-API-Key': auth_token}).json()
exec_url = f"{tth_url}/api/executions/status/{exec_id}"
while True:
exec_status = requests.get(exec_url,
headers={'X-API-Key': auth_token},
json={"parameters": [{"name": "BRANCH", "value": branch}]}).json()['status']
if exec_status not in ['QUEUED', 'RUNNING']
break
if exec_status != 'PASSED':
raise Exception("HIL Job did not pass!")