|
import streamlit as st |
|
import backend |
|
import os |
|
|
|
|
|
st.title("Test Case Generator - QA User Story") |
|
|
|
|
|
user_story = st.text_area("Enter the QA User Story", "") |
|
|
|
|
|
if st.button("Generate Test Cases"): |
|
if user_story: |
|
|
|
with st.spinner("Generating test cases..."): |
|
test_cases = backend.generate_testcases(user_story) |
|
st.subheader("Generated Test Cases") |
|
st.write(test_cases) |
|
st.session_state.test_cases = test_cases |
|
else: |
|
st.error("Please enter a user story to generate test cases.") |
|
|
|
|
|
st.sidebar.title("Export Test Cases") |
|
if st.sidebar.button("Export Test Cases as CSV", key="export_button"): |
|
if 'test_cases' in st.session_state: |
|
test_cases = st.session_state.test_cases |
|
export_content = backend.export_test_cases(test_cases, 'csv') |
|
|
|
mime_type = "text/csv" |
|
|
|
if export_content: |
|
st.sidebar.download_button( |
|
label="Download Test Cases as CSV", |
|
data=export_content, |
|
file_name="test_cases.csv", |
|
mime=mime_type, |
|
key="download_button" |
|
) |
|
else: |
|
st.sidebar.error("No test cases available to export.") |
|
|
|
|
|
st.markdown("---") |
|
st.write("Built by the QA Automation Team") |
|
|