update test arena
This commit is contained in:
48
doc/api.md
Normal file
48
doc/api.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# TestArena API Reference
|
||||
|
||||
## Base URL
|
||||
`http://<server-ip>:8080/api`
|
||||
|
||||
## Endpoints
|
||||
|
||||
### 1. Submit a New Queue
|
||||
`POST /queue`
|
||||
Submits a new set of tasks to the execution queue.
|
||||
**Payload:**
|
||||
```json
|
||||
{
|
||||
"source": "branch_name",
|
||||
"job_id": [
|
||||
"environment",
|
||||
{
|
||||
"task_id": "scenario_path"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Get Status
|
||||
`GET /status/{id}`
|
||||
Gets the status of a specific queue or task.
|
||||
|
||||
### 3. Abort Queue or Task
|
||||
`POST /abort/{id}`
|
||||
Aborts a waiting or running queue or a single task.
|
||||
|
||||
### 4. Delete Queue
|
||||
`DELETE /delete/{id}`
|
||||
Permanently deletes a queue and its associated data.
|
||||
|
||||
## Local API (Web App)
|
||||
|
||||
### Get Job Details
|
||||
`GET /jobs/{job_id}`
|
||||
|
||||
### Get Job Status (Triggers Update)
|
||||
`GET /jobs/{job_id}/status`
|
||||
|
||||
### Abort Job
|
||||
`POST /jobs/{job_id}/abort`
|
||||
|
||||
### Delete Job
|
||||
`POST /jobs/{job_id}/delete`
|
||||
36
doc/architecture.md
Normal file
36
doc/architecture.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# TestArena Architecture Documentation
|
||||
|
||||
## Overview
|
||||
TestArena is a web-based test management and execution platform designed to orchestrate test scenarios across different environments. It consists of a Flask-based frontend/backend that communicates with a remote execution server.
|
||||
|
||||
## System Components
|
||||
|
||||
### 1. Web Application (Flask)
|
||||
- **Frontend**: Built with HTML, CSS (Vanilla), and JavaScript. Provides a dashboard for monitoring jobs, submitting new tests, and viewing logs.
|
||||
- **Backend**: Flask server handling authentication, job management, and API requests.
|
||||
- **Database**: SQLite (default) or PostgreSQL, managed via SQLAlchemy. Stores users and job history.
|
||||
|
||||
### 2. Remote Execution Server
|
||||
- Handles the actual execution of test scenarios.
|
||||
- Exposes APIs for queueing, status polling, and aborting/deleting jobs.
|
||||
- Provides access to execution logs and results.
|
||||
|
||||
## Key Workflows
|
||||
|
||||
### Job Submission
|
||||
1. User selects a branch and validates it via SSH on the remote server.
|
||||
2. User selects test scenarios to run.
|
||||
3. User reviews and submits the job.
|
||||
4. The web app creates a local `Job` record and sends a POST request to the remote `/api/queue` endpoint.
|
||||
|
||||
### Status Polling
|
||||
1. A background thread in the Flask app polls the remote server every 20 seconds for all `waiting` or `in_progress` jobs.
|
||||
2. The dashboard also polls the local API every 5 seconds when a job is being viewed to provide real-time updates.
|
||||
|
||||
### Job Abort/Delete
|
||||
- Users can abort running jobs or delete them entirely. These actions are synchronized with the remote server.
|
||||
|
||||
## Technology Stack
|
||||
- **Backend**: Python, Flask, Flask-SQLAlchemy, Flask-Login, Requests.
|
||||
- **Frontend**: HTML5, CSS3, JavaScript (ES6).
|
||||
- **Remote Communication**: REST API, SSH (for branch validation and scenario scanning).
|
||||
33
doc/user_guide.md
Normal file
33
doc/user_guide.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# TestArena User Guide
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Login
|
||||
Access the TestArena dashboard and log in with your credentials. Default admin credentials are `admin` / `admin123`.
|
||||
|
||||
### Submitting a New Job
|
||||
1. Click the **+ New Job** button on the dashboard.
|
||||
2. Enter the **Branch Name** you want to test and click **Validate Branch**.
|
||||
3. Select the test scenarios you want to include in the job.
|
||||
4. Review your selection and click **Submit Job**.
|
||||
|
||||
## Monitoring Jobs
|
||||
|
||||
### Dashboard
|
||||
The dashboard shows a list of all test jobs. You can see the status (Waiting, In Progress, Passed, Failed, Aborted) and who submitted the job.
|
||||
|
||||
### Job Details
|
||||
Click on a job to view its details:
|
||||
- **Scenario Summary**: Shows the status of each individual scenario in the job.
|
||||
- **Queue Logging**: Real-time logs from the execution queue.
|
||||
|
||||
### Searching
|
||||
Use the search boxes in the sidebar to find jobs by **Job ID** or **Username**. Admins can see all jobs, while regular users see their own by default.
|
||||
|
||||
## Managing Jobs
|
||||
|
||||
### Aborting a Job
|
||||
If a job is running, you can abort it by clicking the **Abort** button in the job details or via the right-click context menu in the job list.
|
||||
|
||||
### Deleting a Job
|
||||
To remove a job from the history and the remote server, click the **Delete** button in the job details or via the right-click context menu.
|
||||
Reference in New Issue
Block a user