diff --git a/README.md b/README.md index 6863cb0..98604df 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@
-

Mutahunter

- - Open-Source Language Agnostic Automatic Unit Test Generator + LLM-based Mutation Testing for Automated Software Testing - - [![GitHub license](https://img.shields.io/badge/License-AGPL_3.0-blue.svg)](https://github.com/yourcompany/mutahunter/blob/main/LICENSE) - [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=purple)](https://discord.gg/S5u3RDMq) - [![Unit Tests](https://github.com/codeintegrity-ai/mutahunter/actions/workflows/test.yaml/badge.svg)](https://github.com/codeintegrity-ai/mutahunter/actions/workflows/test.yaml) - - GitHub - +  

Mutahunter

+ +  Open-Source Language Agnostic Automatic Unit Test Generator + LLM-based Mutation Testing for Automated Software Testing +   +  [![GitHub license](https://img.shields.io/badge/License-AGPL_3.0-blue.svg)](https://github.com/yourcompany/mutahunter/blob/main/LICENSE) +  [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=purple)](https://discord.gg/S5u3RDMq) +  [![Unit Tests](https://github.com/codeintegrity-ai/mutahunter/actions/workflows/test.yaml/badge.svg)](https://github.com/codeintegrity-ai/mutahunter/actions/workflows/test.yaml) +   +  GitHub +  
📅 UPDATE 2024-07-18 @@ -19,6 +19,11 @@ Check it out here: [Roadmap](https://github.com/codeintegrity-ai/mutahunter/issu We'd love to hear your feedback, suggestions, and any thoughts you have on mutation testing. Join the discussion and share your insights on the roadmap or any other ideas you have. 🙌 +## Quickstart + +[![Run on Replit](https://replit.com/badge/github/codeintegrity-ai/mutahunter)](https://replit.com/@raghuramabilash/Mutahunterai) + + ## Table of Contents - [Features](#features) @@ -41,16 +46,16 @@ Mutahunter can automatically generate unit tests to increase line and mutation c This tool generates unit tests to increase both line and mutation coverage, inspired by papers: -- [Automated Unit Test Improvement using Large Language Models at Meta](https://arxiv.org/abs/2402.09171): - - Uses LLMs to identify and fill gaps in test coverage. +- [Automated Unit Test Improvement using Large Language Models at Meta](https://arxiv.org/abs/2402.09171):   +  - Uses LLMs to identify and fill gaps in test coverage. - [Effective Test Generation Using Pre-trained Large Language Models and Mutation Testing](https://arxiv.org/abs/2308.16557): - - Generates tests that detect and kill code mutants, ensuring robustness. +  - Generates tests that detect and kill code mutants, ensuring robustness. ```bash ## go to examples/java_maven ## remove some tests from BankAccountTest.java -mutahunter gen --test-command "mvn clean test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --test-file-path "src/test/java/BankAccountTest.java" --source-file-path "src/main/java/com/example/BankAccount.java" --coverage-type jacoco --model "gpt-4o" +mutahunter gen --test-command "mvn clean test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --test-file-path "src/test/java/BankAccountTest.java" --source-file-path "src/main/java/com/example/BankAccount.java" --coverage-type jacoco  --model "gpt-4o" Line coverage increased from 47.00% to 100.00% Mutation coverage increased from 92.86% to 92.86% @@ -72,9 +77,9 @@ $ export ANTHROPIC_API_KEY=your-key-goes-here # Coverage report should correspond to the test command. $ mutahunter run --test-command "mvn test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --coverage-type jacoco --model "gpt-4o-mini" -. . . . .-. .-. . . . . . . .-. .-. .-. -|\/| | | | |-| |-| | | |\| | |- |( -' ` `-' ' ` ' ' ` `-' ' ` ' `-' ' ' +.  . . . .-. .-. . . . . . . .-. .-. .-. +|\/| | |  |  |-| |-| | | |\|  |  |-  |( +'  ` `-'  '  ` ' ' ` `-' ' `  '  `-' ' ' 2024-07-29 12:31:22,045 INFO: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -83,8 +88,8 @@ $ mutahunter run --test-command "mvn test" --code-coverage-report-path "target/s 📈 Line Coverage: 100.00% 📈 🎯 Mutation Coverage: 63.33% 🎯 🦠 Total Mutants: 30 🦠 -🛡️ Survived Mutants: 11 🛡️ -🗡️ Killed Mutants: 19 🗡️ +🛡️  Survived Mutants: 11 🛡️ +🗡️  Killed Mutants: 19 🗡️ 🕒 Timeout Mutants: 0 🕒 🔥 Compile Error Mutants: 0 🔥 💰 Total Cost: $0.00167 USD 💰 @@ -125,52 +130,52 @@ You can integrate Mutahunter into your CI/CD pipeline to automate mutation testi name: Mutahunter CI/CD on: - push: - branches: - - main - pull_request: - branches: - - main +  push: +    branches: +      - main +  pull_request: +    branches: +      - main jobs: - mutahunter: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 2 # needed for git diff - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - - name: Install Mutahunter - run: pip install mutahunter - - - name: Set up Java for your project - uses: actions/setup-java@v2 - with: - distribution: "adopt" - java-version: "17" - - - name: Install dependencies and run tests - run: mvn test - - - name: Run Mutahunter - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - run: | - mutahunter run --test-command "mvn test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --coverage-type jacoco --model "gpt-4o" --diff - - - name: PR comment the mutation coverage - uses: thollander/actions-comment-pull-request@v2.5.0 - with: - filePath: logs/_latest/coverage.txt +  mutahunter: +    runs-on: ubuntu-latest + +    steps: +      - name: Checkout repository +        uses: actions/checkout@v4 +        with: +          fetch-depth: 2 # needed for git diff + +      - name: Set up Python +        uses: actions/setup-python@v5 +        with: +          python-version: 3.11 + +      - name: Install Mutahunter +        run: pip install mutahunter + +      - name: Set up Java for your project +        uses: actions/setup-java@v2 +        with: +          distribution: "adopt" +          java-version: "17" + +      - name: Install dependencies and run tests +        run: mvn test + +      - name: Run Mutahunter +        env: +          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} +        run: | +          mutahunter run --test-command "mvn test" --code-coverage-report-path "target/site/jacoco/jacoco.xml" --coverage-type jacoco --model "gpt-4o" --diff + +      - name: PR comment the mutation coverage +        uses: thollander/actions-comment-pull-request@v2.5.0 +        with: +          filePath: logs/_latest/coverage.txt ``` ## Cash Bounty Program -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! +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! \ No newline at end of file