Skip to content

Commit 7a60c53

Browse files
committed
update docs
1 parent 1f6e840 commit 7a60c53

File tree

1 file changed

+30
-48
lines changed

1 file changed

+30
-48
lines changed

README.md

Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
## Table of Contents
2222

2323
- [Overview](#overview)
24-
- [Installation and Usage](#installation-and-usage)
24+
- [Features](#features)
25+
- [Getting Started](#getting-started)
2526
- [Roadmap](#roadmap)
2627

2728
## Overview
@@ -32,62 +33,46 @@ To put it simply, mutation testing is a way to verify how good your test cases a
3233

3334
MutaHunter leverages LLM models to inject context-aware faults into your codebase. Unlike traditional rule-based methods, MutaHunter’s AI-driven approach provides a full contextual understanding of the entire codebase, enabling it to identify and inject mutations that closely resemble real bugs. This ensures comprehensive and effective testing, significantly enhancing software security and quality.
3435

35-
Examples:
36+
## Features
3637

37-
- [Go Example](/examples/go_webservice/)
38-
- [Java Example](/examples/java_maven/)
39-
- [JavaScript Example](/examples/js_vanilla/)
40-
- [Python FastAPI Example](/examples/python_fastapi/)
41-
42-
Feel free to add more examples! ✨
38+
- **Change-Based:** Runs mutation tests on modified files and lines based on the latest commit or pull request changes.
39+
- **Multi-Language Support:** Compatible with languages that provide coverage reports in Cobertura XML, Jacoco XML, and lcov formats.
40+
- **Extensible:** Extensible to additional languages and testing frameworks.
41+
- **Context-Aware:** Uses a map of your entire git repository to generate contextually relevant mutants.
42+
- **LLM Support:** Supports self-hosted, Anthropic, OpenAI, and any LLM models using LiteLLM.
43+
- **Mutant Report** Provides detailed reports on mutation coverage, killed mutants, and survived mutants.
4344

44-
## Why you should use Mutahunter?
45+
## Getting Started
4546

46-
1. **AI-Driven Mutation Testing:** Mutahunter leverages advanced LLM models to inject context-aware faults into your codebase rather than blindly mutating the code. This allows the mutants to closely resemble real bugs.
47-
2. **Language Agnostic:** Mutahunter supports various programming languages and can be extended to work with any language that provides a coverage report in **Cobertura** XML format, **Jacoco** XML format, and **lcov** format.
48-
3. **Diff-Based Mutation Testing:** Mutahunter can run mutation testing specifically on modified files and lines based on the latest commit or pull request changes. This feature optimizes the mutation testing process by focusing on recent changes.
49-
4. **Enhanced Mutation Coverage Report (WIP):** Mutahunter provides detailed mutation coverage reports, highlighting the effectiveness of your test suite and identifying potential weaknesses.
50-
51-
**Afraid of sending code to OpenAI or Anthropic? No problem, we support self-hosted versions as well.** 🔒
52-
53-
## Installation and Usage
54-
55-
### Requirements
56-
57-
- LLM API Key (OpenAI, Anthropic, self-hosted, etc): Follow [liteLLM](https://litellm.vercel.app/docs/) instructions to set up your environment.
58-
- **Cobertura XML**, **Jacoco XML**, or **lcov** code coverage report for a specific test file.
59-
- Python to install the Mutahunter package. **Version 3.11+** are supported.
60-
61-
#### Python Pip
47+
```bash
48+
# Install Mutahunter package via GitHub. Python 3.11+ is required.
49+
$ pip install git+https://github.com/codeintegrity-ai/mutahunter.git
6250

63-
To install the Python Pip package directly via GitHub:
51+
# Work with GPT-4o on your repo
52+
$ export OPENAI_API_KEY=your-key-goes-here
6453

65-
```bash
66-
# Work with GPT-4o on your repo. See litellm for other models.
67-
export OPENAI_API_KEY=your-key-goes-here
54+
# Or, work with Anthropic's models
55+
$ export ANTHROPIC_API_KEY=your-key-goes-here
6856

69-
# Or, work with Anthropic's models. See litellm for other models.
70-
export ANTHROPIC_API_KEY=your-key-goes-here
57+
# Run Mutahunter on a specific file. **Note:** Make sure coverage report is generated and correspons to the test command.
58+
$ mutahunter run --test-command "pytest tests/unit" --code-coverage-report-path "coverage.xml" --only-mutate-file-paths "app_1.py" "app_2.py"
7159

72-
pip install git+https://github.com/codeintegrity-ai/mutahunter.git
60+
# Run mutation testing on modified files based on the latest commit
61+
$ mutahunter run --test-command "pytest test/unit" --code-coverage-report-path "coverage.xml" --modified-files-only
7362
```
7463

75-
### How to Execute Mutahunter
76-
77-
To use Mutahunter, you first need a **Cobertura XML**, **Jacoco XML**, or **lcov** code coverage report. **Make sure your test command correlates with the coverage report.**
64+
### Examples
7865

79-
Example command to run Mutahunter on a Python FastAPI [application](/examples/python_fastapi/):
66+
Go to the examples directory to see how to run Mutahunter on different programming languages:
8067

81-
```bash
82-
mutahunter run --test-command "pytest test_app.py" --code-coverage-report-path "coverage.xml" --only-mutate-file-paths "app.py"
83-
# --only-mutate-file-paths makes it faster by focusing on specific files
84-
```
68+
- [Go Example](/examples/go_webservice/)
69+
- [Java Example](/examples/java_maven/)
70+
- [JavaScript Example](/examples/js_vanilla/)
71+
- [Python FastAPI Example](/examples/python_fastapi/)
8572

86-
To run mutation testing specifically on modified files and lines based on the latest commit:
73+
Feel free to add more examples! ✨
8774

88-
```bash
89-
mutahunter run --test-command "pytest test_app.py" --code-coverage-report-path "coverage.xml" --modified-files-only
90-
```
75+
### Command Options
9176

9277
The mutahunter run command has the following options:
9378

@@ -129,16 +114,13 @@ Options:
129114
Required: No
130115
```
131116

132-
#### Mutation Testing Report
117+
## Mutant Report
133118

134119
Check the logs directory to view the report:
135120

136121
- `mutants_killed.json` - Contains the list of mutants that were killed by the test suite.
137122
- `mutants_survived.json` - Contains the list of mutants that survived the test suite.
138123
- `mutation_coverage.json` - Contains the mutation coverage report.
139-
- `test_suite_report.md` **(experimental)** - Contains a detailed report of identified weaknesses in the test suite and potential bugs not caught by the test suite.
140-
141-
An example survived mutant information would be like so:
142124

143125
```json
144126
[

0 commit comments

Comments
 (0)