Forrest logo
tool overview
On this page you find all important commands for the CLI tool infection. If the command you are looking for is missing please ask our AI.

infection

Infection is a command line tool designed for mutation testing in various programming languages like PHP, Java, and C#. It helps developers identify weak areas in their code by introducing controlled mutations and observing the impact on the tests.

By randomly altering the code's logic, Infection creates multiple variations of the codebase called mutants. It then runs the test suite against each mutant to check if the tests detect these variations. If a mutant survives undetected, it suggests that the test suite does not have adequate coverage.

Infection supports various mutation operations like replacing logical operators, swapping conditions, modifying operands, and more. Developers can configure which mutations to apply using configuration files in their projects.

It offers integration with popular testing frameworks like PHPUnit and PHPspec, making it easy to incorporate into existing testing workflows.

Infection provides various reports outlining the results of the mutation testing, such as mutation score, number of mutants killed, and killed mutant details. These reports help developers assess the effectiveness of their tests and prioritize areas for improvement.

To speed up the process, Infection employs strategies like parallel execution of tests, caching of test results, and selectively mutating only impacted parts of the codebase.

With its flexibility and compatibility across multiple languages, Infection serves as an efficient tool to drive developers towards writing more robust and comprehensive test suites.

List of commands for infection:

  • infection:tldr:759bb infection: Specify a minimum Mutation Score Indicator (MSI).
    $ infection --min-msi ${percentage}
    try on your machine
    explain this command
  • infection:tldr:75a41 infection: Analyze code using the configuration file (or create one if it does not exist).
    $ infection
    try on your machine
    explain this command
  • infection:tldr:81220 infection: Only mutate lines of code that are covered by tests.
    $ infection --only-covered
    try on your machine
    explain this command
  • infection:tldr:8502e infection: Use a specific test framework (defaults to PHPUnit).
    $ infection --test-framework ${select}
    try on your machine
    explain this command
  • infection:tldr:da0a5 infection: Specify the log verbosity.
    $ infection --log-verbosity ${select}
    try on your machine
    explain this command
  • infection:tldr:ec6b4 infection: Specify a minimum covered code MSI.
    $ infection --min-covered-msi ${percentage}
    try on your machine
    explain this command
  • infection:tldr:f0a27 infection: Use a specific number of threads.
    $ infection --threads ${number_of_threads}
    try on your machine
    explain this command
  • infection:tldr:f4467 infection: Display the mutation code that has been applied.
    $ infection --show-mutations
    try on your machine
    explain this command
tool overview