Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3ab5c50

Browse files
howonleeHowon Lee
and
Howon Lee
authored
Unit test gen docs (#398)
* thinky * thinky * lets not lmao * thingy * reference * let them ask the question * thinky * looks weird otherwise --------- Co-authored-by: Howon Lee <howon@coderabbit.ai>
1 parent 43b2d89 commit 3ab5c50

File tree

5 files changed

+78
-5
lines changed

5 files changed

+78
-5
lines changed

docs/changelog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ We're excited to announce that two new static analysis tools are now supported o
1515

1616
- [Checkmake](https://github.com/mrtazz/checkmake) is a linter for Makefiles that helps ensure your build scripts follow best practices and maintain consistency.
1717

18+
## June 10, 2025
19+
20+
### Unit Test Generation, Early Access
21+
22+
We're excited to announce that our new unit test generation feature is now available in early access! CodeRabbit can now automatically generate unit tests for your code changes.
23+
24+
Key capabilities:
25+
26+
- **Intelligent Test Generation**: Automatically creates unit tests that cover edge cases, error scenarios, and core functionality
27+
- **Context-Aware**: Generates tests that understand your existing codebase patterns and testing conventions
28+
- **One-Click Integration**: Simply comment `@coderabbitai auto-generate unit tests` on any pull request or specific file, or click on the checkbox available in the walkthrough comment for Early Access customers.
29+
30+
You can customize the generated tests to fit your specific requirements.
31+
1832
## June 5, 2025
1933

2034
### Enhanced Static Analysis: Dotenv Linter and Pylint Support

docs/finishing-touches/docstrings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Docstrings generation is part of the [finishing touches](/future-development#fin
1515

1616
## Usage
1717

18-
Once you are done with your pull request and its reviews, you may want to perform finishing touches to your code, such as adding in-code documentation. You can request CodeRabbit to generate docstrings by typing `@coderabbitai generate docstrings` in a comment under that pull request.
18+
Once you are done with your pull request and its reviews, you may want to perform finishing touches to your code, such as adding in-code documentation. You can request CodeRabbit to generate docstrings by typing `@coderabbitai generate docstrings` in a comment under that pull request or by clicking the **Generate Docstrings** checkbox under **Finishing Touches** in the CodeRabbit Walkthrough.
1919

2020
Once sent, CodeRabbit will perform the following actions:
2121

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: Generate unit tests
3+
description: Automated Unit Test Generation with CodeRabbit
4+
---
5+
6+
```mdx-code-block
7+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
8+
9+
<ProPlanNotice />
10+
```
11+
12+
:::warning
13+
This feature is [experimental](/early-access#experiments).
14+
:::
15+
16+
# Unit Test Generation
17+
18+
Unit Test Generation is part of the [finishing touches](/future-development#finishing-touches).
19+
20+
Unit Test Generation is an Early Access Experimental feature.
21+
22+
## Usage
23+
24+
Once you are done with your pull request and its reviews, you may want to perform finishing touches to your code, such as adding unit tests. You can request CodeRabbit to generate unit tests by typing `@coderabbitai auto-generate unit tests` in a comment under that pull request or by clicking a checkbox under **Generate Unit Tests** in the CodeRabbit Walkthrough.
25+
26+
Once sent, CodeRabbit will perform the following actions:
27+
28+
- The CodeRabbit agent will examine your code for places where it needs tests
29+
- Unit tests will be generated for the PR, in a separate PR, in the same PR in a new commit, or in a comment to copy-paste, depending on your choice
30+
- If (and only if) you choose to generate the unit tests in a separate PR, CodeRabbit will examine your GitHub checks (build steps and tests and such) and adjust the PR to deal with build failures, test failures and similar.
31+
32+
## Path Instructions
33+
34+
You can customize the generated unit tests by providing instructions based on file paths in your `.coderabbit.yaml`. The `path` is a [minimatch](https://github.com/isaacs/minimatch) pattern.
35+
36+
```yaml
37+
code_generation:
38+
unit_tests:
39+
path_instructions:
40+
- path: "**/*.ts"
41+
instructions: |
42+
Use vitest for testing framework.
43+
Generate comprehensive test cases including edge cases and error conditions.
44+
Do not omit the imports; the test file must be valid.
45+
```
46+
47+
## Supported software forges
48+
49+
These software forges are supported:
50+
51+
- GitHub
52+
53+
## Supported CI/CD systems
54+
55+
These CI/CD systems are supported for post-generation adjustments:
56+
57+
- GitHub actions

docs/reference/review-commands.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ CodeRabbit through chat, see [Interact with CodeRabbit reviews](/guides/code-rev
2929

3030
## Documentation commands
3131

32-
| Command | Description | Use Case |
33-
| ----------------------------------- | -------------------------------------------- | --------------------------------------------------- |
34-
| `@coderabbitai generate docstrings` | Generates docstrings for functions in the PR | When you need automatic documentation for your code |
35-
| `@coderabbitai configuration` | Shows current CodeRabbit settings | When you need to check or export your configuration |
32+
| Command | Description | Use Case |
33+
| ---------------------------------------- | -------------------------------------------- | --------------------------------------------------- |
34+
| `@coderabbitai generate docstrings` | Generates docstrings for functions in the PR | When you need automatic documentation for your code |
35+
| `@coderabbitai auto-generate unit tests` | Generates unit tests for the PR | When you need automatic unit testing for your code |
36+
| `@coderabbitai configuration` | Shows current CodeRabbit settings | When you need to check or export your configuration |
3637

3738
## Agentic chat commands
3839

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const sidebars: SidebarsConfig = {
103103
items: [
104104
"integrations/code-graph-analysis",
105105
"finishing-touches/docstrings",
106+
"finishing-touches/unit-test-generation",
106107
],
107108
},
108109
],

0 commit comments

Comments
 (0)