A small test framework that supports debugging test failures & errors when they happen
Ruby HTML
Latest commit 5598729 Mar 23, 2015 @hopsoft Put btn text on darker bg.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
pry-test.gemspec

README.md

Lines of Code Code Status Dependency Status Build Status Coverage Status Downloads Join the chat at https://gitter.im/hopsoft/pry-test Gratipay

Formerly known as MicroTest.

PryTest

A small test framework that supports debugging test failures & errors when they happen.

Values

  • Simplicity - writing tests should be easy & devoid of friction
  • Intelligibility - tests should be readable & unambiguous
  • Immediacy - test failures should be dealt with quickly when they occur

Benefits

  • A simple test API
  • An awesome fail pry pass workflow
  • Optional async test runs

An important note on debugging test failures with Pry.

The API

Everything you need to know about PryTest's API is outlined here.

PryTest::Test Superclass for all test classes.
test(desc, &block) Defines a test method.
  • desc - a description of what is being tested
  • &block - a block of code which defines the test
assert(value) Verifies the truthiness of a value.
  • value - the value to assert
before(&block) A callback that runs before each test method.
  • &block - the block of code to execute
after(&block) A callback that runs after each test method.
  • &block - the block of code to execute

A Complete Example

The entire public interface is used in this basic example.

class MathTest < PryTest::Test

  before do
    # runs before each test method
  end

  after do
    # runs after each test method
  end

  test "basic addition" do
    assert 2 + 2 == 4
  end

end

Get Started

PryTest ships with a demo so you can try it out easily.

gem install pry-test
pry-test --help
pry-test --demo

Try some advanced features.

pry-test --demo --async
pry-test --demo --disable-pry

Testing Your Own Projects

PryTest assumes your test directory is located at PROJECT_ROOT/test; however, this isn't a requirement. You can indicate your test directory location.

pry-test /path/to/test/dir

If you have multiple versions of PryTest installed, it's safest to run your tests with bundle exec.

bundle exec pry-test /path/to/test/dir

PryTest is small & unobtrusive. It plays nice with other test frameworks, & can be introduced to existing projects incrementally.

Advanced

See the wiki to troubleshoot or get help with more advanced topics.