science-source / testing.md
sameerbanchhor-work's picture
Upload folder using huggingface_hub
248474f verified
|
Raw History Blame Contribute Delete
6.32 kB
# Govt. Science College Durg - Student Query API Test Report
This document records the verification tests executed against the `science_source` FastAPI backend service.
* **Service Endpoint**: `http://127.0.0.1:8000/api/results`
* **Test Date**: July 17, 2026
* **Status**: All Tests Passed Successfully
---
## Test Case 1: Exact Roll Number Lookup in Database Mode (`mode=db`)
* **Objective**: Verify that the API instantly returns the full detailed JSON profile for an indexed roll number using memory indexes.
* **Command**:
```bash
curl -s "http://127.0.0.1:8000/api/results?rollno=2221002&mode=db"
```
* **Response Summary (Truncated JSON)**:
```json
[
{
"roll_no": "2221002",
"fin_year": "2024-2025",
"stream_name": "B.A. SEMESTER-I",
"profile": {
"name": "AAMNI KOSHLE",
"mobile_no": "7898503991",
"roll_no": "2221002",
"enroll_no": "HU/301/230010004",
"father_name": "RESHAM LAL KOSHLE",
"mother_name": "SARITA KOSHLE",
"category": "SC",
"dob": "29.06.2004",
"address": "36,Nardaha,Dhansuli,Raipur ,",
"photo_url": "https://govtsciencecollegedurg.onlineexamforms.com/Photo_New/6200.jpg",
"signature_url": "https://govtsciencecollegedurg.onlineexamforms.com/Images/nophoto.gif",
"email": "koshleaamni@gmail.com",
"local_photo_path": "media/2221002_photo.jpg",
"local_signature_path": ""
},
"supplementary_info": {
"last_date_form_submission": "25-Jul-2022",
"total_subjects_selected": "0",
"total_fees": ""
},
"course_history": [
{
"class": "B.A. SEMESTER-I",
"s_no": "1",
"exam_roll_no": "2221002",
"status": "ATKT"
}
],
"transaction_history": [
{
"class": "B.A. SEMESTER-III",
"merchant_txn_no": "11000252635963",
"paid_fees": "640.00",
"payment_status": "Success"
}
],
"source": "db"
}
]
```
* **Result**: **PASS** (Profile, registration timeline, and transaction histories mapped correctly with `"source": "db"`).
---
## Test Case 2: Student Name Query Search (`mode=db`)
* **Objective**: Verify that searching for a student by name returns matching student listings (both full DB profiles and partial CSV references).
* **Command**:
```bash
curl -s "http://127.0.0.1:8000/api/results?rollno=anita&mode=db"
```
* **Response Summary (Truncated JSON)**:
```json
[
{
"roll_no": "2221009",
"fin_year": "2024-2025",
"stream_name": "B.A. SEMESTER-I",
"profile": {
"name": "ANITA NAYAK",
"mobile_no": "9179593812",
"father_name": "BHARAT NAYAK",
"category": "GEN"
},
"source": "db"
}
]
```
* **Result**: **PASS** (Returned match for "ANITA NAYAK").
---
## Test Case 3: Live Portal Scrape lookup (`mode=live`)
* **Objective**: Verify that the live scraper logs in to the official exam portal dynamically, resolves the class ID via suffix-guessing, parses the student details, and returns the response in a unified format.
* **Command**:
```bash
curl -s "http://127.0.0.1:8000/api/results?rollno=2221002&mode=live"
```
* **Response Summary (Truncated JSON)**:
```json
[
{
"roll_no": "2221002",
"fin_year": "2024-2025",
"stream_name": "B.A. SEMESTER-III",
"profile": {
"name": "AAMNI KOSHLE",
"enroll_no": "HU/301/230010004",
"photo_url": "https://govtsciencecollegedurg.onlineexamforms.com/Photo_New/6200.jpg"
},
"course_history": [
{
"class": "B.A. SEMESTER-I",
"status": "ATKT"
},
{
"class": "B.A. SEMESTER-III",
"status": "ATKT"
}
],
"source": "live"
}
]
```
* **Result**: **PASS** (Live state scraped successfully from exam portal. Note that `stream_name` resolved to `B.A. SEMESTER-III`, reflecting the student's current live academic enrollment instead of the cached `SEMESTER-I` database reference).
---
## Test Case 4: Non-Existent Search Query
* **Objective**: Verify that querying an invalid number returns an empty listing without exceptions.
* **Command**:
```bash
curl -s "http://127.0.0.1:8000/api/results?rollno=9999999&mode=db"
```
* **Response**:
```json
[]
```
* **Result**: **PASS** (Clean empty array returned).
---
## Test Case 5: Live Scrape on Unknown Prefix
* **Objective**: Verify that requesting a live lookup on an unknown prefix that cannot be correlated raises an informative HTTP 400 error.
* **Command**:
```bash
curl -s "http://127.0.0.1:8000/api/results?rollno=9999999&mode=live"
```
* **Response**:
```json
{
"detail": "Course class could not be resolved automatically for this roll number. Please specify the course class option manually."
}
```
* **Result**: **PASS** (HTTP 400 with instruction raised).
---
## Test Case 6: Live Scrape with Manual Override and Non-Existent Record
* **Objective**: Verify that manually overriding the Course ID but passing an invalid roll number query routes correctly to the portal and raises a 401 login warning with details from the portal alert.
* **Command**:
```bash
curl -s "http://127.0.0.1:8000/api/results?rollno=9999999&mode=live&class_id=138"
```
* **Response**:
```json
{
"detail": "Live scraper failed or student record not found on exam portal: 401: Exam Portal login failed: No Record Found"
}
```
* **Result**: **PASS** (Returned 401 portal message "No Record Found").