Generate TestBox BDD test specs for Wheels models, controllers, and integration tests. Use when creating tests for models (validations, associations), controllers (actions, filters), or integration workflows. Ensures comprehensive test coverage with proper setup/teardown and Wheels testing conventions.
Activate automatically when:
component extends="wheels.Test" {
function setup() {
// Runs before each test
super.setup();
model = model("Post").new();
}
function teardown() {
// Runs after each test
if (isObject(model) && model.isPersisted()) {
model.delete();
}
super.teardown();
}
function testValidatesPresenceOfTitle() {
model.title = "";
assert("!model.valid()");
assert("model.hasErrors('title')");
}
function testHasManyComments() {
model = model("Post").create(title="Test", content="Content");
comment = model("Comment").create(postId=model.id, content="Comment");
assert("model.comments().recordCount == 1");
model.delete(); // Cascade should delete comment
assert("!isObject(model('Comment').findByKey(comment.id))");
}
}
component extends="wheels.Test" {
function setup() {
super.setup();
params = {controller="posts", action="index"};
}
function testIndexLoadsAllPosts() {
controller = controller("Posts", params);
controller.processAction("index");
assert("isQuery(controller.posts)");
}
function testShowRequiresKey() {
params.action = "show";
controller = controller("Posts", params);
// Should redirect due to missing key
}
function testCreateWithValidData() {
params.action = "create";
params.post = {title="Test", content="Content"};
controller = controller("Posts", params);
controller.processAction("create");
assert("flashKeyExists('success')");
}
}
component extends="wheels.Test" {
function testCompletePostLifecycle() {
// Create
post = model("Post").create(title="Test", content="Content");
assert("isObject(post) && post.isPersisted()");
// Update
post.update(title="Updated");
assert("post.title == 'Updated'");
// Add comment
comment = model("Comment").create(postId=post.id, content="Comment");
assert("post.comments().recordCount == 1");
// Delete (cascade)
post.delete();
assert("!isObject(model('Comment').findByKey(comment.id))");
}
}
Generated by: Wheels Test Generator Skill v1.0
npx skills add wheels-dev/Wheels Test Generator下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer