Skip to content

Commit f7646ae

Browse files
feat: Add test case generator sqlpage version
1 parent 98973f9 commit f7646ae

121 files changed

Lines changed: 27316 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Text to Markdown Converter - SQLPage Application
2+
3+
A simple web application built with SQLPage that allows you to enter text and convert it to downloadable markdown files.
4+
5+
## Features
6+
7+
- ✍️ **Text Entry Form**: Enter title and content through a user-friendly web interface
8+
- 💾 **Database Storage**: All entries are saved in a SQLite database
9+
- 📋 **Entry Management**: View all saved entries in a searchable, sortable table
10+
- ⬇️ **Markdown Export**: Download any entry as a properly formatted `.md` file
11+
- 🎨 **Markdown Support**: Use markdown syntax in your content (bold, italic, headings, etc.)
12+
13+
## Prerequisites
14+
15+
You need to have SQLPage installed. Download it from:
16+
- **Official releases**: https://github.com/lovasoa/SQLpage/releases
17+
- **Or use Docker**: `docker pull lovasoa/sqlpage`
18+
19+
## Installation
20+
21+
1. **Download SQLPage** (if not already installed):
22+
- Go to https://github.com/lovasoa/SQLpage/releases
23+
- Download the appropriate version for Windows
24+
- Extract `sqlpage.exe` to this project directory or add it to your PATH
25+
26+
2. **Navigate to the project directory**:
27+
```powershell
28+
cd "d:\MyFolder Ajesh\MyProjects\QualitiFolio_MD_SqlPage\QF_SQLPAGE"
29+
```
30+
31+
## Running the Application
32+
33+
1. **Start the SQLPage server**:
34+
```powershell
35+
sqlpage
36+
```
37+
38+
Or if sqlpage.exe is in the project directory:
39+
```powershell
40+
.\sqlpage.exe
41+
```
42+
43+
2. **Open your browser** and navigate to:
44+
```
45+
http://localhost:8080
46+
```
47+
48+
3. The database will be created automatically on first run.
49+
50+
## Usage
51+
52+
### Creating a New Entry
53+
54+
1. On the home page, enter a **Title** for your entry
55+
2. Enter your **Content** in the text area (you can use markdown syntax)
56+
3. Click **Save Entry**
57+
4. You'll see a success message confirming the entry was saved
58+
59+
### Viewing Saved Entries
60+
61+
1. Click **View Saved Entries** from the home page
62+
2. You'll see a table with all your entries showing:
63+
- ID
64+
- Title
65+
- Preview (first 100 characters)
66+
- Creation date/time
67+
- Download link
68+
69+
### Downloading as Markdown
70+
71+
1. In the entries list, click the **Download** link for any entry
72+
2. A `.md` file will be downloaded with:
73+
- Title as H1 heading
74+
- Creation timestamp
75+
- Full content
76+
77+
## Project Structure
78+
79+
```
80+
QF_SQLPAGE/
81+
├── sqlpage/
82+
│ ├── migrations/
83+
│ │ └── 001_create_text_entries.sql # Database schema
84+
│ └── sqlpage.json # Configuration
85+
├── index.sql # Main page with entry form
86+
├── save_entry.sql # Form submission handler
87+
├── entries.sql # List all entries
88+
├── download.sql # Generate markdown download
89+
└── README.md # This file
90+
```
91+
92+
## Database Schema
93+
94+
The application uses a single table `text_entries`:
95+
96+
| Column | Type | Description |
97+
|------------|----------|--------------------------------|
98+
| id | INTEGER | Primary key (auto-increment) |
99+
| title | TEXT | Entry title |
100+
| content | TEXT | Entry content |
101+
| created_at | DATETIME | Timestamp (auto-generated) |
102+
103+
## Markdown Format
104+
105+
Downloaded files follow this format:
106+
107+
```markdown
108+
# [Entry Title]
109+
110+
---
111+
112+
**Created:** [Timestamp]
113+
114+
---
115+
116+
[Entry Content]
117+
```
118+
119+
## Troubleshooting
120+
121+
**Server won't start:**
122+
- Make sure port 8080 is not already in use
123+
- Check that sqlpage.exe has execution permissions
124+
125+
**Database errors:**
126+
- The database file `sqlpage.db` will be created automatically
127+
- If you see migration errors, delete `sqlpage.db` and restart
128+
129+
**Download not working:**
130+
- Make sure your browser allows downloads
131+
- Check that the entry ID exists in the database
132+
133+
## Technologies Used
134+
135+
- **SQLPage**: Web framework using SQL files
136+
- **SQLite**: Embedded database
137+
- **Markdown**: Text formatting syntax
138+
139+
## License
140+
141+
This project is open source and available for personal and commercial use.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
-- AI Generate Plan Scope
2+
-- Input: requirement_text
3+
-- Output: JSON { "refined_text": "..." }
4+
5+
SET requirements = COALESCE(:requirement_text, '');
6+
7+
-- Build prompt
8+
SET prompt = 'You are a QA Lead. Based on the following requirements, generate a high-level "Test Plan Scope" organized into these three specific sections:
9+
10+
**Objectives**
11+
(Bullet points of testing objectives)
12+
13+
**Risks**
14+
(Bullet points of potential risks)
15+
16+
**Cycle Goals**
17+
(Bullet points of goals for this specific cycle)
18+
19+
Input Requirements:
20+
' || $requirements || '
21+
22+
Return the result in clear Markdown format.
23+
IMPORTANT: Use "**Header**" (Bold) format for the section titles.
24+
Do NOT use "###" or other markdown headers (e.g., do NOT use ### **Objectives**).
25+
Do not add any other introductory text.';
26+
27+
-- Call AI API
28+
SET api_key = COALESCE(
29+
sqlpage.environment_variable('API_KEY'),
30+
sqlpage.environment_variable('GROQ_API_KEY'),
31+
sqlpage.environment_variable('GEMINI_API_KEY')
32+
);
33+
SET api_endpoint = COALESCE(
34+
sqlpage.environment_variable('ANTIGRAVITY_API_ENDPOINT'),
35+
'https://api.groq.com/openai/v1/chat/completions'
36+
);
37+
SET is_groq = CASE WHEN $api_endpoint LIKE '%groq.com%' THEN 1 ELSE 0 END;
38+
SET api_model = COALESCE(sqlpage.environment_variable('GROQ_MODEL'), 'llama-3.3-70b-versatile');
39+
40+
SET api_response = CASE
41+
WHEN $is_groq = 1 THEN
42+
sqlpage.fetch(json_object(
43+
'url', $api_endpoint,
44+
'method', 'POST',
45+
'headers', json_object(
46+
'Content-Type', 'application/json',
47+
'Authorization', 'Bearer ' || $api_key
48+
),
49+
'body', json_object(
50+
'model', $api_model,
51+
'messages', json_array(
52+
json_object('role', 'user', 'content', $prompt)
53+
)
54+
)
55+
))
56+
ELSE
57+
sqlpage.fetch(json_object(
58+
'url', $api_endpoint || '?key=' || $api_key,
59+
'method', 'POST',
60+
'headers', json_object('Content-Type', 'application/json'),
61+
'body', json_object(
62+
'contents', json_array(
63+
json_object('parts', json_array(json_object('text', $prompt)))
64+
)
65+
)
66+
))
67+
END;
68+
69+
-- Extract generated text
70+
SET generated_text = CASE
71+
WHEN $is_groq = 1 THEN json_extract($api_response, '$.choices[0].message.content')
72+
ELSE json_extract($api_response, '$.candidates[0].content.parts[0].text')
73+
END;
74+
75+
SET generated_text = COALESCE($generated_text, 'Error generating content.');
76+
77+
-- Return JSON
78+
SELECT 'json' AS component;
79+
SELECT json_object(
80+
'success', CASE WHEN $generated_text = 'Error generating content.' THEN 0 ELSE 1 END,
81+
'refined_text', $generated_text
82+
) AS contents;
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
-- AI Refine Requirement Details
2+
-- Input: requirement_text
3+
-- Output: JSON { "refined_text": "..." }
4+
5+
SET requirements = COALESCE(:requirement_text, '');
6+
7+
-- Build prompt
8+
SET prompt = 'You are a QA expert. Refine the following Requirement Details and organize it into these three specific sections:
9+
10+
** Requirement Scope**
11+
(High-level summary of what is in scope)
12+
13+
** Functional Requirements**
14+
(Bulleted list of specific behaviors)
15+
16+
** Acceptance Criteria**
17+
(Bulleted list of verifiable criteria)
18+
19+
Input Text:
20+
' || $requirements || '
21+
22+
Return the result in clear Markdown format.
23+
IMPORTANT: Use "** " as the header prefix and "**" as the suffix for the three sections above (e.g., ** Requirement Scope**). Do NOT use "###" or other markdown headers. Do not add any other introductory text.';
24+
25+
-- Call AI API
26+
SET api_key = COALESCE(
27+
sqlpage.environment_variable('API_KEY'),
28+
sqlpage.environment_variable('GROQ_API_KEY'),
29+
sqlpage.environment_variable('GEMINI_API_KEY')
30+
);
31+
SET api_endpoint = COALESCE(
32+
sqlpage.environment_variable('ANTIGRAVITY_API_ENDPOINT'),
33+
'https://api.groq.com/openai/v1/chat/completions'
34+
);
35+
SET is_groq = CASE WHEN $api_endpoint LIKE '%groq.com%' THEN 1 ELSE 0 END;
36+
SET api_model = COALESCE(sqlpage.environment_variable('GROQ_MODEL'), 'llama-3.3-70b-versatile');
37+
38+
SET api_response = CASE
39+
WHEN $is_groq = 1 THEN
40+
sqlpage.fetch(json_object(
41+
'url', $api_endpoint,
42+
'method', 'POST',
43+
'headers', json_object(
44+
'Content-Type', 'application/json',
45+
'Authorization', 'Bearer ' || $api_key
46+
),
47+
'body', json_object(
48+
'model', $api_model,
49+
'messages', json_array(
50+
json_object('role', 'user', 'content', $prompt)
51+
)
52+
)
53+
))
54+
ELSE
55+
sqlpage.fetch(json_object(
56+
'url', $api_endpoint || '?key=' || $api_key,
57+
'method', 'POST',
58+
'headers', json_object('Content-Type', 'application/json'),
59+
'body', json_object(
60+
'contents', json_array(
61+
json_object('parts', json_array(json_object('text', $prompt)))
62+
)
63+
)
64+
))
65+
END;
66+
67+
68+
69+
-- Extract generated text
70+
SET generated_text = CASE
71+
WHEN $is_groq = 1 THEN json_extract($api_response, '$.choices[0].message.content')
72+
ELSE json_extract($api_response, '$.candidates[0].content.parts[0].text')
73+
END;
74+
75+
SET generated_text = COALESCE($generated_text, 'Error generating content.');
76+
77+
-- Return JSON
78+
SELECT 'json' AS component;
79+
SELECT json_object(
80+
'success', CASE WHEN $generated_text = 'Error generating content.' THEN 0 ELSE 1 END,
81+
'refined_text', $generated_text
82+
) AS contents;

0 commit comments

Comments
 (0)