mardi 5 avril 2016

Store the results of which assertions passed/failed in Test::Unit

I am trying to run a Test::Unit programmatically and store the results of which assertions passed/failed etc. I can get the resulting outputs such as: "1 tests, 50 assertions, 10 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 80% passed" but this is not detailed enough as I want to know exactly which assertions passed/failed. e.g with a test

    require 'test/unit'
    require_relative 'class1.rb'
    class Class1_test < Test::Unit::TestCase

      def test_method1
        class1 = Class1.new
        assert_equal class1.first_method, 1
      end
      def test_method2
        class1 = Class1.new
        assert_equal class1.second_method, 2
      end
    end

I would want a to be able to create a dataset in the format {{test_method1, pass},{test_method2, fail}}

Aucun commentaire:

Enregistrer un commentaire