genai
Browse files- genai_handler.py +10 -1
genai_handler.py
CHANGED
|
@@ -70,7 +70,9 @@ def generate_test_cases(elements_json_str: str, url: str, num_cases: int = 5) ->
|
|
| 70 |
Present the test cases ONLY as a valid JSON list of objects. Each object must have the following keys:
|
| 71 |
- "Test Case ID": A unique identifier (e.g., TC001, TC002).
|
| 72 |
- "Test Scenario": A brief description of the test objective.
|
| 73 |
-
- "Steps to Execute": Numbered steps describing how to perform the test manually.
|
|
|
|
|
|
|
| 74 |
- "Expected Result": What should happen after executing the steps.
|
| 75 |
|
| 76 |
Example format for a single test case object:
|
|
@@ -81,6 +83,13 @@ def generate_test_cases(elements_json_str: str, url: str, num_cases: int = 5) ->
|
|
| 81 |
"Expected Result": "The contact page should load successfully, displaying contact information or a contact form."
|
| 82 |
}}
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
Ensure the entire output is *only* the JSON list, starting with '[' and ending with ']'. Do not include any introductory text, explanations, or markdown formatting outside the JSON structure itself.
|
| 85 |
"""
|
| 86 |
|
|
|
|
| 70 |
Present the test cases ONLY as a valid JSON list of objects. Each object must have the following keys:
|
| 71 |
- "Test Case ID": A unique identifier (e.g., TC001, TC002).
|
| 72 |
- "Test Scenario": A brief description of the test objective.
|
| 73 |
+
- "Steps to Execute": Numbered steps describing how to perform the test manually.
|
| 74 |
+
- Mention specific element identifiers (text, id, placeholder) where possible from the JSON above.
|
| 75 |
+
- IMPORTANT: When a step requires filling an input field, explicitly state the concrete dummy data to use (e.g., `testuserTC001`, `password123`, `[email protected]`). Do NOT say 'enter a valid username'.
|
| 76 |
- "Expected Result": What should happen after executing the steps.
|
| 77 |
|
| 78 |
Example format for a single test case object:
|
|
|
|
| 83 |
"Expected Result": "The contact page should load successfully, displaying contact information or a contact form."
|
| 84 |
}}
|
| 85 |
|
| 86 |
+
{{
|
| 87 |
+
"Test Case ID": "TC003",
|
| 88 |
+
"Test Scenario": "Verify successful login with specific credentials",
|
| 89 |
+
"Steps to Execute": "1. Go to the homepage.\\n2. Click the link with ID `login2`.\\n3. Fill the input with ID `loginusername` with the value `testuserTC003`.\\n4. Fill the input with ID `loginpassword` with the value `password123!`.\\n5. Click the button with text `Log in`.",
|
| 90 |
+
"Expected Result": "The user should be logged in, and the navbar should show 'Welcome testuserTC003'."
|
| 91 |
+
}}
|
| 92 |
+
|
| 93 |
Ensure the entire output is *only* the JSON list, starting with '[' and ending with ']'. Do not include any introductory text, explanations, or markdown formatting outside the JSON structure itself.
|
| 94 |
"""
|
| 95 |
|