Run Tests

Once CodiumAI generates a comprehensive test suite for your code, you can seamlessly execute the tests to determine their pass or fail status. The process of running the tests is conveniently facilitated within the CodiumAI panel, ensuring a smooth and efficient experience.

Note: Currently available only on VS Code editor.

Run <span class="gradient-text">Tests<span>

Getting Started

To initiate the test execution, you'll find a user-friendly interface within the CodiumAI panel that offers two methods.
1

Method 1: Use the "Run All Tests" button.

In the generated test suite, you can see a "Run All Tests" button at the top right corner of the "Tests" section.
VS Code
Codium - VS Code

Clicking the "Run All Tests" button will execute the entire test suite in one go, meaning all the tests generated by the CodiumAI will be executed on a single click.

Example: Execute all the tests generated by CodiumAI for a function that adds two numbers and outputs the sum.

VS Code
Codium - VS Code
2

Method 2: Use the "Run" button.

In each generated test, a button called "Run" is visible above the tag (Which displays the test type).
VS Code
Codium - VS Code

You can use this method if you want to run the tests individually or execute some selected tests.

Example: Execute two selected tests from all the tests generated by CodiumAI for a function that takes two numbers and returns their sum.

VS Code
Codium - VS Code

After executing the tests using either of those two methods, you can see the outcome of each test case (whether the test passed or failed).

If your test passes, the status will display within a green colored box left to the "Run" button.

VS Code
Codium - VS Code

If your test failed, you can see the status in a red colored box. To access the error log, click on the drop-down icon located within it.

VS Code
Codium - VS Code

When a test fails

Several possible reasons exist if a test fails to meet the expected criteria. First, it could be due to the test code needing to accurately reflect the desired behavior or criteria. Alternatively, a failure may indicate the presence of a bug in your code that requires attention.

To address and rectify a failing test, CodiumAI provides several solutions.

1

Fix Test

This option is an easy way to fix the errors in the relevant test code. After the test fails, and the “Fix Test” button appear, you can click the “Fix test” button and let CodiumAI regenerate the test for you.
VS Code
Codium - VS Code
2

Fix Code Issues

CodiumAI's TestGPT model goes beyond test execution and identification of test failures. It also can analyze your code for potential bugs or issues.

If TestGPT identifies a possible issue within your code, a "Possible Code Issue" button will be displayed, providing you with valuable insights. You can access a detailed explanation of the identified bug by clicking this button and receive guidance on effectively resolving it.

Also, you can click the “Fix code” button to let CodiumAI fix the bug for you. After you click “Fix code” you can review the code diff, and merge the changes directly to your code.
VS Code
Codium - VS Code

By actively engaging with CodiumAI's test execution and analysis capabilities, you can verify the accuracy and reliability of your tests, ultimately bolstering the overall quality and robustness of your code.

The seamless integration of test execution, bug identification, and iterative improvement within the CodiumAI panel offers a comprehensive solution to ensure that your code meets the desired specifications and delivers reliable results.

CodiumAI

Check out other features

Gain insights into the range of innovative features that CodiumAI brings to your development toolkit, all designed to ensure superior code integrity and efficiency.