How to use RubyUnit framework.

  1. Define class derived from RUNIT::TestCase class.

    class SimpleTest < RUNIT::TestCase
    end
    
  2. If you want to prepare to run test, override setup method.

    class SimpleTest < RUNIT::TestCase
      def setup
        @fval1 = 2.0
        @fval2 = 3.0
      end
    end
    
  3. Add testXXXX method for running test.

    class SimpleTest < RUNIT::TestCase
      ...
      def test_add
        result = @fval1 + @fval2
        assert(result == 6.0)
      end
    end
    
  4. Add teardown method if you want to do something after running test.

  5. Now, you can run tests by calling RUNIT::CUI::TestRunner.run method.

    RUNIT::CUI::TestRunner.run(SimpleTest.suite)