Show HN: Wasted hours on Unit tests, so I built VS Code ext for AI tests (marketplace.visualstudio.com)
Hey guys,
I'm investing a ton of time on writing unit tests, for both enterprise and personal projects.
I came up with the idea to make extension for AI-generated tests and cases within a VS Code.
Happy to hear feedback, both positive and negative.
15 comments
[ 5.6 ms ] story [ 48.0 ms ] threadThat is infinite process, we're all stuck within :-)
I'd expect that the ai written code doesn't do the right thing outside of the given test cases
TypeScript utility method I generated cases and tests for -------
Generated test cases ------------- POSITIVE - Merging two arrays with unique and overlapping objects by id Given: Two arrays of objects with unique and overlapping ids When: Merging two arrays of objects where some objects have matching ids Then: Should return an array of merged objects with no duplicates and combined properties for overlapping idsNEGATIVE - Merging arrays when second array contains objects with undefined ids Given: First array of objects with valid ids and second array with some objects having undefined ids When: Second array contains objects with undefined ids Then: Should throw an error or handle undefined ids gracefully without merging those objects
EDGE CASE - Merging arrays where all objects in the second array have matching ids in the first array Given: Two arrays of objects with ids where the second array's objects all have ids that match those in the first array When: Every object in the second array has a matching id in the first array Then: Should return an array with objects from the first array having their properties updated by the second array's objects
Generated unit tests by test cases -------------
---> 1st case ---------------
it('Merging two arrays with unique and overlapping objects by id should return an array of merged objects with no duplicates and combined properties for overlapping ids', () => { // Arrange const arr1 = [{ id: '1', name: 'Alice' }, { id: '2', name: 'Bob' }]; const arr2 = [{ id: '2', name: 'Robert' }, { id: '3', name: 'Charlie' }]; const expectedResult = [ { id: '1', name: 'Alice' }, { id: '2', name: 'Robert' }, // Note: 'Bob' is overwritten by 'Robert' { id: '3', name: 'Charlie' } ];
});---> 2nd case ----------------
it('Merging arrays when second array contains objects with undefined ids should throw an error or handle undefined ids gracefully', () => { // Arrange const arr1 = [{ id: '1', name: 'Alice' }, { id: '2', name: 'Bob' }]; const arr2 = [{ id: '2', age: 30 }, { name: 'Charlie' }]; // Charlie has undefined id
});---> 3rd case ----------------
it('Merging arrays where all objects in the second array have matching ids in the first array', () => { // Arrange const arr1 = [{ id: '1', propA: 'A1' }, { id: '2', propA: 'A2' }]; const arr2 = [{ id: '1', propB: 'B1' }, { id: '2', propB: 'B2' }]; const expectedResult = [ { id: '1', propA: 'A1', propB: 'B1' }, { id: '2', pro...
If I imagine a workflow of
1. Updating some code (with a regression) 2. Running the ai to generate tests 3. The tests pass
How do I know that the ai didn't assume the regression is expected? Do I read the explanation of the test cases?
They are generated by AI, so unit tests will be implemented by case definitions.
You have full control over generated tests. Also, I put focus on putting as much control as possible, so you can set different inputs to reach higher quality of generated tests.
At the end, you add or append file with generated tests, so you have full control over them.