ArvindSelvaraj commited on
Commit
c890e84
1 Parent(s): dac5949

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -16
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import streamlit as st
2
  import backend # Importing backend functions
3
- import os
4
 
5
  # Title
6
  st.title("Test Case Generator - QA User Story")
@@ -22,28 +21,17 @@ if st.button("Generate Test Cases"):
22
 
23
  # Export test cases
24
  st.sidebar.title("Export Test Cases")
25
- format = st.sidebar.selectbox("Select Format", ["json", "csv", "excel"], key="export_format") # Added "excel" as an option
26
  if st.sidebar.button("Export Test Cases", key="export_button"):
27
  if 'test_cases' in st.session_state:
28
  test_cases = st.session_state.test_cases
29
- export_content = backend.export_test_cases(test_cases, format)
30
-
31
- if format == 'json':
32
- mime_type = "application/json"
33
- elif format == 'csv':
34
- mime_type = "text/csv"
35
- elif format == 'excel':
36
- mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
37
- else:
38
- st.sidebar.error(f"Unsupported format: {format}")
39
- export_content = None
40
 
41
  if export_content:
42
  st.sidebar.download_button(
43
- label=f"Download Test Cases as {format.upper()}",
44
  data=export_content,
45
- file_name=f"test_cases.{format}",
46
- mime=mime_type,
47
  key="download_button"
48
  )
49
  else:
 
1
  import streamlit as st
2
  import backend # Importing backend functions
 
3
 
4
  # Title
5
  st.title("Test Case Generator - QA User Story")
 
21
 
22
  # Export test cases
23
  st.sidebar.title("Export Test Cases")
 
24
  if st.sidebar.button("Export Test Cases", key="export_button"):
25
  if 'test_cases' in st.session_state:
26
  test_cases = st.session_state.test_cases
27
+ export_content = backend.export_test_cases(test_cases)
 
 
 
 
 
 
 
 
 
 
28
 
29
  if export_content:
30
  st.sidebar.download_button(
31
+ label="Download Test Cases as EXCEL",
32
  data=export_content,
33
+ file_name="test_cases.xlsx",
34
+ mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
35
  key="download_button"
36
  )
37
  else: