A BDD framework for Elixir providing an expressive RSpec-like syntax built on top of ExUnit.
Pavlov is a Behavior-Driven Development (BDD) framework for Elixir projects that provides a rich, expressive syntax for writing unit tests. It serves as an abstraction layer over Elixir's standard ExUnit library, retaining all of ExUnit's core functionality while introducing a more readable, RSpec-inspired testing style. It solves the problem of writing more maintainable and readable tests in Elixir by offering features like describe/context blocks, let helpers, and an expect syntax.
Elixir developers and teams who prefer a BDD-style, RSpec-like syntax for unit testing and want enhanced readability and organization in their test suites. It is particularly suited for those already familiar with RSpec from other languages like Ruby.
Developers choose Pavlov because it brings the expressive, readable testing style of RSpec to the Elixir ecosystem while maintaining full compatibility with ExUnit's robust foundation. Its unique selling point is offering features like memoized helpers (let), explicit subjects, mocking support with Meck, and pending test markers, all within a familiar BDD structure.
A BDD framework for your Elixir projects
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers an RSpec-inspired 'expect' syntax that enhances readability, as shown in examples like 'expect Order.sum(order) |> to_eq 15.2', making tests more maintainable.
Includes 'let' for memoized, lazily-evaluated helpers that cache values across tests, reducing setup duplication, evidenced by the 'order' helper in the README.
Seamlessly integrates with Meck for mocking functions, with support for argument assertions, demonstrated in the HTTPotion mocking example with 'allow' and 'to_have_received'.
Supports 'describe' and 'context' blocks for logical grouping, plus callbacks like 'before(:each)' for setup code, allowing controlled test execution.
Mocking functionality is exclusively tied to Meck, which may not suit projects using other libraries or avoiding external dependencies for mocking.
Requires adding 'Pavlov.start' to test/test_helper.exs, an extra step compared to ExUnit's out-of-the-box configuration, adding initial overhead.
Introduces RSpec-specific concepts like 'subject' and nested contexts, which can steepen the learning curve for developers accustomed to Elixir's simpler, functional testing style.