@@ -38,13 +38,15 @@ It is designed to showcase how QA validation works for AI systems such as LLMs a
3838- Reusable Validation Logic
3939- Scalable Test Design for ML systems
4040
41- ## ⚠️ AI Risks Covered
41+ ## ⚠️ Validation Risks Covered
4242
43- - Hallucination
44- - Incorrect predictions
45- - Context loss
46- - Prompt variation inconsistency
47- - Unsafe responses
43+ - Incorrect sentiment classification
44+ - Prediction inconsistency against expected outputs
45+ - Text preprocessing errors
46+ - Empty-input handling
47+ - Numeric-input handling
48+ - Input-format variation
49+ - Regression against golden test data
4850
4951---
5052
@@ -61,78 +63,105 @@ It is designed to showcase how QA validation works for AI systems such as LLMs a
6163## 📁 Project Structure
6264
6365``` text
64- Project structure here
65-
6666NLP-Model-Testing-Framework-Python-Pytest/
67-
67+ │
68+ ├── .github/
69+ │ └── workflows/
70+ │ └── ci.yml
6871│
6972├── nlp_model/
70-
71- │ ├── __init__.py
72-
73- │ ├── sentiment_model.py
74-
75- │ └── text_preprocessor.py
73+ │ ├── __init__.py
74+ │ ├── sentiment_model.py
75+ │ └── text_preprocessor.py
7676│
7777├── tests/
78-
79- │ ├── __init__.py
80-
81- │ ├── test_sentiment_prediction.py
82-
83- │ ├── test_text_preprocessing.py
84-
85- │ ├── test_edge_cases.py
86-
87- │ └── test_data_driven_sentiment.py
78+ │ ├── __init__.py
79+ │ ├── test_sentiment_prediction.py
80+ │ ├── test_text_preprocessing.py
81+ │ ├── test_edge_cases.py
82+ │ └── test_data_driven_sentiment.py
8883│
8984├── test_data/
90-
91- │ └── sentiment_test_data.csv
85+ │ └── sentiment_test_data.csv
9286│
9387├── screenshots/
94-
95- │ └── pytest-result.png
88+ │ └── pytest-result.png
9689│
9790├── requirements.txt
98-
9991└── README.md
100-
92+ ```
10193
10294---
10395
10496## 🧪 Test Scenarios Covered
10597
106- ### 1️⃣ Sentiment Prediction Testing
98+ ### Sentiment Prediction Validation
99+
100+ The test suite validates positive, negative and neutral sentiment behavior.
107101
108102``` python
109103def test_positive_sentiment ():
110- assert predict_sentiment("I love this product") == "positive"
104+ result = predict_sentiment(" I am very happy today" )
105+ assert result == " positive"
106+ ```
107+
108+ ### Text Preprocessing
111109
112- 2️⃣ Text Preprocessing Validation
110+ Input normalization is validated before model-style processing.
111+
112+ ``` python
113113def test_text_cleaning ():
114- assert clean_text("HELLO!!!") == "hello"
114+ result = clean_text(" Hello!!! How are you??" )
115+ assert result == " hello how are you"
116+ ```
117+
118+ ### Edge Cases
115119
116- 3️⃣ Edge Case Testing
117- Empty input
118- Numeric input
119- Mixed-case input
120+ Coverage includes:
120121
121- 4️⃣ Data-Driven Testing (CSV-Based)
122+ - Empty input
123+ - Numeric input
124+ - Positive text
125+ - Negative text
126+ - Neutral text
127+
128+ ### Data-Driven Validation
129+
130+ Expected inputs and outputs are maintained in:
131+
132+ ``` text
133+ test_data/sentiment_test_data.csv
134+ ```
135+
136+ Example:
137+
138+ ``` csv
122139text,expected_sentiment
123- I love this,positive
124- This is bad,negative
140+ I love this product,positive
141+ This is bad service,negative
142+ I am walking in park,neutral
143+ ```
125144
126- ▶️ How to Run
145+ This acts as a small ** golden test dataset** for regression validation.
146+
147+ ---
148+
149+ ## ▶️ Running the Tests
150+
151+ ``` bash
127152pip install -r requirements.txt
128153python -m pytest -v
154+ ```
129155
130- 📊 Test Execution Output (Pytest)
131- 7 passed in 0.06s
156+ Current execution:
132157
158+ ``` text
159+ 7 passed
133160```
134161
135- ## 📸 Test Execution Screenshot
162+ ---
163+
164+ ## 📸 Test Execution Evidence
136165
137166![ Pytest Output] ( screenshots/pytest-result.png )
138167
0 commit comments