IQKiller / test_interview_guide.py
AvikalpK's picture
✨ Enhanced salary negotiation game with 30 scenarios and removed API keys
16a9080
#!/usr/bin/env python3
"""
Test script for the personalized interview guide functionality.
Demonstrates the complete pipeline: Resume + Job β†’ Gap Analysis β†’ Personalized Guide
"""
import asyncio
import json
from interview_orchestrator import create_personalized_interview_guide
# Sample resume data
SAMPLE_RESUME = """
John Smith
Software Engineer
john.smith@email.com | (555) 123-4567 | LinkedIn: linkedin.com/in/johnsmith | GitHub: github.com/johnsmith
PROFESSIONAL SUMMARY
Experienced full-stack software engineer with 3+ years developing web applications using Python, JavaScript, and cloud technologies. Strong background in API development, database design, and agile methodologies.
TECHNICAL SKILLS
Programming Languages: Python, JavaScript, SQL, HTML/CSS
Frameworks: Django, React, Node.js, Express
Databases: PostgreSQL, MongoDB, Redis
Cloud/DevOps: AWS (EC2, S3, RDS), Docker, Git, CI/CD
Tools: VS Code, Postman, Jira, Slack
PROFESSIONAL EXPERIENCE
Software Engineer | TechCorp | Jan 2021 - Present
β€’ Developed and maintained 5+ web applications serving 10,000+ users daily
β€’ Built RESTful APIs using Python/Django with 99.9% uptime
β€’ Implemented responsive front-end components using React and modern JavaScript
β€’ Collaborated with cross-functional teams in Agile/Scrum environment
β€’ Reduced database query time by 40% through optimization and indexing
Junior Developer | StartupXYZ | Jun 2020 - Dec 2020
β€’ Created feature-rich web application using MERN stack
β€’ Integrated third-party APIs and payment processing systems
β€’ Participated in code reviews and maintained coding standards
β€’ Deployed applications to AWS cloud infrastructure
PROJECTS
E-commerce Platform (2023)
β€’ Built full-stack e-commerce solution with Django backend and React frontend
β€’ Implemented user authentication, shopping cart, and payment integration
β€’ Technologies: Python, Django, React, PostgreSQL, Stripe API
Task Management App (2022)
β€’ Developed collaborative task management application
β€’ Features include real-time updates, file uploads, and team collaboration
β€’ Technologies: Node.js, Express, MongoDB, Socket.io
EDUCATION
Bachelor of Science in Computer Science
State University | 2020
GPA: 3.7/4.0
Relevant Coursework: Data Structures, Algorithms, Database Systems, Software Engineering
"""
# Sample job posting
SAMPLE_JOB = """
Senior Full Stack Engineer
DataFlow Inc.
San Francisco, CA | Remote
About DataFlow Inc.
We're a fast-growing fintech startup building next-generation data analytics tools for financial institutions. Our platform processes billions of transactions daily and helps banks make better decisions through AI-powered insights.
Role Overview
We're seeking a Senior Full Stack Engineer to join our engineering team and help scale our platform to handle growing demand. You'll work on both frontend and backend systems, collaborate with data scientists, and contribute to architectural decisions.
Key Responsibilities
β€’ Design and implement scalable web applications using modern technologies
β€’ Build robust APIs and microservices to support our data platform
β€’ Collaborate with product and design teams to deliver exceptional user experiences
β€’ Optimize application performance and ensure high availability
β€’ Mentor junior developers and contribute to engineering best practices
β€’ Work with data engineering team to build data visualization tools
Required Qualifications
β€’ 4+ years of experience in full-stack web development
β€’ Strong proficiency in Python and modern JavaScript frameworks
β€’ Experience with cloud platforms (AWS, GCP, or Azure)
β€’ Knowledge of relational databases and SQL optimization
β€’ Familiarity with containerization (Docker) and CI/CD pipelines
β€’ Experience with agile development methodologies
β€’ Bachelor's degree in Computer Science or related field
Preferred Qualifications
β€’ Experience with financial/fintech applications
β€’ Knowledge of data visualization libraries (D3.js, Chart.js)
β€’ Familiarity with machine learning concepts
β€’ Experience with Kubernetes and microservices architecture
β€’ Previous experience at a startup or high-growth company
Technical Stack
β€’ Backend: Python, Django/Flask, PostgreSQL, Redis
β€’ Frontend: React, TypeScript, Next.js
β€’ Infrastructure: AWS, Docker, Kubernetes
β€’ Data: Apache Airflow, Spark, Snowflake
Compensation & Benefits
β€’ Competitive salary: $140,000 - $180,000
β€’ Equity package
β€’ Comprehensive health, dental, and vision insurance
β€’ Flexible PTO policy
β€’ $2,000 annual learning and development budget
β€’ Remote-first culture with optional office access
Why Join DataFlow?
β€’ Work on cutting-edge fintech technology
β€’ High-impact role in a fast-growing company
β€’ Collaborative and learning-focused culture
β€’ Opportunity to shape product direction
β€’ Competitive compensation and equity upside
"""
async def test_interview_guide_generation():
"""Test the complete interview guide generation pipeline"""
print("πŸš€ Testing Personalized Interview Guide Generation")
print("=" * 60)
print("\nπŸ“ Resume Summary:")
print(f"- Length: {len(SAMPLE_RESUME)} characters")
print("- Skills: Python, JavaScript, React, Django, AWS")
print("- Experience: 3+ years full-stack development")
print("\n🎯 Job Summary:")
print("- Role: Senior Full Stack Engineer at DataFlow Inc.")
print("- Requirements: 4+ years, Python, JavaScript, Cloud, Fintech")
print("- Salary: $140k-$180k")
print("\n⚑ Generating Interview Guide...")
print("-" * 40)
# Generate the guide
result = create_personalized_interview_guide(SAMPLE_RESUME, SAMPLE_JOB)
if result.get("success"):
print("βœ… Guide generation successful!")
# Display metrics
gap_analysis = result.get("gap_analysis", {})
match_score = gap_analysis.get("match_score", 0)
processing_time = result.get("processing_time", 0)
guide_length = len(result.get("rendered_guide", ""))
print(f"\nπŸ“Š Results:")
print(f"- Match Score: {match_score}%")
print(f"- Processing Time: {processing_time:.2f} seconds")
print(f"- Guide Length: {guide_length} characters")
# Display gap analysis summary
summary = gap_analysis.get("summary", "")
if summary:
print(f"\n🎯 Gap Analysis: {summary}")
# Display skills breakdown
skills_map = gap_analysis.get("skills_map", {})
if skills_map:
print(f"\nπŸ’ͺ Strengths: {skills_map.get('strong', [])[:3]}")
print(f"πŸ“š Areas to Study: {skills_map.get('gaps', [])[:3]}")
# Show first part of rendered guide
rendered_guide = result.get("rendered_guide", "")
if rendered_guide:
print(f"\nπŸ“„ Generated Guide Preview:")
print("-" * 40)
preview = rendered_guide[:500] + "..." if len(rendered_guide) > 500 else rendered_guide
print(preview)
print("-" * 40)
# Save full guide to file
with open("sample_interview_guide.md", "w") as f:
f.write(rendered_guide)
print(f"\nπŸ’Ύ Full guide saved to: sample_interview_guide.md")
else:
print("❌ Guide generation failed!")
error_msg = result.get("error", "Unknown error")
print(f"Error: {error_msg}")
# Show debug info if available
if "data" in result:
print("\nπŸ” Debug Information:")
print(json.dumps(result["data"], indent=2))
def test_validation():
"""Test input validation"""
print("\nπŸ§ͺ Testing Input Validation")
print("-" * 30)
# Test empty inputs
result1 = create_personalized_interview_guide("", SAMPLE_JOB)
print(f"Empty resume: {'βœ… Caught' if not result1.get('success') else '❌ Missed'}")
result2 = create_personalized_interview_guide(SAMPLE_RESUME, "")
print(f"Empty job: {'βœ… Caught' if not result2.get('success') else '❌ Missed'}")
# Test short inputs
result3 = create_personalized_interview_guide("Short resume", SAMPLE_JOB)
print(f"Short resume: {'βœ… Caught' if not result3.get('success') else '❌ Missed'}")
result4 = create_personalized_interview_guide(SAMPLE_RESUME, "Short job")
print(f"Short job: {'βœ… Caught' if not result4.get('success') else '❌ Missed'}")
async def main():
"""Main test function"""
print("🎯 IQKiller Personalized Interview Guide Test Suite")
print("=" * 60)
# Run main test
await test_interview_guide_generation()
# Run validation tests
test_validation()
print("\nπŸŽ‰ Test suite completed!")
print("\nTo view the full generated guide, open: sample_interview_guide.md")
if __name__ == "__main__":
asyncio.run(main())