ExCoveralls

From Elixir Wiki
Jump to navigation Jump to search

ExCoveralls[edit]

File:ExCoveralls logo.png
ExCoveralls Logo

ExCoveralls is an open-source library for the Elixir programming language that provides code coverage reporting for Elixir projects. It is built on top of ExUnit, Elixir's built-in testing framework, and generates coverage reports in the popular Coveralls format.

Installation[edit]

To use ExCoveralls in your Elixir project, add it as a dependency in your mix.exs file:

```elixir defp deps do

 [
   {:excoveralls, "~> 0.13", only: :test}
 ]

end ```

Then, run `mix deps.get` to fetch the dependency.

Usage[edit]

ExCoveralls can be easily integrated into your project's test suite. By simply adding the `--cover` option when running your tests, ExCoveralls will collect coverage data and generate a report.

```shell $ mix test --cover ```

The coverage report will be displayed in the terminal and will also be generated as a file in the `cover` directory in your project's root folder.

Features[edit]

ExCoveralls provides several features for generating and managing code coverage reports:

  • **Detailed Line Coverage**: ExCoveralls tracks the execution of each line of code in your tests, allowing you to analyze which parts of your codebase are being exercised.
  • **Function Coverage**: In addition to line coverage, ExCoveralls also calculates function coverage, providing insights into which functions are being called during your tests.
  • **Module Coverage**: ExCoveralls calculates the coverage of individual modules, helping you identify modules that may require additional testing.
  • **Threshold Configuration**: You can configure coverage threshold values to define acceptable coverage levels for your project. ExCoveralls will notify you if the coverage falls below these thresholds.
  • **Continuous Integration Support**: ExCoveralls is designed to work seamlessly with popular CI services such as Travis CI and CircleCI. It provides compatibility with the Coveralls.io service, allowing you to easily integrate coverage reports into your CI pipelines.

Conclusion[edit]

ExCoveralls is a valuable tool for Elixir developers who want to ensure sufficient test coverage for their projects. With its easy integration, detailed reporting, and threshold customization, ExCoveralls empowers developers to write high-quality, well-tested code.

See Also[edit]

  • ExUnit - Elixir's built-in testing framework
  • Coveralls - Code coverage service for multiple programming languages

References[edit]

- ExCoveralls GitHub Repository: [1](https://github.com/parroty/excoveralls) - ExCoveralls Hex Package: [2](https://hex.pm/packages/excoveralls)