File size: 1,719 Bytes
1d4dc07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Atlas Analytics Test Suite

This folder contains test scripts for validating the Atlas analytics system functionality.

## Test Files

### Core Tests

- **`test_mongo_connection.py`** - Test MongoDB connection (both sync and async)
- **`test_analytics.py`** - Basic analytics functions test
- **`debug_analytics.py`** - Comprehensive analytics debugging tool

### Integration Tests

- **`test_chat_analytics.py`** - Test end-to-end chat analytics collection
- **`validate_mongodb_data.py`** - Validate data collection and dashboard accuracy

### Deployment Tests

- **`deployment_check.py`** - Complete deployment readiness check

## Usage

### Quick MongoDB Test
```bash
cd tests
python test_mongo_connection.py
```

### Debug Analytics Issues
```bash
cd tests
python debug_analytics.py
```

### Validate Data Collection
```bash
cd tests
python validate_mongodb_data.py
```

### Test Chat Analytics (requires server running)
```bash
cd tests
python test_chat_analytics.py
```

### Deployment Readiness Check
```bash
cd tests
python deployment_check.py
```

## Prerequisites

- Atlas server environment activated
- `.env` file configured with MongoDB, Google, and Brave API keys
- MongoDB Atlas connection working

## Test Scenarios

### 1. Fresh Installation
```bash
python deployment_check.py
```

### 2. Analytics Not Working
```bash
python debug_analytics.py
```

### 3. Data Collection Issues
```bash
python validate_mongodb_data.py
```

### 4. End-to-End Testing
```bash
# Start server first
./start.sh

# Then test
python test_chat_analytics.py
```

## Expected Results

All tests should pass with ✅ indicators when the system is working correctly. Any ❌ indicators suggest issues that need to be resolved.