Steps:
- Enter this test code in the main text area:
import os
import sys
import unused_module
def inefficient_function():
data = []
for i in range(len([1,2,3,4,5])):
data.append(i * 2)
counter = 0
while counter < 10:
print(f"Count: {counter}")
counter += 1
return data
result = inefficient_function()- Click "Analyze Code"
- Expected Results:
- Green Score should be around 40-60/100
- Should detect: unused imports, range(len()) pattern, while loop
- Should show security score of 100/100
What to verify:
- Green score gauge displays correctly
- Environmental impact metrics show energy usage
- Code statistics chart shows bars for different metrics
- Issues pie chart displays found problems
- Complexity radar chart shows multiple dimensions
What to verify:
- Expandable issue sections with line numbers
- Specific suggestions for each issue
- Clear descriptions of problems found
Test with this code:
import subprocess
password = "hardcoded123"
user_input = input("Enter command: ")
subprocess.call(user_input, shell=True)
eval("print('dangerous')")Expected Results:
- Security score should be low (20-40/100)
- Should detect: hardcoded credentials, shell injection, eval usage
- Security recommendations should appear
How to test:
- Complete multiple analyses with different scores
- Try to get scores of 80+ and 100
- Expected Results:
- Level progression should update
- Achievement badges should unlock
- LinkedIn sharing button should work
- Progress bars should show advancement
How to test:
- Analyze several different code samples
- Expected Results:
- Interactive chart showing score progression
- List of recent analyses with expandable details
- Export CSV button should work
- Code previews should display
What to verify:
- Energy consumption metrics in microjoules
- Carbon emissions calculations
- Efficiency rating (A+ to F scale)
- Environmental equivalents (smartphone charges, etc.)
- Pie chart showing energy breakdown
What to verify:
- Platform statistics (total users, analyses)
- Global leaderboard showing rankings
- User analytics charts if you're logged in as non-default user
How to test:
- Use the inefficient code sample above
- Check the "Details" tab for refactoring suggestions
- Expected Results:
- Before/after code comparisons
- Specific improvement descriptions
- Performance impact metrics
Steps:
- Use sidebar "Load Sample Code" dropdown
- Try different sample types:
- Basic Inefficient
- Moderate Issues
- Good Code
- Analyze each to see different score ranges
- Code analysis completes without errors
- Green score appears (0-100)
- All 7 tabs load and display content
- Visualizations render (charts, gauges, graphs)
- Database connection works (check Database tab)
- Achievement system responds to good scores
- LinkedIn sharing generates proper URLs
- History tracking works across sessions
- Security analysis detects vulnerabilities
- AI refactoring shows optimization suggestions
- Complete at least 2-3 analyses
- Try achieving scores above 80
- Check Database tab for user statistics
- The button generates a URL - clicking opens LinkedIn
- Copy the generated URL manually if needed
- Refresh the page
- Try analyzing code again
- Check browser console for errors
- Some features depend on PostgreSQL connection
- Basic functionality works with local storage fallback
Code Quality Scores:
- Efficient code: 85-100/100
- Average code: 60-84/100
- Inefficient code: 0-59/100
Security Scores:
- Secure code: 90-100/100
- Minor issues: 70-89/100
- Major vulnerabilities: 0-69/100
The application should handle all test cases gracefully and provide meaningful feedback for code improvement.