test-slack-app
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTest Slack App
测试Slack应用
Help a developer confirm that a Slack app they already built actually works. This is the last step of the build loop, after the skill scaffolds an app and the skill runs it.
slack:create-slack-appslack:slack-cliThe approach is simple and safe:
- Run the app in a developer sandbox: a free, throwaway Slack org for building and testing, never a workspace with real coworkers in it.
- Read the app's source to learn what it actually listens for.
- Hand the developer concrete steps to perform in Slack, then help them confirm the app responds.
This is guided manual checking, not an automated test suite: you drive the setup and tell the developer what to type or click, and they confirm what they see. It works best for apps managed by the Slack CLI; there is a best-effort path for plain Bolt apps in Step 2.
帮助开发者确认他们已构建的Slack应用是否真正可用。这是构建流程的最后一步,在技能生成应用框架、技能运行应用之后进行。
slack:create-slack-appslack:slack-cli方法简单且安全:
- 在开发者沙箱中运行应用:这是一个用于构建和测试的免费临时Slack组织,绝不能在有真实同事的工作区中测试。
- 阅读应用源代码,了解它实际监听的内容。
- 为开发者提供具体操作步骤,在Slack中执行,然后帮助他们确认应用的响应。
这是引导式手动检查,而非自动化测试套件:你负责指导设置,并告知开发者需要输入或点击的内容,他们确认看到的结果。这种方法最适用于由Slack CLI管理的应用;对于纯Bolt应用,步骤2提供了尽力而为的方案。
Step 1: Set Up a Safe Place to Test
步骤1:设置安全的测试环境
1a. Detect the Slack CLI
1a. 检测Slack CLI
Use the skill (Step 1: Detect the Slack CLI) to check whether the public Slack CLI is installed and resolve its command name. The fingerprint check, alias fallback, and install instructions all live there; do not duplicate them here. Refer to the resolved command as throughout. If the CLI is not installed, guide the developer through that same step to install it, since running the app needs it.
slack:slack-cliSLACK_CMD使用技能(步骤1:检测Slack CLI)检查公共Slack CLI是否已安装,并确定其命令名称。指纹检查、别名回退和安装说明都在该技能中,请勿在此处重复。全程将解析后的命令称为。如果CLI未安装,请引导开发者完成同一技能中的安装步骤,因为运行应用需要它。
slack:slack-cliSLACK_CMD1b. Make sure there is a developer sandbox to test in
1b. 确保有可用于测试的开发者沙箱
Testing belongs in a developer sandbox, never a workspace with real coworkers in it.
- Explain it from the live docs, not from here. Use the skill to fetch and summarize https://docs.slack.dev/tools/developer-sandboxes.md, so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps.
slack:slack-docs - Find the current target. Run for the authenticated workspaces and their team IDs, and, from the project directory,
SLACK_CMD auth listfor the apps already installed and their IDs.SLACK_CMD app list - Confirm it is a sandbox. The CLI cannot tell a sandbox apart from a workspace with real users, so ask the developer to confirm the target is a developer sandbox. If there is no sandbox yet, set one up with the skill (Step 3: Set Up a Developer Sandbox), which owns the
slack:create-slack-app/sandbox listflow and the Developer Program links. Creating a sandbox happens in the browser, so have the developer come back here once the sandbox exists and they have logged into it.sandbox create
测试应在开发者沙箱中进行,绝不能在有真实同事的工作区中。
- 从官方文档而非此处解释:使用技能获取并总结https://docs.slack.dev/tools/developer-sandboxes.md的内容,确保建议始终与最新文档保持一致,而非使用可能过时的副本。告知开发者Slack推荐使用沙箱来构建和测试应用。
slack:slack-docs - 查找当前目标工作区:运行查看已认证的工作区及其团队ID,从项目目录运行
SLACK_CMD auth list查看已安装的应用及其ID。SLACK_CMD app list - 确认是沙箱环境:CLI无法区分沙箱和有真实用户的工作区,因此请让开发者确认目标是开发者沙箱。如果还没有沙箱,请使用技能(步骤3:设置开发者沙箱)创建一个,该技能负责
slack:create-slack-app/sandbox list流程以及开发者计划链接。创建沙箱需在浏览器中进行,请开发者在沙箱创建完成并登录后返回此处。sandbox create
1c. Quick health check
1c. 快速健康检查
Catch obvious setup problems with the CLI's own validation before the slower hands-on checks:
- : checks the CLI, language runtime, and authentication.
SLACK_CMD doctor - : run from the project directory if the app has a manifest, to confirm the app configuration is well-formed.
SLACK_CMD manifest validate
Surface anything these flag before moving on.
在进行较慢的手动检查之前,使用CLI自带的验证工具排查明显的设置问题:
- :检查CLI、语言运行时和认证情况。
SLACK_CMD doctor - :如果应用有manifest,从项目目录运行此命令,确认应用配置格式正确。
SLACK_CMD manifest validate
在继续操作前,先展示这些命令检测到的任何问题。
Step 2: Run the App
步骤2:运行应用
Whichever path you use below, first turn the app's log level up to debug so you have the most context while testing. Prefer a way that leaves the developer's code untouched: read the logger setup to see whether it reads a log-level environment variable (some templates wire one such as or ). If it does, set that variable instead of editing source. For a CLI-managed app, stores it in the project that reads; for a plain Bolt app, set it in the environment or the app already reads. Only when the logger reads no such variable should you edit the source, finding where the log level is set and switching it to debug for this run.
SLACK_LOG_LEVELLOG_LEVELSLACK_CMD env set <LOG_LEVEL_VAR> debug.envslack run.env无论使用以下哪种方式,首先将应用的日志级别调高至debug,以便在测试时获取最多上下文信息。优先选择不修改开发者代码的方式:查看日志器设置,确认它是否读取日志级别环境变量(部分模板会配置或这类变量)。如果有,设置该变量而非编辑源代码。对于CLI管理的应用,会将其存储在读取的项目文件中;对于纯Bolt应用,在应用已读取的环境或文件中设置该变量。只有当日志器不读取此类变量时,才需要编辑源代码,找到日志级别的设置位置并切换为debug以进行本次运行。
SLACK_LOG_LEVELLOG_LEVELSLACK_CMD env set <LOG_LEVEL_VAR> debugslack run.env.envCLI-managed apps (recommended)
CLI管理的应用(推荐)
Follow Step 6: Running an App Locally () in the skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox where nothing is installed yet. Once it is running, file changes auto-reload.
slack runslack:slack-cli按照技能中的**步骤6:本地运行应用()**在后台启动本地开发服务器。这还会将应用安装到目标工作区,这对于尚未安装任何应用的新沙箱至关重要。启动后,文件更改会自动重载。
slack:slack-clislack runPlain Bolt apps without the CLI (best-effort)
无CLI的纯Bolt应用(尽力而为)
If the app is a plain Bolt app started with or rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow:
nodepython- Point the app at the sandbox: set its bot and app-level tokens (from the sandbox app's settings) in the environment or the file the app reads.
.env - Prefer socket mode so the app needs no public URL. This works only if the app is coded for socket mode and the app-level token has ; adding tokens to an app scaffolded for HTTP will not deliver events.
connections:write - Start the app with its own command (for example or
npm start) and watch its logs.python app.py
Say plainly that this path is best-effort, and that the smoothest experience comes from a CLI-managed app.
如果应用是使用或启动的纯Bolt应用,而非通过Slack CLI启动,本技能仍可提供帮助,但运行流程是尽力而为的,并非主要流程:
nodepython- 将应用指向沙箱:在环境或应用读取的文件中设置其机器人令牌和应用级令牌(来自沙箱应用的设置)。
.env - 优先使用Socket模式,这样应用无需公共URL。仅当应用为Socket模式编写且应用级令牌拥有权限时此方法才有效;为HTTP架构的应用添加令牌无法传递事件。
connections:write - 使用应用自身的命令启动(例如或
npm start)并查看其日志。python app.py
明确说明此流程是尽力而为的,最流畅的体验来自CLI管理的应用。
Step 3: Try It Out in Slack and Confirm It Works
步骤3:在Slack中试用并确认应用正常工作
This is the heart of the skill. Do not hand the developer a generic checklist. Ground every step in what this app actually registers.
这是本技能的核心内容。不要给开发者提供通用清单。每一步都要基于此应用实际注册的交互来制定。
3a. Read the source to find what the app listens for
3a. 读取源代码,查找应用监听的内容
Read the app's listener code and list the interactions it registers. Depending on the framework these look like:
- Slash commands: a registered command name such as .
/ship - Shortcuts: global or message shortcuts with a callback ID.
- Events: subscribed events such as ,
app_mention, ormessage.reaction_added - Actions: interactive components (buttons, selects) with an action ID.
- View submissions: modal submit handlers ().
view_submission - App Home: an handler or a published Home tab.
app_home_opened - Assistant / agent: an assistant or handler, common in the agent templates.
assistant_thread_started
Name the concrete identifiers you find (the actual command and callback names), not placeholders.
读取应用的监听器代码,列出它注册的交互。根据框架不同,这些交互可能包括:
- 斜杠命令:已注册的命令名称,例如。
/ship - 快捷方式:带有回调ID的全局或消息快捷方式。
- 事件:已订阅的事件,例如、
app_mention或message。reaction_added - 操作:带有操作ID的交互式组件(按钮、选择器)。
- 视图提交:模态框提交处理器()。
view_submission - App Home:处理器或已发布的Home标签页。
app_home_opened - 助手/Agent:助手或处理器,在Agent模板中较为常见。
assistant_thread_started
列出找到的具体标识符(实际的命令和回调名称),而非占位符。
3b. Turn each into a "do this, expect that" step
3b. 将每个交互转化为“执行此操作,预期此结果”的步骤
For every registered interaction, give the developer a concrete step and what a working app should do in response. A few spots are non-obvious, so spell them out:
- Slash command → type the command (for example ) in a channel or DM in the sandbox → expect the response the handler sends.
/ship - Global shortcut → open the shortcuts menu (the lightning-bolt or button in the message composer, depending on your client) and pick it → expect the modal or message it opens.
+ - Message shortcut → hover a message, open More actions (the menu), pick the shortcut → expect its response.
⋯ - Event such as → @-mention the app in a channel it belongs to → expect its reply.
app_mention - Button or select → click the component in a message or modal the app posted → expect what the action handler does.
- Modal submit () → submit the modal → expect the confirmation or side effect.
view_submission - App Home → click the app in the left sidebar to open its Home tab → expect the published view.
对于每个已注册的交互,为开发者提供具体操作步骤以及正常工作的应用应做出的响应。有些地方不太明显,因此需要详细说明:
- 斜杠命令 → 在沙箱的频道或私信中输入命令(例如)→ 预期收到处理器发送的响应。
/ship - 全局快捷方式 → 打开快捷方式菜单(根据客户端不同,可能是消息编辑器中的闪电按钮或按钮)并选择它 → 预期它打开模态框或发送消息。
+ - 消息快捷方式 → 悬停在一条消息上,打开更多操作(菜单),选择该快捷方式 → 预期收到其响应。
⋯ - 事件(例如)→ 在应用所属的频道中@提及该应用 → 预期收到其回复。
app_mention - 按钮或选择器 → 点击应用发布的消息或模态框中的组件 → 预期触发操作处理器的响应。
- 模态框提交()→ 提交模态框 → 预期收到确认信息或产生相应副作用。
view_submission - App Home → 点击左侧边栏中的应用以打开其Home标签页 → 预期看到已发布的视图。
3c. Confirm and report
3c. 确认并报告
While the developer interacts, help them confirm it is working:
- If the app runs under , watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors.
slack run - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the and
slack:block-kitskills to dig into the payload or method.slack:slack-api
Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail.
在开发者交互过程中,帮助他们确认应用是否正常工作:
- 如果应用在下运行,查看其日志(询问“展示slack run的输出”)以确认事件已送达并读取任何错误。
slack run - 如果响应看起来异常(格式错误的消息或Block Kit视图,或API错误),使用和
slack:block-kit技能深入分析负载或方法。slack:slack-api
最后给出简短总结:你和开发者确认了哪些功能正常工作,以及他们需要自行检查的内容。请记住这是手动检查:你是在帮助开发者观察应用的响应,而非生成自动化的通过/失败结果。
Notes
注意事项
- is a placeholder: always substitute the actual command name resolved in Step 1a.
SLACK_CMD - Scope: this skill tests an app that already exists. To create or scaffold one, use the skill; for raw CLI mechanics, use the
slack:create-slack-appskill; for message or Block Kit formatting, use theslack:slack-cliandslack:slack-messagingskills.slack:block-kit - Out of scope for now: automated test frameworks for Bolt, programmatically simulating user interactions, and driving the Slack UI with a browser. Today the developer performs the interactions; this skill makes sure they know exactly what to do and what to expect.
- 是占位符:请始终替换为步骤1a中解析出的实际命令名称。
SLACK_CMD - 范围:本技能用于测试已存在的应用。如需创建或生成应用框架,请使用技能;如需了解原始CLI机制,请使用
slack:create-slack-app技能;如需消息或Block Kit格式设置,请使用slack:slack-cli和slack:slack-messaging技能。slack:block-kit - 当前不包含的内容:Bolt的自动化测试框架、以编程方式模拟用户交互、通过浏览器驱动Slack UI。目前由开发者执行交互操作;本技能确保他们确切知道要做什么以及预期结果。