Class | RubyProf::ProfileTask |
In: |
lib/ruby-prof/task.rb
|
Parent: | Rake::TestTask |
Define a task library for profiling unit tests with ruby-prof.
All of the options provided by the Rake:TestTask are supported except the loader which is set to ruby-prof. For detailed information please refer to the Rake:TestTask documentation.
ruby-prof specific options include:
output_dir - For each file specified an output file with profile information will be written to the output directory. By default, the output directory is called "profile" and is created underneath the current working directory. printer - Specifies the output printer. Valid values include :flat, :graph, :graph_html and :call_tree. min_percent - Methods that take less than the specified percent will not be written out.
Example:
require 'ruby-prof/task' RubyProf::ProfileTask.new do |t| t.test_files = FileList['test/test*.rb'] t.output_dir = "c:/temp" t.printer = :graph t.min_percent = 10 end
If rake is invoked with a "TEST=filename" command line option, then the list of test files will be overridden to include only the filename specified on the command line. This provides an easy way to run just one test.
If rake is invoked with a "TESTOPTS=options" command line option, then the given options are passed to the test process after a ’—’. This allows Test::Unit options to be passed to the test suite.
Examples:
rake profile # run tests normally rake profile TEST=just_one_file.rb # run just one test file. rake profile TESTOPTS="-v" # run in verbose mode rake profile TESTOPTS="--runner=fox" # use the fox test runner
min_percent | [RW] | |
output_dir | [RW] | |
printer | [RW] |