

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 測試和偵錯 Step Functions 狀態機器
<a name="test-and-debug"></a>

Step Functions 提供下列方法來測試和偵錯狀態機器：

## 在主控台和 API 中使用測試狀態進行測試
<a name="test-with-teststate"></a>

在 Step Functions 主控台中，您可以使用測試狀態來**測試個別狀態**。您可以在 主控台中提供狀態定義和輸入，然後 Step Functions 會執行 狀態並顯示輸出，全部都不需要建立狀態機器。

或者，您可以使用 [TestState](https://docs.aws.amazon.com/step-functions/latest/apireference/API_TestState.html) API 來測試個別狀態。您提供單一狀態的定義，API 將執行狀態和報告結果，也不會建立實際的狀態機器。

[使用 TestState 進行測試](test-state-isolation.md) 透過 [TestState API](https://docs.aws.amazon.com/step-functions/latest/apireference/API_TestState.html) 參閱 以測試您的狀態。

## 資料流程模擬器 （不支援）
<a name="use-data-flow-simulator"></a>

資料流程模擬器是一種主控台工具，專為測試 JSONPath 語法而建置。**不支援**資料流程模擬器。

[使用 TestState 進行測試](test-state-isolation.md) 透過 [TestState API](https://docs.aws.amazon.com/step-functions/latest/apireference/API_TestState.html) 參閱 以測試您的狀態。

## Step Functions Local （不支援）
<a name="sfn-local-summary"></a>

使用 AWSStep Functions Local 可下載版本的 Step Functions，您可以使用在您自己的開發環境中執行的 Step Functions 來測試應用程式。

 Step Functions Local **不提供**功能同位。例如，不支援最佳化的服務整合、跨帳戶存取或分散式映射。

**不支援 Step Functions Local**  
Step Functions Local **不提供**功能同位，且**不受支援**。  
您可以考慮將模擬 Step Functions 的第三方解決方案用於測試目的。  
作為 Step Functions Local 的替代方案，您可以使用 TestState API 在部署到AWS您的帳戶之前，先單元測試您的狀態機器邏輯。如需詳細資訊，請參閱[使用 TestState API 測試狀態機器](https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html)。