How to Automatically Catch Bugs Manual Testing Overlooks

The EarlyTeam

Unit testing often falls to the bottom of a developer’s to-do list. And while developers might often still write and run manual unit tests for certain parts of the code, they’ll skip the rest due to time constraints. But skipping unit testing can lead to bugs, which can be even more costly and time-consuming if they have to be fixed in later stages.

What if unit testing didn’t have to be slow and boring? What if it could be fast and fun?

EarlyAI leverages GenAI to automatically generate and maintain verified and validated unit tests in minutes. This helps developers identify overlooked bugs, even in code that has been manually tested repeatedly. In fact, one of the key points of the video is about bugs. It begins with the question, 'Are you confident that your code doesn't have bugs?' Eddie Jaoude, initially confident there were none, was surprised to discover a red test. As a result, developers can build better software at a higher quality and at a faster speed.

In this article, we will see how EarlyAI helps catch bugs in the open-source project healthcheck-mini, which assesses the health of GitHub repositories. The project’s contributor, Eddie Jaoude, used EarlyAI to integrate automated testing into his development workflow, after running manual tests. You can watch Eddie’s tutorial video here.

Getting Started with EarlyAI

EarlyAI is available for IDEs like VSCode, Cursor. Here’s a quick guide to set it up on VSCode:

  1. Install EarlyAI: Install EarlyAI from VSCode Marketplace or directly from the VSCode extension panel.
  2. Sign In and Project Setup: Once installed, sign in and open the project files in EarlyAI.

Creating and Running Tests

To see EarlyAI in action, we created tests for the `issues.ts` file. Here’s how it works:

1- Click the 'magic wand' icon beside the filename and EarlyAI will instantly generate unit tests.

2- EarlyAI’s quality engineer, “Earl” will also provide documentation and code improvement suggestions.

3- Once tests are generated, you can run them by clicking the 'Run' icon next to the test. Alternatively, you can execute the tests via the terminal or directly through your testing framework, such as Jest, Mocha, or Vitest, for TypeScript or JavaScript projects. To view the tests, simply click on the 'Go to Test' icon

4- Upon running the test, EarlyAI will display passed and failed tests, providing insights into any issues or bugs. In this case, all the test cases have passed and you can see a green tick beside the test functions.

Bug Detection

Now, let’s create a test for the `description.ts` file in the checks folder and see if we can find bugs this time.

As seen in the image below, one out of five generated tests have failed, so this bug was missed during manual testing. The failed test highlighted an error when a repository description was missing- description method › Edge Cases › should return error when repo has no description”.

Identifying the Issue

The problem lay in how the code handled missing descriptions. The function included a check to verify if the length of the description was less than a certain number.

However, if the length was zero, it would pass the first condition and the second condition again, causing the function to update the status to a new value. This double evaluation was unintentional and led to the test's failure.

 

  if (!repo.description) {

response.status = "error";

response.description = "There is no repo description at the top right.";

response.extra =

   "It is important to write a concise description about your repo.";

  }

 

  if (repo.description?.length < min) {

response.status = "warning";

response.description = "Your description may be too short.";

response.extra = "Try to include more information.";

  }

 

  if (repo.description?.length > max) {

response.status = "warning";

response.description = "Your description may be too long.";

response.extra = "Try reducing the length of your description.";

  }

 

Implementing the Fix

To resolve this, let’s add an extra condition to ensure the length of the description is greater than zero before proceeding with the next check.

 

  if (repo.description?.length > 0  && repo.description?.length < min) {

response.status = "warning";

response.description = "Your description may be too short.";

response.extra = "Try to include more information.";

  }

 

Verifying the Solution

Once the change was implemented, the test automatically ran again and passed successfully. The bug was fixed, and the description test turned green, highlighting how EarlyAI could detect subtle bugs that might go unnoticed during manual testing.

Try for Yourself

Here, we have shown two examples; feel free to create tests for all the files. EarlyAI also allows you to run all tests together by using the “test suite,” and display test coverage for a clearer understanding of your code.

 

Whether you’re a developer who typically skips writing unit tests or someone looking to streamline the testing process, EarlyAI offers a solution that can adapt to any workflow. By generating unit tests in minutes with multiple testing scenarios and paths, EarlyAI not only saves time but also ensures that projects maintain high-quality standards without slowing down.

 

Try it out yourself—installation takes less than two minutes, and it’s free to start.

You code, leave the Test to us!

 

Install Early here