Sborole commited on
Commit
25a6190
·
verified ·
1 Parent(s): 332a9d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py CHANGED
@@ -8,6 +8,45 @@ from tools.generate_test_cases import generate_test_cases
8
 
9
  from Gradio_UI import GradioUI
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
 
8
 
9
  from Gradio_UI import GradioUI
10
 
11
+ from typing import List, Dict
12
+
13
+ def generate_test_cases(topic: str) -> List[Dict[str, str]]:
14
+ """
15
+ Suggest simple QA test cases for a given topic.
16
+
17
+ Args:
18
+ topic: The feature, function, or topic to generate test cases for.
19
+
20
+ Returns:
21
+ A list of test cases, each with input and expected output.
22
+ """
23
+ topic_lower = topic.lower()
24
+ test_cases = []
25
+
26
+ if "login" in topic_lower:
27
+ test_cases = [
28
+ {"test_case": "Valid login", "input": "Correct username/password", "expected_output": "User is logged in successfully"},
29
+ {"test_case": "Invalid password", "input": "Wrong password", "expected_output": "Error message displayed"},
30
+ {"test_case": "Empty username", "input": "Username left blank", "expected_output": "Error message displayed"},
31
+ {"test_case": "Empty password", "input": "Password left blank", "expected_output": "Error message displayed"},
32
+ ]
33
+ elif "calculator" in topic_lower:
34
+ test_cases = [
35
+ {"test_case": "Addition", "input": "2 + 3", "expected_output": "5"},
36
+ {"test_case": "Subtraction", "input": "5 - 2", "expected_output": "3"},
37
+ {"test_case": "Multiplication", "input": "4 * 5", "expected_output": "20"},
38
+ {"test_case": "Divide by zero", "input": "5 / 0", "expected_output": "Error handled gracefully"},
39
+ ]
40
+ else:
41
+ # Generic template
42
+ test_cases = [
43
+ {"test_case": f"Test case 1 for {topic}", "input": "Sample input", "expected_output": "Expected behavior"},
44
+ {"test_case": f"Test case 2 for {topic}", "input": "Another input", "expected_output": "Expected behavior"},
45
+ {"test_case": f"Test case 3 for {topic}", "input": "Additional input", "expected_output": "Expected behavior"},
46
+ ]
47
+
48
+ return test_cases
49
+
50
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
51
  @tool
52
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type