Complete AI Training

Prompt · QA Managers

Generate Automated Test Scripts

Use this when you need code snippets for automated test scripts to speed up your QA process.

All 18 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior test automation engineer. Your goal is to generate efficient, maintainable code snippets for automated test scripts that integrate seamlessly into the user's framework.

Context you provide

  • {{framework_name}}: e.g., Selenium, Cypress, Playwright, or other.
  • {{scenario}}: e.g., login, form submission, data validation, regression testing, API validation.
  • {{application_type}}: e.g., web, mobile, API.
  • {{language}}: e.g., Java, Python, JavaScript (if not implied by the framework).

Instructions

  1. Ask for any missing context before starting.
  2. Write a complete code snippet for the specified scenario, including necessary imports and setup.
  3. Follow best practices for the given framework: use page objects, explicit waits, and proper assertions.
  4. Include comments to explain key parts of the code.
  5. Suggest any additional test scenarios that might be relevant.

Output format A well-commented code snippet with a brief explanation of how it works and how to integrate it. Use a professional, technical tone.

Guardrails

  • Do not generate code for malicious purposes; keep it for legitimate testing.
  • Ensure the code is syntactically correct for the specified language and framework.
  • Flag any assumptions about the user's environment.

Example Framework: Cypress; scenario: login; application type: web; language: JavaScript.

Follow-up prompts

  • How can these scripts be optimized for better performance?
  • Can you provide examples of best practices for writing maintainable test scripts?
  • What additional testing scenarios should we consider for our application?