

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 测试和调试 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>

使用 AWS Step Functions Local（Step Functions 的可下载版本），您可以使用在自己的开发环境中运行的 Step Functions 来测试应用程序。

 Step Functions Local 功能**并不**完备。例如，不支持优化服务集成、跨账户访问或分布式 Map。

**不支持 Step Functions Local**  
Step Functions Local 功能**并不**完备且**不受支持**。  
出于测试目的，您可以考虑使用能够模拟 Step Functions 的第三方解决方案。  
作为 Step Functions Local 的替代方案，您可以在部署到您的AWS账户之前使用 TestState API 对状态机逻辑进行单元测试。有关更多信息，请参阅[使用 TestState API 测试状态机](https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html)。