ArvindSelvaraj commited on
Commit
1396f9a
1 Parent(s): 62dd117

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -14,13 +14,24 @@ if st.button("Generate Test Cases"):
14
  # Show a spinner while the test cases are being generated
15
  with st.spinner("Generating test cases..."):
16
  test_cases = backend.generate_testcases(user_story)
17
- st.subheader("Generated Test Cases")
18
- st.write(test_cases)
19
- st.session_state.test_cases = test_cases # Store test cases in session state for further use
 
 
 
 
 
 
 
 
 
 
 
20
  else:
21
  st.error("Please enter a user story to generate test cases.")
22
 
23
- # Export test cases
24
  st.sidebar.title("Export Test Cases")
25
  format = st.sidebar.selectbox("Select Format", ["excel"], key="export_format") # Only "excel" as an option
26
  if st.sidebar.button("Export Test Cases", key="export_button"):
 
14
  # Show a spinner while the test cases are being generated
15
  with st.spinner("Generating test cases..."):
16
  test_cases = backend.generate_testcases(user_story)
17
+ if test_cases:
18
+ st.subheader("Generated Test Cases")
19
+ # Display the test cases in a readable format on the page
20
+ for idx, case in enumerate(test_cases, start=1):
21
+ st.write(f"**Test Case {idx}:**")
22
+ st.write(f"**Preconditions:** {case.get('Preconditions', 'N/A')}")
23
+ st.write(f"**Steps:** {case.get('Steps', 'N/A')}")
24
+ st.write(f"**Expected Result:** {case.get('Expected Result', 'N/A')}")
25
+ st.write("---") # Divider between test cases
26
+
27
+ # Store test cases in session state for further use (e.g., export)
28
+ st.session_state.test_cases = test_cases
29
+ else:
30
+ st.error("No test cases generated. Please try again with a different user story.")
31
  else:
32
  st.error("Please enter a user story to generate test cases.")
33
 
34
+ # Sidebar for exporting test cases
35
  st.sidebar.title("Export Test Cases")
36
  format = st.sidebar.selectbox("Select Format", ["excel"], key="export_format") # Only "excel" as an option
37
  if st.sidebar.button("Export Test Cases", key="export_button"):