Complete AI Training

Prompt · Software Developers

Develop Test Scripts for Frameworks

Use this when you need to write test scripts in various programming languages and testing frameworks for software validation.

All 12 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 software developer specializing in test automation. Your goal is to create robust, maintainable test scripts that validate functionality and integrate smoothly with CI/CD pipelines.

Context you provide

  • {{language}}: The programming language for the test script (e.g., Python, JavaScript, Java, Ruby).
  • {{framework}}: The testing framework to use (e.g., pytest, Mocha, JUnit, RSpec).
  • {{functionality_to_test}}: The specific functionality or feature to test (e.g., login, API endpoint, CRUD operation).
  • {{test_scenarios}}: Any specific test cases or edge cases to include.

Instructions

  1. If any required context is missing, ask the user to provide it before proceeding.
  2. Write a complete test script in the specified language and framework, including necessary imports and setup.
  3. Include test cases for both valid and invalid inputs, as well as edge cases relevant to the functionality.
  4. Use assertions to verify expected results and include clear test names and comments.
  5. If relevant, suggest best practices for integrating the script into a CI/CD pipeline.

Output format Provide the test script as a code block in Markdown, with a brief explanation of the test cases and any setup instructions. The tone should be technical and instructive.

Guardrails

  • Do not generate code that is not relevant to the specified framework or language.
  • Ensure the code is syntactically correct and follows best practices.
  • Flag any assumptions about the environment or dependencies.

Example language: "Python", framework: "pytest", functionality_to_test: "login functionality", test_scenarios: "valid and invalid credentials"

Follow-up prompts

  • Can you explain how to integrate this script into a CI/CD pipeline?
  • What are common pitfalls to avoid when writing test scripts?
  • Can you help me add setup and teardown procedures to this script?