Launch your first automated test in 5 minutes
https://console.anthropic.com最快的方式開始使用AiScripto:
# 拉取最新的Docker鏡像 docker pull aiscripto/aiscripto:latest # 運行容器 docker run -it --rm \ -e CLAUDE_API_KEY=your_api_key_here \ -v $(pwd)/tests:/app/tests \ -v $(pwd)/pages:/app/pages \ aiscripto/aiscripto:latest # 驗證安裝 docker run aiscripto/aiscripto:latest --version # 輸出:AiScripto v2.0.0
如果你更喜歡直接安裝:
# 使用npm安裝 npm install -g aiscripto # 或使用yarn yarn global add aiscripto # 驗證安裝 aiscripto --version
在你的項目目錄創建 .env 文件:
# Claude API配置 CLAUDE_API_KEY=sk-ant-xxxxxxxxxxxxx CLAUDE_MODEL=claude-3-5-sonnet-20241022 # 應用配置 APP_URL=https://app.example.com APP_LOGIN_URL=https://app.example.com/login APP_USERNAME=testuser@example.com APP_PASSWORD=your_secure_password # Playwright配置 PLAYWRIGHT_HEADLESS=true PLAYWRIGHT_TIMEOUT=30000 # 日誌配置 LOG_LEVEL=info DEBUG=false
不要將 .env 文件提交到Git版本控制。
添加它到 .gitignore 並在團隊中安全共享配置。
創建 tests/TC-001-login.txt:
@TC_ID: TC-001
@Title: 用戶登入成功流程
@Author: QA Team
@Tags: authentication, smoke
**前置條件:**
- 用戶未登入系統
- 應用可訪問
**步驟:**
Step 1: 導航至登入頁面
Expected: 顯示用戶名和密碼欄位
Step 2: 在用戶名欄位輸入有效的電子郵件地址
Input: testuser@example.com
Expected: 電子郵件在欄位中顯示
Step 3: 在密碼欄位輸入密碼
Input: SecurePassword123
Expected: 密碼以點狀符號顯示
Step 4: 點擊「登入」按鈕
Expected: 載入動畫出現
Step 5: 等待頁面加載完成
Expected: 重定向到儀表板主頁
顯示歡迎訊息「Welcome, Test User」
Step 6: 驗證用戶名在導航欄中顯示
Expected: 右上角顯示「Test User」
運行以下命令生成測試:
# 完整的轉換管道 aiscripto convert tests/TC-001-login.txt # 或運行單個階段 aiscripto validate tests/TC-001-login.txt aiscripto explore tests/TC-001-login.txt aiscripto generate tests/TC-001-login.txt aiscripto execute tests/TC-001-login.spec.ts
AiScripto將:
1️⃣ 驗證你的測試用例格式
2️⃣ 啟動瀏覽器並探索應用
3️⃣ 生成Playwright TypeScript代碼
4️⃣ 執行測試並驗證成功
project/
├── tests/
│ └── TC-001/
│ ├── login.spec.ts # 生成的測試規範
│ └── login.data.json # 測試數據(如有)
├── src/
│ └── pages/
│ └── LoginPage.ts # 頁面物件模型
├── fixtures/
│ └── auth.ts # 認證fixtures
└── reports/
└── TC-001-results.json # 執行結果
cat tests/TC-001/login.spec.ts
你會看到完全自動生成的、型別安全的Playwright測試代碼, 遵循所有最佳實踐。
# 運行單個測試 npx playwright test tests/TC-001/login.spec.ts # 運行所有測試 npx playwright test # 以調試模式運行(帶GUI) npx playwright test --debug # 生成HTML報告 npx playwright test --reporter=html
# 打開HTML報告 npx playwright show-report
使用清晰的語言,包括具體的步驟、輸入和預期結果。 避免歧義和複雜的邏輯。
創建專用的測試帳戶,不要使用真實用戶數據。 定期重置測試數據以保持一致性。
按功能區域或工作流程組織測試。 使用有意義的文件名和標籤。
提交測試用例和生成的代碼到Git。 跟蹤測試歷史和變更。
在GitHub Actions、GitLab CI或Jenkins中集成測試。 每個提交都自動運行測試。
監控測試性能和失敗率。 定期優化慢速測試。
解決方案:
解決方案:
解決方案:
現在就開始你的30天免費試用