Search⌘ K
AI Features

Running Smaller Groups of Tests in Minitest

Explore techniques to run smaller sets of tests and single test methods in Minitest. Understand how to use Rails rake tasks for file and directory tests and Ruby command line options to execute individual tests efficiently.

Minitest running smaller groups of tests

If we’re invoking Minitest through the rake tasks that Rails provide, then it’s easy to run a single file’s worth of output just by passing the file name at the command line:

Terminal 1
Terminal
Loading...

The argument can be an individual file or a directory. We can have more than one file or directory if spaces separate them.

This behavior is relatively new to Rails. If we’ve been using Rails for a while, we may know that it provides several testing subtasks, such as rake ...