TeamCity On-Premises 2022.04 Help


The Rake build runner supports the Test::Unit, Test-Spec, Shoulda, RSpec, Cucumber test frameworks. It is compatible with Ruby interpreters installed using Ruby Version Manager (MRI Ruby, JRuby, IronRuby, REE, MacRuby, and so on) with Rake 0.7.3 gem or later.


Make sure to have Ruby interpreter (MRI Ruby, JRuby, IronRuby, REE, MacRuby, and so on) with rake 0.7.3 gem or higher (mandatory) and all necessary gems for your Ruby (or ROR) projects and testing frameworks installed on at least one build agent. You can install several Ruby interpreters in different directories. On Linux/macOS it is easier to configure using RVM or rbenv. It is possible to install Ruby interpreter and necessary Ruby gems using the Command Line build runner step. If you want to automatically configure agent requirements for these interpreters, you need to register its paths in the build agent configuration properties and then refer to such property name in the Rake build runner configuration. To install a gem, execute:

gem install <gem_name>

You can refer to the Ruby Gems Manuals for more information.

Instead of the gem command, you can install gems using the Bundler gem.

Important Notes

  • Ruby's pending specs are shown as Ignored Tests in the Overview tab.

  • Rake Runner uses its own unit tests runner and loads it using the RUBYLIB environment variable. You need to ensure your program doesn't clear this environment variable, but you may append your paths to it.

  • If you run RSpec with the --color option enabled under Windows OS, RSpec will suggest you install the win32console gem. This warning will appear in your build log, but you can ignore it. TeamCity Rake Runner doesn't support coloured output in the build log and does not use this feature.

  • Rake Runner runs spec examples with a custom formatter. If you use additional console formatter, your build log will contain redundant information.

  • Spec::Rake::SpecTask.spec_opts of your rakefile is affected by SPEC_OPTS command line parameter. Rake Runner always uses SPEC_OPTS to set up its custom formatter. Thus, you should set up Spec Options in Web UI. The same limitation exists for Cucumber tests options.

  • To include HTML reports into the build results, you can add the corresponding report tab for them.

Rake Runner Settings

Rake Parameters



Path to a Rakefile file

Enter a Rakefile path if you don't want to use the default one. The specified path should be relative to the Build Checkout Directory.

Rakefile content

Type in the Rakefile content instead of using the existing Rakefile. The new Rakefile will be created dynamically from the specified content before running Rake.

Working directory

Optional. Specify if differs from the Build Checkout Directory.

Rake tasks

Enter space-separated tasks names if you don't want to use the default task. For example, test:functionals or mytask:test mytask:test2.

Additional Rake command line parameters

Specified parameters will be added to rake command line. The command line will have the following format:

ruby rake <Additional Rake command line parameters> <TeamCity Rake Runner options, e.g TESTOPTS> <tasks>

Ruby Interpreter



Use default Ruby

Use Ruby interpreter settings defined in the Ruby environment configurator build feature settings or the interpreter will be searched in the PATH.

Ruby interpreter path

The path to Ruby interpreter. The path cannot be empty. This field supports values of environment and system variables. For example:


RVM interpreter

Specify here the RVM interpreter name and optionally a gemset configured on a build agent. Note, the interpreter name cannot be empty. If gemset isn't specified, the default one will be used.

Launching Parameters



Bundler: bundle exec

If your project uses the Bundler requirements manager and your Rakefile doesn't load the bundler setup script, this option will allow you to launch rake tasks using the bundle exec command emulation. If you want to execute bundle install command, you need to do it in the Command Line step before the Rake step. Also, remember to set up the Ruby environment configurator build feature to automatically pass Ruby interpreter to the command line runner.


Check the Track invoke/execute stages option to enable showing Invoke stage data in the build log.

Tests Reporting



Attached reporters

If you want TeamCity to display the test results on a dedicated Tests tab of the Build Results page, select here the testing framework you use: Test::Unit, Test-Spec, Shoulda, RSpec or Cucumber.

Known Issues

  • If your Rake tasks or tests run in parallel in the scope of one build, the build output and tests results will be inaccurate.

  • If you are using RVM, it is recommended to start TeamCity agent when the current rvm sdk isn't set or to invoke rvm system at first.

Additional Runner Options

These options can be configured using system properties in the Build Parameters section.




Allows specifying which rake gem to use for launching a Rake build.


If your application uses the test-unit gem version other than the latest installed (in Ruby sdk), specify it here. Otherwise, the Test::Unit test reporter may try to load the incorrect gem version and affect the runtime behavior. If the test-unit gem is installed but your application uses Test::Unit bundled in Ruby 1.8.x SDK, set the version value to 'built-in'.


Launches bundler emulation for the specified bundler gem version (the gem should be already installed on an agent.


Customizes Gemfile if it isn't located in the checkout directory root.


Sets BUNDLE_PATH if TeamCity doesn't fetch it correctly from <Gemfile_containing_directory>/.bundle/config.

Rake support is implemented as an open-source plugin. For development links refer to the plugin's page.

Last modified: 28 March 2022