|
| 1 | +--- |
| 2 | +id: how-keploy-utg-works |
| 3 | +title: How Keploy UTG PR Agent Works? |
| 4 | +sidebar_label: How Keploy Works? |
| 5 | +tags: |
| 6 | + - explanation |
| 7 | + - why keploy |
| 8 | + - automated testing |
| 9 | + - test scripts |
| 10 | + - manual testing |
| 11 | + - record replay test |
| 12 | +--- |
| 13 | + |
| 14 | +> **Transform your testing workflow with intelligent, AI-powered unit test generation that understands your code like a senior developer.** |
| 15 | +
|
| 16 | +Keploy UTG (Unit Test Generator) revolutionizes the way developers approach testing by combining advanced static analysis, intelligent code parsing, and cutting-edge AI-driven test case generation. Our platform seamlessly integrates into your existing development workflow through two powerful tools designed for maximum efficiency and minimal friction. |
| 17 | + |
| 18 | +## **Core Integration Points** |
| 19 | + |
| 20 | +### 1. **VS Code Extension** - |
| 21 | + |
| 22 | +Direct integration into your favorite IDE for real-time test generation during active development. |
| 23 | + |
| 24 | +### 2. **PR Agent** |
| 25 | + |
| 26 | +Intelligent pull request analysis that ensures every code change comes with comprehensive test coverage. |
| 27 | + |
| 28 | +## **The Intelligent Test Generation Pipeline** |
| 29 | + |
| 30 | +Our sophisticated four-step process transforms your code into comprehensive test suites: |
| 31 | + |
| 32 | +### **Step 1: Smart Input Detection** |
| 33 | + |
| 34 | +- **Single Function Mode**: Target specific functions or methods for focused testing |
| 35 | +- **File-Level Analysis**: Process entire source files for comprehensive coverage |
| 36 | +- **PR Delta Scanning**: Automatically detect and analyze only changed code in pull requests |
| 37 | +<!-- - **Multi-Language Support**: Seamlessly handle JavaScript, TypeScript, Java, Go, and Python --> |
| 38 | + |
| 39 | +### **Step 2: Deep Code Intelligence** |
| 40 | + |
| 41 | +Keploy's advanced parser performs comprehensive code analysis: |
| 42 | + |
| 43 | +- **Function Signature Analysis**: Extract parameter types, return types, and method signatures |
| 44 | +- **Control Flow Mapping**: Identify all conditional branches, loops, and execution paths |
| 45 | +- **Dependency Discovery**: Automatically detect external API calls, database interactions, and third-party integrations |
| 46 | +- **Type Inference**: Smart type detection for dynamically typed languages |
| 47 | +- **Business Logic Recognition**: Understand complex logic patterns and business rules |
| 48 | + |
| 49 | +### **Step 3: AI-Powered Test Synthesis** |
| 50 | + |
| 51 | +Our proprietary AI engine combines rule-based heuristics with machine learning: |
| 52 | + |
| 53 | +- **Pattern Recognition**: Trained on millions of real-world code patterns and testing scenarios |
| 54 | +- **Edge Case Generation**: Automatically identify and test boundary conditions, null values, and error states |
| 55 | +- **Mock Auto-Generation**: Intelligent creation of mocks and stubs for external dependencies |
| 56 | +- **Regression Testing**: Generate tests that prevent future breaking changes |
| 57 | +- **Performance Considerations**: Include basic performance validation where applicable |
| 58 | + |
| 59 | +### **Step 4: Framework-Native Output** |
| 60 | + |
| 61 | +Generate production-ready test files that feel hand-written: |
| 62 | + |
| 63 | +- **Framework Compliance**: Output tests in your project's existing testing framework |
| 64 | +- **Code Style Matching**: Maintain consistency with your team's coding conventions |
| 65 | +- **Comprehensive Coverage**: Include happy path, edge cases, error scenarios, and integration points |
| 66 | +- **Documentation Integration**: Auto-generate test descriptions and inline comments |
| 67 | + |
| 68 | +## **VS Code Extension Deep Dive** |
| 69 | + |
| 70 | +### **Seamless Workflow Integration** |
| 71 | + |
| 72 | +Transform your development experience with context-aware test generation: |
| 73 | + |
| 74 | +```typescript |
| 75 | +// Right-click any function → "Generate Unit Tests" |
| 76 | +function calculateTax(income: number, rate: number): number { |
| 77 | + if (income < 0) throw new Error("Income cannot be negative"); |
| 78 | + return income * (rate / 100); |
| 79 | +} |
| 80 | +// ↓ Instantly generates comprehensive test suite ↓ |
| 81 | +``` |
| 82 | + |
| 83 | +### **Key Features** |
| 84 | + |
| 85 | +- **One-Click Generation**: Right-click context menu integration |
| 86 | +- **Smart File Organization**: Auto-creates `tests/` or `__tests__/` directories |
| 87 | +- **Live Preview**: See generated tests before committing |
| 88 | +- **Incremental Updates**: Add tests for new functions without breaking existing ones |
| 89 | +- **Customizable Templates**: Configure output format and naming conventions |
| 90 | + |
| 91 | +### **Perfect For:** |
| 92 | + |
| 93 | +- **Active Development**: Generate tests while writing new features |
| 94 | +- **Refactoring Sessions**: Ensure changes don't break existing functionality |
| 95 | +- **Legacy Code**: Add tests to existing codebases incrementally |
| 96 | +- **Learning**: Understand testing best practices through AI-generated examples |
| 97 | + |
| 98 | +## **PR Agent: Your Automated Quality Assurance** |
| 99 | + |
| 100 | +### **Intelligent Pull Request Analysis** |
| 101 | + |
| 102 | +Transform your code review process with automated test generation: |
| 103 | + |
| 104 | +- **Diff-Based Intelligence**: Analyzes only changed lines for targeted test generation |
| 105 | +- **Multi-File Support**: Handles complex PRs affecting multiple modules |
| 106 | +- **Contextual Understanding**: Considers the broader codebase context when generating tests |
| 107 | +- **Review Integration**: Seamlessly integrates with GitHub, GitLab, and Bitbucket workflows |
| 108 | + |
| 109 | +### **Advanced Capabilities** |
| 110 | + |
| 111 | +- **Smart Commenting**: Adds meaningful comments explaining test logic and edge cases |
| 112 | +- **Coverage Metrics**: Provides instant feedback on test coverage improvements |
| 113 | +- **Conflict Resolution**: Handles merge conflicts in test files intelligently |
| 114 | +- **Team Notifications**: Alerts team members when tests are auto-generated or updated |
| 115 | + |
| 116 | +### **Deployment Options** |
| 117 | + |
| 118 | +- **GitHub Comments**: Non-intrusive suggestions in PR conversations |
| 119 | +- **Auto-Commit Mode**: Directly pushes tests to feature branches |
| 120 | +- **Review Required**: Requires maintainer approval before test integration |
| 121 | +- **Custom Workflows**: Integrate with existing CI/CD pipelines and quality gates |
| 122 | + |
| 123 | +## **Advanced Technical Architecture** |
| 124 | + |
| 125 | +### **Core Technologies** |
| 126 | + |
| 127 | +- **Multi-Language AST Parsing**: Language-specific parsers for accurate code understanding |
| 128 | +- **Machine Learning Models**: Continuously trained on open-source and enterprise codebases |
| 129 | +- **Intelligent Type Inference**: Advanced algorithms for dynamic language support |
| 130 | +- **Mock Generation Engine**: Sophisticated stubbing for complex external dependencies |
| 131 | +- **Pattern Matching System**: Recognition of common coding patterns and anti-patterns |
| 132 | + |
| 133 | +### **Performance & Scalability** |
| 134 | + |
| 135 | +- **Parallel Processing**: Handle multiple files simultaneously |
| 136 | +- **Incremental Analysis**: Only process changed code for faster execution |
| 137 | +- **Cloud-Native Architecture**: Scalable infrastructure for enterprise workloads |
| 138 | +- **Caching Layer**: Smart caching for repeated analysis patterns |
| 139 | + |
| 140 | +<!-- ## **Comprehensive Framework Support** |
| 141 | +
|
| 142 | +| Language | Primary Frameworks | Advanced Features | |
| 143 | +|----------|-------------------|-------------------| |
| 144 | +| **JavaScript/TypeScript** | Jest, Mocha, Vitest | React Testing Library, DOM mocking | |
| 145 | +| **Java** | JUnit 5, TestNG, Mockito | Spring Test integration, annotation support | |
| 146 | +| **Go** | Built-in testing, Testify | Goroutine testing, benchmark generation | |
| 147 | +| **Python** | pytest, unittest | Fixture management, async testing | --> |
| 148 | + |
| 149 | +## **Workflow Summary** |
| 150 | + |
| 151 | +| **Tool** | **Trigger** | **Use Case** | **Output** | **Best For** | |
| 152 | +| --------------------- | --------------------- | ------------------- | --------------------- | --------------------- | |
| 153 | +| **VS Code Extension** | Manual/On-demand | Active development | Local test files | Individual developers | |
| 154 | +| **PR Agent** | Automatic/PR creation | Code review process | PR comments + commits | Team workflows | |
| 155 | + |
| 156 | +## **Getting Started** |
| 157 | + |
| 158 | +Ready to revolutionize your testing workflow? Keploy UTG eliminates the tedious aspects of test writing, allowing you to focus on building exceptional software while maintaining the highest quality standards. |
| 159 | + |
| 160 | +**Next Steps:** |
| 161 | + |
| 162 | +- Install the VS Code extension for immediate productivity gains |
| 163 | +- Configure PR Agent for automated team-wide quality assurance |
| 164 | +- Explore advanced configuration options for enterprise deployments |
| 165 | + |
| 166 | +_Questions? Our support team and community are here to help you maximize your testing efficiency._ |
| 167 | + |
| 168 | +import GetSupport from '../concepts/support.md' |
| 169 | + |
| 170 | +<GetSupport/> |
0 commit comments