UKG Test Genie
Automated Test Case Generation for JavaScript and TypeScript
🚀 Overview
UKG Test Genie is a Visual Studio Code extension designed to simplify and automate the process of writing test cases for your JavaScript and TypeScript code using AI. With just a single click, you can generate comprehensive and reliable test cases for your functions and classes, saving you time and ensuring your code is robust and well-tested.
Whether you're a solo developer or part of a team, UKG Test Genie integrates seamlessly into your workflow, making test case generation effortless and efficient.
🚨 Prerequisite
- Get Access for Google Cloud / Google Vertex AI. Vertex AI offers access to the latest Gemini models from Google.
Why UKG Test Genie?
Save Time: Automate repetitive test case writing.
Improve Code Quality: Ensure your code is well-tested and reliable.
Seamless Integration: Works effortlessly with JavaScript and TypeScript projects.
Features
- ✅ Automated Test Case Generation: Generate test cases for individual functions or classes in your JavaScript and TypeScript files.
- 🔍 CodeLens Integration: Easily access the "Generate Test Case" button directly above your functions and classes.
- 🖥️ Interactive Webview Panel: View the generated test cases in a side-by-side panel with syntax highlighting and a typing effect.
- 💾 Save Test Cases: Save the generated test cases to a
.spec.js
file in the same directory as your source file.
- 📂 Support for Multiple Functions: Generate test cases for all functions in a file, with a dedicated button for each function.
🌐 Supported Languages
📥 Installation
- Open Visual Studio Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing
Command+Shift+P
.
- Search for "UKG Test Genie".
- Click Install to install the extension.
🛠️ Usage
- Open a JavaScript or TypeScript file in your editor.
- Look for the "Generate Test Case" button above each function or class.
- Click the button to generate test cases for that function or class.
- The generated test cases will appear in a side panel. You can review them and save them to a
.spec.js
file.
📝 Example
Source Code
function findLargest(a: number, b: number, c: number): number {
if (typeof a !== 'number' || typeof b !== 'number' || typeof c !== 'number') {
throw new Error('Inputs must be numbers');
}
return Math.max(a, b, c);
}
Generated Test Cases
describe('findLargest', () => {
it('should return the largest number', () => {
expect(findLargest(1, 2, 3)).toBe(3);
});
it('should throw an error if inputs are not numbers', () => {
expect(() => findLargest('1', 2, 3)).toThrow('Inputs must be numbers');
});
});
📸 Screenshots
Open your project in VSCode. Once the project loads, you'll see a "Generate Test Case"
button (powered by CodeLens) at the top of each function.
Click on the "Generate Test Case" button. This will open a side panel where the extension will automatically start generating test cases for the selected function.

---
💬 Feedback and Support
If you encounter any issues or have suggestions for improvement, please open an issue on our GitHub repository.
We welcome contributions! Feel free to fork the repository, make changes, and submit a pull request.
👨💻 About the Author
UKG Test Genie is developed and maintained by Ujjawal Shrivastava
. Connect with me on GitHub or LinkedIn.
🎉 Happy Testing!**
UKG Test Genie is here to make your testing process faster, easier, and more enjoyable. Give it a try and let us know what you think!
Let me know if you need further assistance! 😊