Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Proof of concept speed tests using minitest.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 minitest-speed.gemspec
README.md

minitest-speed

This is an extension to minitest which adds speed tests to the mix. Speed tests are simply methods which are timed, and their timing date is outputted. If this timing data is saved somewhere, it can be graphed later and viewed.

WARNING: This is a proof of concept. It works, but is not intended -- in its current form -- to be used for production tests.

Example

Defining And Using a Speed Test

Define a test class:

require "minitest/autorun"
require "minitest/speed"

class MyTest < MiniTest::Speed::TestCase
  def test_speed_of_hash_creation
    Hash.new
  end
end

Run them:

$ SPEED=1 ruby my_test.rb
Started
test_speed_of_hash_creation:   0.000000   0.000000   0.000000 (  0.000019)

Finished in 0.000753 seconds.

1 tests, 0 assertions, 0 failures, 0 errors, 0 skips

With SPEED set, only the speed tests are run, and their output is easily visible. If SPEED is not set, then only non-speed tests are run.

Something went wrong with that request. Please try again.