Zero-Code Auth Platform with WorkBuddy: UI, Security & Automated Tests
This tutorial demonstrates building a complete registration and login platform using WorkBuddy AI without writing code, covering UI prototyping, validation rules, SHA256 password hashing, CSRF protection, and both GUI (Playwright POM) and API (requests+unittest) test suites with all 157 tests passing.
The article walks through the end-to-end creation of a registration and login platform using the WorkBuddy AI coding assistant, without writing any code manually. The process is driven entirely by natural-language prompts.
Project Setup and Initial Prompt
1. Open WorkBuddy and start a new project to establish a working directory.
2. Provide the initial prompt:
我要开发一个系统注册登录程序。请严格按照我说的进行操作,不要操作我没有提及的操作。(I want to develop a system registration/login program. Follow my instructions strictly; do not perform operations I haven't mentioned.)
3. Launch WorkBuddy.
Detailed Requirements for UI Prototype
4. Supply a detailed prompt describing the registration and login pages, including fields, validation rules, and a request to show the UI prototype first:
Registration page fields: Account (text, 5-20 chars, letters required, digits optional), Password (password, 5-30 chars, must contain upper/lower letters, digits, special chars, transmitted/stored as SHA256 hash), Confirm Password (password, must match password, front-end only), Phone (Chinese mobile format), Email (standard format), Register Button (submits form).
Login page fields: Account (same rules), Password (same rules, SHA256 hash for transmission), Login Button.
Explicit instruction: 先给我呈现界面原型,不要开发程序。 (Show me the UI prototype first, don't develop the program.)
Iterative UI Refinement
5. The first prototype uses a black-and-white color scheme. A follow-up prompt requests a light green background with dark green foreground, and refined label texts for both pages.
6. Further tweaks: unify the account hint text across both pages, remove the phrases "创建账号以使用系统" (Create account to use system) and "使用已注册的账号登录系统" (Log in with registered account), and design an attractive login success page.
Program Generation and Security Hardening
7. After UI approval, prompt WorkBuddy to implement the full program: 请完成登录注册程序 (Please complete the login/registration program).
8. A security flaw is found: accessing the success page URL directly bypasses login. Prompt to fix:
修改登录页面,如果一上来没有经过登录操作就在地址栏中输入登录成功页面的URL,请直接重定向到登录页面,而不是进入登录成功页面,当前登录账号为:——(Modify login page: if user enters success page URL without logging in, redirect to login page).
9. Add CSRF protection: 请加上csrftoken技术,防止csrf注入攻击 (Add CSRF token technology to prevent CSRF injection attacks).
GUI Test Suite (Playwright + POM + unittest)
10. Create GUI tests using Page Object Model, Playwright, and unittest. Tests placed in .\test\Playwright directory. Prompt:
就这个项目,按照POM+Playwright+unitetest的架构开发测试代码。测试登录和注册功能。测试代码在.\test\Playwright目录下。11. Execute .\test\Playwright\_runall.py. Results:
===========================================
运行模块:tests.test_register
===========================================
{
"module": "register",
"module_path": "tests.test_register",
"returncode": 0,
"ran": 48,
"status": "OK",
"duration_sec": 81.44,
"ok_line": "OK",
"failed_line": null
}
===========================================
运行模块:tests.test_login
===========================================
{
"module": "login",
"module_path": "tests.test_login",
"returncode": 0,
"ran": 22,
"status": "OK",
"duration_sec": 39.27,
"ok_line": "OK",
"failed_line": null
}
===========================================
register OK 用例数=48 OK
login OK 用例数=22 OK
合计运行用例数:70
失败模块:无
明细:C:\Code\workbuddy\开发\注册登录\test\results\summary.json
===========================================API Test Suite (requests + unittest)
12. Create API tests using requests and unittest in .\test\API. Prompt:
就这个项目,按照requests+unitetest的架构开发API接口测试代码。测试登录和注册功能。测试代码在.\test\API目录下。13. Run _runall.py in the API test directory. Results:
[register] total=63 passed=63 failed=0 errors=0 (4.90s) -> results/register.json
[login] total=24 passed=24 failed=0 errors=0 (0.30s) -> results/login.json
===========================================
API 测试全量结果:87/87 通过,失败 0,错误 0,耗时 6.28s
===========================================
register total=63 passed=63 failed=0 errors=0 (4.90s)
login total=24 passed=24 failed=0 errors=0 (0.30s)
结果文件:results/summary.jsonAll 70 GUI tests and 87 API tests pass, demonstrating a fully functional, tested authentication platform built entirely through prompt engineering with WorkBuddy.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Woodpecker Software Testing
The Woodpecker Software Testing public account shares software testing knowledge, connects testing enthusiasts, founded by Gu Xiang, website: www.3testing.com. Author of five books, including "Mastering JMeter Through Case Studies".
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
