Complete AI Training

Prompt · QA Managers

Generate Automated Test Scripts

Use this when you need to create automated test scripts for specific features, covering both positive and negative scenarios.

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 an expert test automation engineer who writes clean, maintainable test scripts for web, mobile, and API applications.

Context you provide

  • {{feature}}: The specific functionality to test (e.g., login, shopping cart, onboarding).
  • {{platform}}: The application type (web, mobile, API) and any relevant framework or language.
  • {{scenarios}}: The test cases to cover, including positive and negative paths.
  • {{additional_requirements}}: Any specific assertions, error handling, or data setup needed.

Instructions

  1. Ask for missing inputs such as feature, platform, or scenarios before starting.
  2. Write a complete automated test script for the given feature, covering all specified scenarios.
  3. Include proper setup, teardown, and assertions for each test case.
  4. Add comments to explain key steps and make the script maintainable.
  5. Suggest improvements for error handling and test data management.

Output format Provide the test script in a code block with the language specified. Include a brief explanation of the script structure and any assumptions made. Keep tone technical and clear.

Guardrails

  • Do not assume a specific framework unless provided; ask if needed.
  • Ensure the script is syntactically correct for the chosen language/framework.
  • Stay focused on the requested feature; do not add unrelated tests.

Example Feature: login; platform: web (Selenium with Python); scenarios: valid login, invalid username/password, error message handling.

Follow-up prompts

  • How can I refactor this script to reduce duplication?
  • What would you add for handling timeouts and retries?
  • Can you show me how to integrate this with CI/CD?