mardi 3 octobre 2017

Is there a downside for tests that inherit from Minitest::Test?

require 'test_helper'

class BatchTest < Minitest::Test

  def test_save_without_attributes
    batch = Batch.new
    assert_equal false, batch.save, "Saved the batch without attributes"
  end
end

When I run the test above I get performance like:

Finished in 0.126160s, 7.9264 runs/s, 7.9264 assertions/s.

However, if the test case inherits from ActiveSupport::TestCase, I get:

Finished in 0.278298s, 3.5933 runs/s, 3.5933 assertions/s.

So it looks like if I want to use the test syntax above it is better to inherit directly from Minitest::Test.

I was just wondering if there are any other drawbacks (other than a somewhat limited syntax)?

Tom.

Aucun commentaire:

Enregistrer un commentaire