# Up and Running with Minitest

*Published on June 29, 2022*

---


I love minitest. Minitest is simple. There’re a few ways to write tests, and they are so intuitive. I learned it last year, when I got into Ruby, and since then I haven’t really felt the need to dive into the docs that frequently. It just works.

That said, I do find myself doing the minitest setup for my side-projects and quick-off learning projects often. Maybe you’re the same. So here’s a quick guide to rapidly get up and running with minitest in less than 2 minutes.

First, initialize a new project in your project directory:

```bash
bundle init
```

Install minitest using bundler.

```bash
bundle add minitest
```

Add a&nbsp;`Rakefile`.

```ruby
require "minitest/test_task"

Minitest::TestTask.create(:test) do |t|
  t.libs << "test"
  t.libs << "lib"
  t.warning = false
  t.test_globs = ["test/**/*_test.rb"]
end

task :default => :test
```

Create a&nbsp;`test`&nbsp;directory and add the first test in it.

```ruby
require 'minitest/autorun'
require 'lib/instance'

class TestSomething < Minitest::Test
  def setup
    @instance = Instance.new
  end

  def test_something
    assert_equal 12, 3*4
  end
end
```

That’s it. Run the test using the&nbsp;`rake`&nbsp;command.

