MiniTest Testing Framework for SU
-
For those interested, heres what you need to be able to use Ruby 1.9 new unit testing framework in SU.
-
Download and unpack into su plugin folder
-
require "minitest/autorun" at the beginning of the script you want to be testing
-
load /require all modules/classes and testing files in you script
-
Run MiniTest::Unit.new.run at the end
-
Unit testing magic!
It should look something like this:
require 'minitest/autorun.rb' class A def say_hi return "Hi!" end end class AClassTests < MiniTest;;Unit;;TestCase def setup @a = A.new end def test_say_hi assert_equal @a.say_hi, "Hi!" end end MiniTest;;Unit.new.runAnd Output something like this in the console:
Run options; --seed 27422 # Running tests; init . Finished tests in 0.047000s, 21.2766 tests/s, 21.2766 assertions/s. 1 tests, 1 assertions, 0 failures, 0 errors, 0 skipsTo run it again, just run load "yourloadfile.rb" in the ruby console.
Im not able to get the MiniTest::Unit::autorun feature to work, and this script will run ALL tests loaded into SU, but its seems more than good enough for most.
Regards
Pierre -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement