원클릭으로
add-test
Add tests for an Arizona module. Use when creating CT suites, inline EUnit tests, or E2E tests.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Add tests for an Arizona module. Use when creating CT suites, inline EUnit tests, or E2E tests.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Add a new route to the Arizona router configuration. Use when creating new pages or endpoints.
Scaffold a new Arizona handler module. Ask whether it's a route-level view or an embeddable stateful component.
Trace an event through the full Arizona stack from client click to DOM patch. Use when debugging event handling.
Profile Arizona hot paths with eprof/fprof. Use when investigating performance or picking the next optimization.
Format, check, test, and commit changes. Use before committing any code changes.
Debug Arizona stream operations. Use when investigating stream insert/delete/update/move/sort/reset behavior.
| name | add-test |
| description | Add tests for an Arizona module. Use when creating CT suites, inline EUnit tests, or E2E tests. |
| argument-hint | ["module_or_file"] |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash |
Add tests for $ARGUMENTS.
Read the module to understand what it does, then choose the right test approach:
Common Test (default) -- for all Erlang tests (unit, stateful, integration):
test/<module>_SUITE.erl-include_lib("stdlib/include/assert.hrl").all/0 and all test functions with arity /1(Config) when is_list(Config) -> -- no _test suffixinit_per_suite/1, end_per_suite/1 only if setup is neededtest/support/rebar3 ct --suite=<module>_SUITEEUnit (inline only) -- for testing private functions within a source module:
-ifdef(TEST). / -endif. block at the bottom of the source module-include_lib("eunit/include/eunit.hrl")._test() (EUnit convention)rebar3 eunit --module=<module>E2E (Playwright) -- for full browser interaction:
e2e/parallel/<name>.spec.js (or e2e/sequential/ if tests share state)workers: 1 in config to avoid pg channel leaksnpx playwright test <spec_file>Use named groups/0 matching section comments in the file. Use [parallel] for stateless tests, [sequence] for tests with shared state (persistent_term, pg, ets). all/0 must come before groups/0. Never use list comprehensions in all/0.
-module(my_module_SUITE).
-include_lib("stdlib/include/assert.hrl").
-export([all/0, groups/0]).
-export([
renders_html/1,
diffs_no_change/1,
diffs_attr_change/1
]).
%% all/0 before groups/0, plain list of {group, Name} tuples
all() ->
[
{group, render},
{group, diff}
].
%% Group names match section comments in the file
groups() ->
[
{render, [parallel], [
renders_html
]},
{diff, [parallel], [
diffs_no_change,
diffs_attr_change
]}
].
%% =============================================================================
%% render
%% =============================================================================
renders_html(Config) when is_list(Config) ->
T = Handler:render(Handler:mount(#{})),
HTML = iolist_to_binary(arizona_render:render_to_iolist(T)),
?assertMatch(<<"<div", _/binary>>, HTML).
%% =============================================================================
%% diff
%% =============================================================================
diffs_no_change(Config) when is_list(Config) ->
B = Handler:mount(#{}),
{_HTML, Snap} = arizona_render:render(Handler:render(B)),
{Ops, _Snap2} = arizona_diff:diff(Handler:render(B), Snap),
?assertEqual([], Ops).
diffs_attr_change(Config) when is_list(Config) ->
ok.
Cleanup rules:
init_per_testcaseend_per_testcaseend_per_testcase still runswatcher_opts(TC) style helper to centralize per-test configFor parse transform, compile source as string:
compile_and_render(Config) when is_list(Config) ->
Mod = compile_module("-module(test_mod). "
"-include(\"arizona_stateless.hrl\"). "
"-export([render/1]). "
"render(Bindings) -> ?html({p, [], [?get(x)]})."),
T = Mod:render(#{x => <<"hello">>}),
?assert(is_map(T)).
rebar3 ct --suite=$ARGUMENTS_SUITE # single CT suite
rebar3 eunit --module=$ARGUMENTS # inline EUnit tests
npx playwright test $ARGUMENTS.spec.js # single E2E spec