You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mutahunter uses LLM models to inject context-aware faults into your codebase. This AI-driven approach produces fewer equivalent mutants, mutants with higher fault detection potential, and those with higher coupling and semantic similarity to real faults, ensuring comprehensive and effective testing.
26
24
@@ -30,12 +28,14 @@ Mutahunter uses LLM models to inject context-aware faults into your codebase. Th
30
28
-**LLM Context-aware Mutations:** Utilizes LLM models to generate context-aware mutants. [Research](https://arxiv.org/abs/2406.09843) indicates that LLM-generated mutants have higher fault detection potential, fewer equivalent mutants, and higher coupling and semantic similarity to real faults. It uses a map of your entire git repository to generate contextually relevant mutants using [aider's repomap](https://aider.chat/docs/repomap.html). Supports self-hosted LLMs, Anthropic, OpenAI, and any LLM models via [LiteLLM](https://github.com/BerriAI/litellm).
31
29
-**Change-Based Testing:** Runs mutation tests on modified files and lines based on the latest commit or pull request changes, ensuring that only relevant parts of the code are tested.
32
30
-**Language Agnostic:** Compatible with languages that provide coverage reports in Cobertura XML, Jacoco XML, and lcov formats. Extensible to additional languages and testing frameworks.
33
-
-**Detailed Mutant Reports:**Provides comprehensive reports on mutation coverage, killed mutants, and survived mutants.
31
+
-**LLM Surviving Mutants Analysis:**Automatically analyzes survived mutants to identify potential weaknesses in the test suite, vulnerabilities, and areas for improvement.
34
32
35
33
## Recommended Mutation Testing Process
36
34
37
35

38
36
37
+
We recommend running Mutahunter per test file. This approach ensures that the mutation testing is focused on the test suite's effectiveness and efficiency. Here are some best practices to follow:
38
+
39
39
1.**Achieve High Line Coverage:** Ensure your test suite has high line coverage, preferably 100%.
40
40
41
41
2.**Strict Mutation Testing:** Use strict mutation testing during development to improve mutation coverage during development without additional cost. Utilize the `--only-mutate-file-paths` flag for targeted testing on critical files.
@@ -97,6 +97,11 @@ Check the logs directory to view the report:
97
97
98
98
- `mutants.json` - Contains the list of mutants generated.
99
99
- `coverage.txt` - Contains information about mutation coverage.
100
+
- `audit.md` - Contains the analysis of survived mutants
101
+
102
+
### Survivng Mutant Analysis Audit Report
103
+
104
+

100
105
101
106
## CI/CD Integration
102
107
@@ -154,26 +159,6 @@ jobs:
154
159
filePath: logs/_latest/coverage.txt
155
160
```
156
161
157
-
## Roadmap
158
-
159
-
- [x] **Fault Injection:** Utilize advanced LLM models to inject context-aware faults into the codebase, ensuring comprehensive mutation testing.
160
-
- [x] **Language Support:** Expand support to include various programming languages.
161
-
- [x] **Support for Other Coverage Report Formats:** Add compatibility for various coverage report formats.
162
-
- [x] **Change-Based Testing:** Implement mutation testing on modified files based on the latest commit or pull request changes.
163
-
- [x] **Extreme Mutation Testing:** Apply mutations to the codebase without using LLMs to detect pseudo-tested methods with significantly lower computational cost.
164
-
- [x] **CI/CD Integration:** Display mutation coverage in pull requests and automate mutation testing using GitHub Actions.
165
-
- [ ] **Mutant Analysis:** Automatically analyze survived mutants to identify potential weaknesses in the test suite.
166
-
167
162
## Cash Bounty Program
168
163
169
164
Help us improve Mutahunter and get rewarded! We have a cash bounty program to incentivize contributions to the project. Check out the [bounty board](https://docs.google.com/spreadsheets/d/1cT2_O55m5txrUgZV81g1gtqE_ZDu9LlzgbpNa_HIisc/edit?gid=0#gid=0) to see the available bounties and claim one today!
170
-
171
-
## Acknowledgements
172
-
173
-
Mutahunter makes use of the following open-source libraries:
174
-
175
-
- [aider](https://github.com/paul-gauthier/aider) by Paul Gauthier, licensed under the Apache-2.0 license.
176
-
- [TreeSitter](https://github.com/tree-sitter/tree-sitter) by TreeSitter, MIT License.
177
-
- [LiteLLM](https://github.com/BerriAI/litellm) by BerriAI, MIT License.
178
-
179
-
For more details, please refer to the LICENSE file in the repository.
Copy file name to clipboardExpand all lines: src/mutahunter/core/prompts/user.py
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,3 +43,45 @@ class Mutants(BaseModel):
43
43
44
44
Generate 1~{{maximum_num_of_mutants_per_function_block}} mutants for the function block provided to you. Ensure that the mutants are semantically different from the original code. Focus on critical areas such as error handling, boundary conditions, and logical branches.
45
45
"""
46
+
47
+
48
+
MUTANT_ANALYSIS="""
49
+
## Related Source Code:
50
+
```
51
+
{{source_code}}
52
+
```
53
+
54
+
## Surviving Mutants:
55
+
```json
56
+
{{surviving_mutants}}
57
+
```
58
+
59
+
Based on the mutation testing results only showing the surviving mutants. Please analyze the following aspects:
60
+
- Vulnerable Code Areas: Identification of critical areas in the code that are most vulnerable based on the surviving mutants.
61
+
- Test Case Gaps: Analysis of specific reasons why the existing test cases failed to detect these mutants.
62
+
- Improvement Recommendations: Suggestions for new or improved test cases to effectively target and eliminate the surviving mutants.
- **Description:** Add boundary condition tests for withdrawal amounts exactly at zero and exactly equal to the account balance.
84
+
====
85
+
86
+
To reduce cognitive load, focus on quality over quantity to ensure that the mutants analysis are meaningful and provide valuable insights into the code quality and test coverage. Output your analysis in a clear and concise manner, highlighting the key points for each aspect with less than 300 words.
0 commit comments