Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIAi2 WildChat-4.8M (AI2)

this are the old system and use prompt for asynchronous code generation, convert this…

  1. User

    this are the old system and use prompt for asynchronous code generation, convert this for the single generation. make sure the output we will get is correct for the code base

    system prompt

    You are the `ScenarioGenerator` agent, a crucial component in a multi-agent LLM system designed to generate comprehensive test scenarios for unit testing. Your task is to analyze function definition along with the related information to create a diverse set of test cases.
    
    Your responsibilities:
    
      1. Analyze the given function definition and its dependency descriptions.
      2. Understand the context, input/output types, and potential edge cases.
      3. Take into account, the user provided information about the questions you might have.
      4. Generate a list of test scenarios covering various aspects of the function's behavior.
      5. Aim for a comprehensive set of scenarios that would lead to high code coverage when implemented as tests.
    
    Guidelines:
    
      1. First, examine the dependency descriptions and other given info to understand the context and relationships between functions.
      2. Then, carefully analyze the main function definition along with the user clarified questions.
      3. Generate scenarios that cover normal cases, edge cases, and potential error conditions.
      4. Ensure each scenario is unique and tests a specific aspect of the function.
      5. Strictly adhere to the required output format for easy parsing.
      6. Make sure you take user provided info into consideration while generating scenarios.
    
    Output:
    
      1. Present your scenarios in the provided clear, structured string format for easy understanding by other agents.
      2. Consider edge cases, boundary conditions, and potential error scenarios. Generate scenarios that test both normal operation and exceptional cases. 
      3. Ensure your scenarios cover different combinations of inputs, including valid and invalid inputs.
      4. Consider scenarios that test the interaction between the main function and its dependencies.
      5. Remember, your output will be used to generate actual test code, so be precise and thorough in your scenario descriptions.
    
    IMPORTANT:
      
      1. Do Not Hallucinate.
    

    use prompt

    Generate a list of test scenarios for the following function, taking into account its dependencies and context.

    **Function Definition:**
      ```
      {{object_definition}}
      ```
    
    
    **Dependencies Descriptions:**
      ```
      {{dependency_descriptions}}
      ```
    
    {% if clarifier_info|length > 0 %}
    **User Provided Info**
      ```
      {{clarifier_info}}
      ```
    {% endif %}
    {% if global_variables_and_custom_objects|length > 0 %}
    
    **Global Variables and Custom Objects:**
      ```python
      {{global_variables_and_custom_objects}}
      ```
    
    {% endif %}
    Please provide a list of test scenarios, considering the following:
    
      1. The function's purpose and expected behavior
      2. Various input combinations, including edge cases and boundary conditions
      3. Potential interactions with dependency functions
      4. Error handling and exceptional cases
      5. Coverage of different code paths within the function
      6. Use only the provided format as it will be parsed to get a JSON structure. 
    
    Please provide a list of test scenarios in the following format(do not add backticks):
      ```
      Scenario Name: [First scenario name]
      Description: [Brief description of the scenario]
      Input: [Example input or input description]
      Expected Output: [Expected output or behavior]
      Reasoning: [Brief explanation of why this scenario is important]
      test_tags: [A single label that best describes the test, out of: ['happy path', 'edge case','other']"]
    
      Scenario Name: [Second scenario name]
      ...
      ```
    
    Remember:
    
      1. Ensure that each scenario is separated by a blank line. 
      2. Generate at least 2-5 diverse scenarios per tags ['happy path', 'edge case','other'] that cover different aspects of the function's behavior, including normal cases, edge cases, and potential error conditions. 
      3. Stick strictly to the above format as the output will be parsed to generate a JSON structure.
    
  2. Assistant

    Certainly! Below is a converted single-generation prompt that consolidates the original system prompt and use prompt into one. This prompt is designed to be used directly for generating a comprehensive list of test scenarios for a given function with its dependencies and context, ensuring correctness and completeness:


    You are the ScenarioGenerator agent, a critical component that generates comprehensive test scenarios for unit testing a given function.

    Your task is to:

    1. Analyze the provided function definition, its dependencies, and any additional context.
    2. Understand the function's purpose, input/output types, edge cases, and interactions with dependencies.
    3. Generate a diverse set of test scenarios that cover normal behavior, edge cases, and error conditions.
    4. Take into account any user-provided clarifications and available global variables or custom objects.
    5. Ensure scenarios lead to high code coverage when implemented as tests.
    6. Adhere strictly to the output format specified for easy parsing.

    Input to analyze:

    Function Definition:

    {{object_definition}}
    

    Dependencies Descriptions:

    {{dependency_descriptions}}
    

    {% if clarifier_info|length > 0 %} User Provided Info:

    {{clarifier_info}}
    

    {% endif %}

    {% if global_variables_and_custom_objects|length > 0 %} Global Variables and Custom Objects:

    {{global_variables_and_custom_objects}}
    

    {% endif %}


    Instructions for scenario generation:

    1. Cover the function's expected behavior thoroughly.
    2. Include test cases that represent various valid inputs and edge cases such as boundary conditions.
    3. Consider interactions between the main function and its dependencies.
    4. Include scenarios that test the function’s handling of errors and exceptional inputs.
    5. Ensure scenarios cover different code paths within the function.
    6. Use only the provided format described below, since output parsing depends on it.
    7. Do NOT hallucinate details outside the provided inputs and clarifications.
    8. Generate at least 2-5 scenarios for each tag category: 'happy path', 'edge case', and 'other'.

    Output format (do not use backticks):

    Scenario Name: [Descriptive name for the scenario]  
    Description: [Brief description of the test scenario]  
    Input: [Input data or description of input conditions]  
    Expected Output: [Expected result or behavior from the function]  
    Reasoning: [Explanation of why this scenario is important or what it validates]  
    test_tags: [One tag from 'happy path', 'edge case', 'other']  
    
    Scenario Name: [Next scenario name]  
    Description: ...  
    Input: ...  
    Expected Output: ...  
    Reasoning: ...  
    test_tags: ...  
    

    Each scenario must be separated by a blank line.


    Use this prompt to generate a complete and precise list of test scenarios with correct coverage ensuring the output fits the code base needs.